Bug fix -> String with one char + Directory and File on linux

Former-commit-id: 7f9b6c44197c3cc67145eb0a2d421a2e1de45a84
This commit is contained in:
Gawaboumga
2016-04-04 10:36:13 +02:00
parent 265e1c0fbd
commit 91f2bee487
8 changed files with 60 additions and 459 deletions

View File

@@ -9,7 +9,7 @@ SCENARIO("File", "[CORE][FILE]")
{
Nz::File file("Test File.txt", Nz::OpenMode_ReadWrite);
REQUIRE(file.GetDirectory() == Nz::Directory::GetCurrent() + NAZARA_DIRECTORY_SEPARATOR);
CHECK(file.IsOpen());
REQUIRE(file.IsOpen());
THEN("We are allowed to write 3 times 'Test String'")
{
@@ -50,4 +50,38 @@ SCENARIO("File", "[CORE][FILE]")
}
}
}
GIVEN("The test file")
{
REQUIRE(Nz::File::Exists("resources/Engine/Core/FileTest.txt"));
Nz::File fileTest("resources/Engine/Core/FileTest.txt", Nz::OpenMode_ReadOnly | Nz::OpenMode_Text);
WHEN("We read the first line of the file")
{
REQUIRE(fileTest.IsOpen());
Nz::String content = fileTest.ReadLine();
THEN("The content must be 'Test'")
{
REQUIRE(content == "Test");
}
}
}
GIVEN("Nothing")
{
WHEN("We get the absolute path of something containing relative path")
{
Nz::String containingDot = "/resources/Spaceship/./spaceship.mtl";
Nz::String containingDoubleDot = "/resources/Spaceship/../Spaceship/spaceship.mtl";
THEN("The relative positioning should disappear")
{
Nz::String containingNoMoreDot = "/resources/Spaceship/spaceship.mtl";
REQUIRE(Nz::File::AbsolutePath(containingDot) == containingNoMoreDot);
REQUIRE(Nz::File::AbsolutePath(containingDoubleDot) == containingNoMoreDot);
}
}
}
}

View File

@@ -82,6 +82,21 @@ SCENARIO("String", "[CORE][STRING]")
}
}
GIVEN("One character string")
{
Nz::String characterString;
WHEN("We set the string to one character")
{
characterString.Set('/');
THEN("The string must contain it")
{
REQUIRE(characterString == '/');
}
}
}
/* TODO
GIVEN("One unicode string")
{