Skip to content

Commit 97a7405

Browse files
committed
Use more explicit namespace in tests/utils
1 parent 1936475 commit 97a7405

File tree

1 file changed

+34
-34
lines changed

1 file changed

+34
-34
lines changed

tests/utils.cpp

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,42 +5,42 @@
55

66
TEST_CASE("u::fs")
77
{
8-
using namespace giada::u;
9-
10-
REQUIRE(fs::fileExists(TEST_RESOURCES_DIR "test.wav") == true);
11-
REQUIRE(fs::fileExists("nonexistent_file") == false);
12-
REQUIRE(fs::dirExists(TEST_RESOURCES_DIR) == true);
13-
REQUIRE(fs::dirExists("ghost_dir/") == false);
14-
REQUIRE(fs::isDir(TEST_RESOURCES_DIR) == true);
15-
REQUIRE(fs::isDir("nonexistent_dir") == false);
16-
REQUIRE(fs::basename("tests/utils.cpp") == "utils.cpp");
17-
REQUIRE(fs::dirname("tests/utils.cpp") == "tests");
18-
REQUIRE(fs::getExt("tests/utils.cpp") == ".cpp");
19-
REQUIRE(fs::stripExt("tests/utils.cpp") == "tests/utils");
8+
using namespace giada;
9+
10+
REQUIRE(u::fs::fileExists(TEST_RESOURCES_DIR "test.wav") == true);
11+
REQUIRE(u::fs::fileExists("nonexistent_file") == false);
12+
REQUIRE(u::fs::dirExists(TEST_RESOURCES_DIR) == true);
13+
REQUIRE(u::fs::dirExists("ghost_dir/") == false);
14+
REQUIRE(u::fs::isDir(TEST_RESOURCES_DIR) == true);
15+
REQUIRE(u::fs::isDir("nonexistent_dir") == false);
16+
REQUIRE(u::fs::basename("tests/utils.cpp") == "utils.cpp");
17+
REQUIRE(u::fs::dirname("tests/utils.cpp") == "tests");
18+
REQUIRE(u::fs::getExt("tests/utils.cpp") == ".cpp");
19+
REQUIRE(u::fs::stripExt("tests/utils.cpp") == "tests/utils");
2020
#if defined(_WIN32)
21-
REQUIRE(fs::isRootDir("\\") == true);
22-
REQUIRE(fs::isRootDir("C:\\path\\to\\something") == false);
23-
REQUIRE(fs::getUpDir("C:\\path\\to\\something") == "C:\\path\\to");
24-
REQUIRE(fs::getUpDir("C:\\path") == "C:\\");
25-
REQUIRE(fs::getUpDir("C:\\") == "C:\\");
21+
REQUIRE(u::fs::isRootDir("\\") == true);
22+
REQUIRE(u::fs::isRootDir("C:\\path\\to\\something") == false);
23+
REQUIRE(u::fs::getUpDir("C:\\path\\to\\something") == "C:\\path\\to");
24+
REQUIRE(u::fs::getUpDir("C:\\path") == "C:\\");
25+
REQUIRE(u::fs::getUpDir("C:\\") == "C:\\");
2626
#else
27-
REQUIRE(fs::isRootDir("/") == true);
28-
REQUIRE(fs::isRootDir("/path/to/something") == false);
29-
REQUIRE(fs::getUpDir("/path/to/something") == "/path/to");
30-
REQUIRE(fs::getUpDir("/path") == "/");
31-
REQUIRE(fs::getUpDir("/") == "/");
27+
REQUIRE(u::fs::isRootDir("/") == true);
28+
REQUIRE(u::fs::isRootDir("/path/to/something") == false);
29+
REQUIRE(u::fs::getUpDir("/path/to/something") == "/path/to");
30+
REQUIRE(u::fs::getUpDir("/path") == "/");
31+
REQUIRE(u::fs::getUpDir("/") == "/");
3232
#endif
3333
}
3434

3535
TEST_CASE("u::string")
3636
{
37-
using namespace giada::u;
37+
using namespace giada;
3838

39-
REQUIRE(string::replace("Giada is cool", "cool", "hot") == "Giada is hot");
40-
REQUIRE(string::trim(" Giada is cool ") == "Giada is cool");
41-
REQUIRE(string::format("I see %d men with %s hats", 5, "strange") == "I see 5 men with strange hats");
39+
REQUIRE(u::string::replace("Giada is cool", "cool", "hot") == "Giada is hot");
40+
REQUIRE(u::string::trim(" Giada is cool ") == "Giada is cool");
41+
REQUIRE(u::string::format("I see %d men with %s hats", 5, "strange") == "I see 5 men with strange hats");
4242

43-
std::vector<std::string> v = string::split("Giada is cool", " ");
43+
std::vector<std::string> v = u::string::split("Giada is cool", " ");
4444
REQUIRE(v.size() == 3);
4545
REQUIRE(v.at(0) == "Giada");
4646
REQUIRE(v.at(1) == "is");
@@ -49,13 +49,13 @@ TEST_CASE("u::string")
4949

5050
TEST_CASE("::math")
5151
{
52-
using namespace giada::u;
52+
using namespace giada;
5353

54-
REQUIRE(math::map(0.0f, 0.0f, 30.0f, 0.0f, 1.0f) == 0.0f);
55-
REQUIRE(math::map(30.0f, 0.0f, 30.0f, 0.0f, 1.0f) == 1.0f);
56-
REQUIRE(math::map(15.0f, 0.0f, 30.0f, 0.0f, 1.0f) == Approx(0.5f));
54+
REQUIRE(u::math::map(0.0f, 0.0f, 30.0f, 0.0f, 1.0f) == 0.0f);
55+
REQUIRE(u::math::map(30.0f, 0.0f, 30.0f, 0.0f, 1.0f) == 1.0f);
56+
REQUIRE(u::math::map(15.0f, 0.0f, 30.0f, 0.0f, 1.0f) == Approx(0.5f));
5757

58-
REQUIRE(math::map(0.0f, 30.0f, 1.0f) == 0.0f);
59-
REQUIRE(math::map(30.0f, 30.0f, 1.0f) == 1.0f);
60-
REQUIRE(math::map(15.0f, 30.0f, 1.0f) == Approx(0.5f));
58+
REQUIRE(u::math::map(0.0f, 30.0f, 1.0f) == 0.0f);
59+
REQUIRE(u::math::map(30.0f, 30.0f, 1.0f) == 1.0f);
60+
REQUIRE(u::math::map(15.0f, 30.0f, 1.0f) == Approx(0.5f));
6161
}

0 commit comments

Comments
 (0)