Big f***ing cleanup part 1
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
#include <Nazara/Audio/Audio.hpp>
|
||||
#include <Nazara/Audio/Music.hpp>
|
||||
#include <Catch/catch.hpp>
|
||||
|
||||
#include <Nazara/Audio/Audio.hpp>
|
||||
#include <Nazara/Core/Thread.hpp>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
SCENARIO("Music", "[AUDIO][MUSIC]")
|
||||
{
|
||||
@@ -32,9 +32,9 @@ SCENARIO("Music", "[AUDIO][MUSIC]")
|
||||
Nz::Audio::SetGlobalVolume(0.f);
|
||||
|
||||
music.Play();
|
||||
Nz::Thread::Sleep(1000);
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
REQUIRE(music.GetPlayingOffset() >= 950);
|
||||
Nz::Thread::Sleep(200);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(200));
|
||||
REQUIRE(music.GetPlayingOffset() <= 1300);
|
||||
music.Pause();
|
||||
REQUIRE(music.GetStatus() == Nz::SoundStatus_Paused);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include <Nazara/Audio/Audio.hpp>
|
||||
#include <Nazara/Audio/Sound.hpp>
|
||||
#include <Catch/catch.hpp>
|
||||
|
||||
#include <Nazara/Audio/Audio.hpp>
|
||||
#include <Nazara/Core/Thread.hpp>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
SCENARIO("Sound", "[AUDIO][SOUND]")
|
||||
{
|
||||
@@ -26,10 +26,10 @@ SCENARIO("Sound", "[AUDIO][SOUND]")
|
||||
{
|
||||
Nz::Audio::SetGlobalVolume(0.f);
|
||||
|
||||
sound.Play();
|
||||
Nz::Thread::Sleep(1000);
|
||||
sound.Play();
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
REQUIRE(sound.GetPlayingOffset() >= 950);
|
||||
Nz::Thread::Sleep(200);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(200));
|
||||
REQUIRE(sound.GetPlayingOffset() <= 1300);
|
||||
sound.Pause();
|
||||
REQUIRE(sound.GetStatus() == Nz::SoundStatus_Paused);
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#include <Nazara/Audio/Sound.hpp>
|
||||
#include <Catch/catch.hpp>
|
||||
|
||||
#include <Nazara/Core/Thread.hpp>
|
||||
|
||||
SCENARIO("SoundEmitter", "[AUDIO][SOUNDEMITTER]")
|
||||
{
|
||||
GIVEN("A sound emitter")
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#include <Nazara/Core/Thread.hpp>
|
||||
#include <Nazara/Math/Vector3.hpp>
|
||||
#include <Nazara/Network/NetPacket.hpp>
|
||||
#include <Nazara/Network/TcpClient.hpp>
|
||||
#include <Nazara/Network/TcpServer.hpp>
|
||||
#include <Catch/catch.hpp>
|
||||
#include <chrono>
|
||||
#include <random>
|
||||
#include <thread>
|
||||
|
||||
SCENARIO("TCP", "[NETWORK][TCP]")
|
||||
{
|
||||
@@ -29,7 +30,7 @@ SCENARIO("TCP", "[NETWORK][TCP]")
|
||||
Nz::IpAddress clientIP = client.GetRemoteAddress();
|
||||
CHECK(clientIP.IsValid());
|
||||
|
||||
Nz::Thread::Sleep(100);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
|
||||
Nz::TcpClient serverToClient;
|
||||
REQUIRE(server.AcceptClient(&serverToClient));
|
||||
|
||||
Reference in New Issue
Block a user