Big f***ing cleanup part 1
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include <Nazara/Core/Clock.hpp>
|
||||
#include <Nazara/Core/Thread.hpp>
|
||||
#include <Catch/catch.hpp>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
SCENARIO("Clock", "[CORE][CLOCK]")
|
||||
{
|
||||
@@ -25,7 +26,7 @@ SCENARIO("Clock", "[CORE][CLOCK]")
|
||||
|
||||
THEN("Time must not be the initialTime")
|
||||
{
|
||||
Nz::Thread::Sleep(1);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
Nz::UInt64 microSeconds = clock.GetMicroseconds();
|
||||
CHECK(microSeconds != initialTime);
|
||||
CHECK(microSeconds / 1000 <= clock.GetMilliseconds());
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
#include <Nazara/Core/Directory.hpp>
|
||||
#include <Catch/catch.hpp>
|
||||
|
||||
SCENARIO("Directory", "[CORE][DIRECTORY]")
|
||||
{
|
||||
GIVEN("The current directory")
|
||||
{
|
||||
Nz::Directory currentDirectory(Nz::Directory::GetCurrent());
|
||||
CHECK(currentDirectory.Exists());
|
||||
currentDirectory.Open();
|
||||
|
||||
WHEN("We create a new directory Test Directory")
|
||||
{
|
||||
Nz::Directory::Create("Test Directory");
|
||||
|
||||
THEN("A new directory has been created")
|
||||
{
|
||||
CHECK(Nz::Directory::Exists(currentDirectory.GetCurrent() + "/Test Directory"));
|
||||
CHECK(currentDirectory.IsOpen());
|
||||
}
|
||||
}
|
||||
|
||||
AND_WHEN("We delete it")
|
||||
{
|
||||
Nz::Directory::Remove(currentDirectory.GetCurrent() + "/Test Directory", true);
|
||||
|
||||
THEN("It doesn't exist anymore")
|
||||
{
|
||||
CHECK(!Nz::Directory::Exists(currentDirectory.GetCurrent() + "/Test Directory"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include <Nazara/Core/File.hpp>
|
||||
#include <Nazara/Core/Directory.hpp>
|
||||
#include <Catch/catch.hpp>
|
||||
|
||||
SCENARIO("File", "[CORE][FILE]")
|
||||
@@ -9,7 +8,7 @@ SCENARIO("File", "[CORE][FILE]")
|
||||
WHEN("We create a new file")
|
||||
{
|
||||
Nz::File file("Test File.txt", Nz::OpenMode_ReadWrite);
|
||||
REQUIRE(file.GetDirectory() == Nz::Directory::GetCurrent() + NAZARA_DIRECTORY_SEPARATOR);
|
||||
REQUIRE(file.GetDirectory() == std::filesystem::current_path());
|
||||
REQUIRE(file.IsOpen());
|
||||
|
||||
THEN("We are allowed to write 3 times 'Test String'")
|
||||
@@ -53,18 +52,18 @@ SCENARIO("File", "[CORE][FILE]")
|
||||
|
||||
WHEN("We delete this file")
|
||||
{
|
||||
Nz::File::Delete("Test File.txt");
|
||||
std::filesystem::remove("Test File.txt");
|
||||
|
||||
THEN("It doesn't exist anymore")
|
||||
{
|
||||
CHECK(!Nz::File::Exists("Test File.txt"));
|
||||
CHECK(!std::filesystem::exists("Test File.txt"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GIVEN("The test file")
|
||||
{
|
||||
REQUIRE(Nz::File::Exists("resources/Engine/Core/FileTest.txt"));
|
||||
REQUIRE(std::filesystem::exists("resources/Engine/Core/FileTest.txt"));
|
||||
|
||||
Nz::File fileTest("resources/Engine/Core/FileTest.txt", Nz::OpenMode_ReadOnly | Nz::OpenMode_Text);
|
||||
|
||||
@@ -79,20 +78,4 @@ SCENARIO("File", "[CORE][FILE]")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 = Nz::File::NormalizePath("/resources/Spaceship/spaceship.mtl");
|
||||
REQUIRE(Nz::File::AbsolutePath(containingDot).EndsWith(containingNoMoreDot));
|
||||
REQUIRE(Nz::File::AbsolutePath(containingDoubleDot).EndsWith(containingNoMoreDot));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user