5
5
6
6
TEST_CASE (" u::fs" )
7
7
{
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" );
20
20
#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:\\ " );
26
26
#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 (" /" ) == " /" );
32
32
#endif
33
33
}
34
34
35
35
TEST_CASE (" u::string" )
36
36
{
37
- using namespace giada ::u ;
37
+ using namespace giada ;
38
38
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" );
42
42
43
- std::vector<std::string> v = string::split (" Giada is cool" , " " );
43
+ std::vector<std::string> v = u:: string::split (" Giada is cool" , " " );
44
44
REQUIRE (v.size () == 3 );
45
45
REQUIRE (v.at (0 ) == " Giada" );
46
46
REQUIRE (v.at (1 ) == " is" );
@@ -49,13 +49,13 @@ TEST_CASE("u::string")
49
49
50
50
TEST_CASE (" ::math" )
51
51
{
52
- using namespace giada ::u ;
52
+ using namespace giada ;
53
53
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 ));
57
57
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 ));
61
61
}
0 commit comments