fix: better test compareison (also qt5 compat)

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
This commit is contained in:
Rachel Powers 2023-02-09 20:12:36 -07:00
parent 34ac8b3ec3
commit cd2419137d

View File

@ -755,28 +755,28 @@ slots:
} }
void test_path_depth() { void test_path_depth() {
QCOMPARE_EQ(FS::PathDepth(""), 0); QCOMPARE(FS::PathDepth(""), 0);
QCOMPARE_EQ(FS::PathDepth("."), 0); QCOMPARE(FS::PathDepth("."), 0);
QCOMPARE_EQ(FS::PathDepth("foo.txt"), 0); QCOMPARE(FS::PathDepth("foo.txt"), 0);
QCOMPARE_EQ(FS::PathDepth("./foo.txt"), 0); QCOMPARE(FS::PathDepth("./foo.txt"), 0);
QCOMPARE_EQ(FS::PathDepth("./bar/foo.txt"), 1); QCOMPARE(FS::PathDepth("./bar/foo.txt"), 1);
QCOMPARE_EQ(FS::PathDepth("../bar/foo.txt"), 0); QCOMPARE(FS::PathDepth("../bar/foo.txt"), 0);
QCOMPARE_EQ(FS::PathDepth("/bar/foo.txt"), 1); QCOMPARE(FS::PathDepth("/bar/foo.txt"), 1);
QCOMPARE_EQ(FS::PathDepth("baz/bar/foo.txt"), 2); QCOMPARE(FS::PathDepth("baz/bar/foo.txt"), 2);
QCOMPARE_EQ(FS::PathDepth("/baz/bar/foo.txt"), 2); QCOMPARE(FS::PathDepth("/baz/bar/foo.txt"), 2);
QCOMPARE_EQ(FS::PathDepth("./baz/bar/foo.txt"), 2); QCOMPARE(FS::PathDepth("./baz/bar/foo.txt"), 2);
QCOMPARE_EQ(FS::PathDepth("/baz/../bar/foo.txt"), 1); QCOMPARE(FS::PathDepth("/baz/../bar/foo.txt"), 1);
} }
void test_path_trunc() { void test_path_trunc() {
QCOMPARE_EQ(FS::PathTruncate("", 0), ""); QCOMPARE(FS::PathTruncate("", 0), "");
QCOMPARE_EQ(FS::PathTruncate("foo.txt", 0), ""); QCOMPARE(FS::PathTruncate("foo.txt", 0), "");
QCOMPARE_EQ(FS::PathTruncate("foo.txt", 1), ""); QCOMPARE(FS::PathTruncate("foo.txt", 1), "");
QCOMPARE_EQ(FS::PathTruncate("./bar/foo.txt", 0), "./bar"); QCOMPARE(FS::PathTruncate("./bar/foo.txt", 0), "./bar");
QCOMPARE_EQ(FS::PathTruncate("./bar/foo.txt", 1), "./bar"); QCOMPARE(FS::PathTruncate("./bar/foo.txt", 1), "./bar");
QCOMPARE_EQ(FS::PathTruncate("/bar/foo.txt", 1), "/bar"); QCOMPARE(FS::PathTruncate("/bar/foo.txt", 1), "/bar");
QCOMPARE_EQ(FS::PathTruncate("bar/foo.txt", 1), "bar"); QCOMPARE(FS::PathTruncate("bar/foo.txt", 1), "bar");
QCOMPARE_EQ(FS::PathTruncate("baz/bar/foo.txt", 2), "baz/bar"); QCOMPARE(FS::PathTruncate("baz/bar/foo.txt", 2), "baz/bar");
} }
}; };