Skip to content

Commit

Permalink
[Tests] Added tags to test cases
Browse files Browse the repository at this point in the history
- This will allow running only tests of certain categories
  • Loading branch information
Razakhel committed Feb 22, 2024
1 parent 41801db commit a963f48
Show file tree
Hide file tree
Showing 70 changed files with 305 additions and 309 deletions.
2 changes: 1 addition & 1 deletion tests/src/RaZ/Animation/Skeleton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

using namespace Raz::Literals;

TEST_CASE("Skeleton rotation chain") {
TEST_CASE("Skeleton rotation chain", "[animation]") {
// Creating a skeleton so that the following configuration is reproduced:
//
// / child11
Expand Down
8 changes: 4 additions & 4 deletions tests/src/RaZ/Audio/AudioSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

using namespace Raz::Literals;

TEST_CASE("AudioSystem accepted components") {
TEST_CASE("AudioSystem accepted components", "[audio]") {
Raz::World world(2);

auto& audio = world.addSystem<Raz::AudioSystem>();
Expand All @@ -25,7 +25,7 @@ TEST_CASE("AudioSystem accepted components") {
CHECK(audio.containsEntity(listener));
}

TEST_CASE("AudioSystem initialization") {
TEST_CASE("AudioSystem initialization", "[audio]") {
{
const Raz::AudioSystem audio;
CHECK_FALSE(audio.recoverCurrentDevice().empty()); // If it is actually empty, audio features won't be available on this platform
Expand All @@ -37,7 +37,7 @@ TEST_CASE("AudioSystem initialization") {
}
}

TEST_CASE("AudioSystem devices recovery") {
TEST_CASE("AudioSystem devices recovery", "[audio]") {
const std::vector<std::string> devices = Raz::AudioSystem::recoverDevices();

const Raz::AudioSystem audio;
Expand All @@ -46,7 +46,7 @@ TEST_CASE("AudioSystem devices recovery") {
CHECK(std::find(devices.cbegin(), devices.cend(), currentDevice) != devices.cend());
}

TEST_CASE("AudioSystem attributes update") {
TEST_CASE("AudioSystem attributes update", "[audio]") {
Raz::World world;

world.addSystem<Raz::AudioSystem>();
Expand Down
2 changes: 1 addition & 1 deletion tests/src/RaZ/Audio/Listener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "RaZ/Audio/Listener.hpp"
#include "RaZ/Math/Vector.hpp"

TEST_CASE("Listener data") {
TEST_CASE("Listener data", "[audio]") {
const Raz::AudioSystem audio; // Initializing the audio device & context, needed before all audio action

Raz::Listener listener;
Expand Down
6 changes: 3 additions & 3 deletions tests/src/RaZ/Audio/Sound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
#include "RaZ/Math/Vector.hpp"
#include "RaZ/Utils/Threading.hpp"

TEST_CASE("Sound initialization") {
TEST_CASE("Sound initialization", "[audio]") {
const Raz::AudioSystem audio; // Initializing the audio device & context, needed before all audio action

const Raz::Sound sound;
CHECK(sound.getBufferIndex() != std::numeric_limits<unsigned int>::max());
}

TEST_CASE("Sound move") {
TEST_CASE("Sound move", "[audio]") {
const Raz::AudioSystem audio;

Raz::Sound sound = Raz::WavFormat::load(RAZ_TESTS_ROOT "assets/sounds/notif_ting.wav");
Expand Down Expand Up @@ -86,7 +86,7 @@ TEST_CASE("Sound move") {
CHECK(movedSoundCtor.recoverVelocity() == movedSoundOpVelocity);
}

TEST_CASE("Sound operations") {
TEST_CASE("Sound operations", "[audio]") {
const Raz::AudioSystem audio;

const Raz::Sound sound = Raz::WavFormat::load(RAZ_TESTS_ROOT "assets/sounds/notif_ting.wav");
Expand Down
2 changes: 1 addition & 1 deletion tests/src/RaZ/Component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "RaZ/Render/Camera.hpp"
#include "RaZ/Render/Light.hpp"

TEST_CASE("Components IDs") {
TEST_CASE("Components IDs", "[core]") {
// With the CRTP, every component gets a different constant ID with the first call
// The ID is incremented with every distinct component call
// No matter how many times one component is checked, it will always have the same ID
Expand Down
8 changes: 4 additions & 4 deletions tests/src/RaZ/Data/Bitset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const Raz::Bitset alternated2({ false, true, false, true, false, true }); // 0 1

} // namespace

TEST_CASE("Bitset basic") {
TEST_CASE("Bitset basic", "[data]") {
CHECK(fullZeros.isEmpty());
CHECK_FALSE(fullOnes.isEmpty());

Expand All @@ -41,7 +41,7 @@ TEST_CASE("Bitset basic") {
CHECK(copy.isEmpty());
}

TEST_CASE("Bitset manipulations") {
TEST_CASE("Bitset manipulations", "[data]") {
CHECK((alternated1 & alternated1) == alternated1);
CHECK((alternated2 & alternated2) == alternated2);

Expand Down Expand Up @@ -81,7 +81,7 @@ TEST_CASE("Bitset manipulations") {
CHECK(~alternated2 == alternated1);
}

TEST_CASE("Bitset shifts") {
TEST_CASE("Bitset shifts", "[data]") {
CHECK((alternated1 << 1) == Raz::Bitset({ true, false, true, false, true, false, false })); // 1 0 1 0 1 0 0
CHECK((alternated1 >> 1) == Raz::Bitset({ true, false, true, false, true })); // 1 0 1 0 1

Expand All @@ -94,7 +94,7 @@ TEST_CASE("Bitset shifts") {
CHECK(shiftTest == alternated1);
}

TEST_CASE("Bitset printing") {
TEST_CASE("Bitset printing", "[data]") {
std::stringstream stream;

stream << fullOnes;
Expand Down
3 changes: 1 addition & 2 deletions tests/src/RaZ/Data/BvhFormat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

#include "RaZ/Animation/Skeleton.hpp"
#include "RaZ/Data/BvhFormat.hpp"
#include "RaZ/Math/Vector.hpp"
#include "RaZ/Utils/FilePath.hpp"

TEST_CASE("BvhFormat load") {
TEST_CASE("BvhFormat load", "[data]") {
const Raz::Skeleton skeleton = Raz::BvhFormat::load(RAZ_TESTS_ROOT "assets/animation/ànîm.bvh");

// child1 (10, 10, 10)
Expand Down
8 changes: 4 additions & 4 deletions tests/src/RaZ/Data/BvhSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "RaZ/Data/BvhSystem.hpp"
#include "RaZ/Data/Mesh.hpp"

TEST_CASE("BvhSystem accepted components") {
TEST_CASE("BvhSystem accepted components", "[data]") {
Raz::World world(1);

auto& bvh = world.addSystem<Raz::BvhSystem>();
Expand All @@ -17,7 +17,7 @@ TEST_CASE("BvhSystem accepted components") {
CHECK(bvh.containsEntity(mesh));
}

TEST_CASE("BvhSystem basic") {
TEST_CASE("BvhSystem basic", "[data]") {
Raz::BvhSystem bvh;
CHECK(bvh.getRootNode().isLeaf());
CHECK(bvh.getRootNode().getBoundingBox() == Raz::AABB(Raz::Vec3f(0.f), Raz::Vec3f(0.f)));
Expand All @@ -31,7 +31,7 @@ TEST_CASE("BvhSystem basic") {
CHECK_FALSE(bvh.query(Raz::Ray(Raz::Vec3f(0.f), Raz::Axis::Z)));
}

TEST_CASE("BvhSystem build") {
TEST_CASE("BvhSystem build", "[data]") {
Raz::World world(4);

auto& bvh = world.addSystem<Raz::BvhSystem>();
Expand Down Expand Up @@ -173,7 +173,7 @@ TEST_CASE("BvhSystem build") {
}
}

TEST_CASE("BvhSystem query") {
TEST_CASE("BvhSystem query", "[data]") {
// See: https://www.geogebra.org/m/tabbfjfd

Raz::World world(3);
Expand Down
6 changes: 3 additions & 3 deletions tests/src/RaZ/Data/Color.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "RaZ/Data/Color.hpp"

TEST_CASE("Color components") {
TEST_CASE("Color components", "[data]") {
Raz::Color color;
CHECK(color.red() == 0.f);
CHECK(color.green() == 0.f);
Expand All @@ -16,7 +16,7 @@ TEST_CASE("Color components") {
CHECK(color.blue() == 3.f);
}

TEST_CASE("Color float/byte conversion") {
TEST_CASE("Color float/byte conversion", "[data]") {
CHECK(Raz::Vec3b(Raz::Color(0.f, 0.f, 0.f)).strictlyEquals(Raz::Vec3b(0, 0, 0)));
CHECK(Raz::Vec3f(Raz::Color(0, 0, 0)).strictlyEquals(Raz::Vec3f(0.f, 0.f, 0.f)));

Expand All @@ -27,7 +27,7 @@ TEST_CASE("Color float/byte conversion") {
CHECK(Raz::Vec3f(Raz::Color(255, 255, 255)).strictlyEquals(Raz::Vec3f(1.f, 1.f, 1.f)));
}

TEST_CASE("Color hexadecimal") {
TEST_CASE("Color hexadecimal", "[data]") {
CHECK(Raz::Color(0x000000) == Raz::Color(0.f, 0.f, 0.f));
CHECK(Raz::Color(0x808080) == Raz::Color(0.5019608f, 0.5019608f, 0.5019608f));
CHECK(Raz::Color(0x00FFFF) == Raz::Color(0.f, 1.f, 1.f));
Expand Down
2 changes: 1 addition & 1 deletion tests/src/RaZ/Data/FbxFormat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "RaZ/Render/MeshRenderer.hpp"
#include "RaZ/Utils/FilePath.hpp"

TEST_CASE("FbxFormat load basic") {
TEST_CASE("FbxFormat load basic", "[data]") {
const auto [mesh, meshRenderer] = Raz::FbxFormat::load(RAZ_TESTS_ROOT "../assets/meshes/shaderBall.fbx");

CHECK(mesh.getSubmeshes().size() == 7);
Expand Down
6 changes: 3 additions & 3 deletions tests/src/RaZ/Data/GltfFormat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "RaZ/Data/Mesh.hpp"
#include "RaZ/Render/MeshRenderer.hpp"

TEST_CASE("GltfFormat load glTF") {
TEST_CASE("GltfFormat load glTF", "[data]") {
const auto [mesh, meshRenderer] = Raz::GltfFormat::load(RAZ_TESTS_ROOT "assets/meshes/çûbè.gltf");

REQUIRE(mesh.getSubmeshes().size() == 3);
Expand Down Expand Up @@ -235,7 +235,7 @@ TEST_CASE("GltfFormat load glTF") {
}
}

TEST_CASE("GltfFormat load GLB simple") {
TEST_CASE("GltfFormat load GLB simple", "[data]") {
const auto [mesh, meshRenderer] = Raz::GltfFormat::load(RAZ_TESTS_ROOT "assets/meshes/ßøӾ.glb");

REQUIRE(mesh.getSubmeshes().size() == 1);
Expand Down Expand Up @@ -263,7 +263,7 @@ TEST_CASE("GltfFormat load GLB simple") {
CHECK(matProgram.getAttribute<float>(Raz::MaterialAttribute::Roughness) == 1.f);
}

TEST_CASE("GltfFormat load GLB textured") {
TEST_CASE("GltfFormat load GLB textured", "[data]") {
const auto [mesh, meshRenderer] = Raz::GltfFormat::load(RAZ_TESTS_ROOT "assets/meshes/ßøӾTêxtùrëd.glb");

REQUIRE(mesh.getSubmeshes().size() == 1);
Expand Down
4 changes: 2 additions & 2 deletions tests/src/RaZ/Data/Graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class TestNode final : public Raz::GraphNode<TestNode> {};

} // namespace

TEST_CASE("Graph linking test") {
TEST_CASE("Graph linking test", "[data]") {
Raz::Graph<TestNode> graph(5);

TestNode& root = graph.addNode();
Expand Down Expand Up @@ -148,7 +148,7 @@ TEST_CASE("Graph linking test") {
CHECK_THROWS(graph.removeNode(testNode));
}

TEST_CASE("Graph extremities test") {
TEST_CASE("Graph extremities test", "[data]") {
Raz::Graph<TestNode> graph(5);

TestNode& root = graph.addNode();
Expand Down
10 changes: 5 additions & 5 deletions tests/src/RaZ/Data/Image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include <numeric>

TEST_CASE("Image colorspace/data type creation") {
TEST_CASE("Image colorspace/data type creation", "[data]") {
const Raz::Image imgByte(Raz::ImageColorspace::RGBA);
CHECK(imgByte.getWidth() == 0);
CHECK(imgByte.getHeight() == 0);
Expand All @@ -23,7 +23,7 @@ TEST_CASE("Image colorspace/data type creation") {
CHECK(imgFloat.isEmpty());
}

TEST_CASE("Image dimensions creation") {
TEST_CASE("Image dimensions creation", "[data]") {
const Raz::Image imgEmpty(0, 0, Raz::ImageColorspace::RGBA);
CHECK(imgEmpty.getWidth() == 0);
CHECK(imgEmpty.getHeight() == 0);
Expand All @@ -41,7 +41,7 @@ TEST_CASE("Image dimensions creation") {
CHECK_FALSE(imgSmall.isEmpty());
}

TEST_CASE("Image value access") {
TEST_CASE("Image value access", "[data]") {
{
Raz::Image imgByte(1, 1, Raz::ImageColorspace::RGB, Raz::ImageDataType::BYTE);
REQUIRE(imgByte.getChannelCount() == 3);
Expand Down Expand Up @@ -100,7 +100,7 @@ TEST_CASE("Image value access") {
}
}

TEST_CASE("Image equality") {
TEST_CASE("Image equality", "[data]") {
const Raz::Image imgB1(1, 1, Raz::ImageColorspace::GRAY, Raz::ImageDataType::BYTE);
const Raz::Image imgB2(2, 2, Raz::ImageColorspace::GRAY, Raz::ImageDataType::BYTE);
const Raz::Image imgB3(2, 2, Raz::ImageColorspace::GRAY_ALPHA, Raz::ImageDataType::BYTE);
Expand Down Expand Up @@ -147,7 +147,7 @@ TEST_CASE("Image equality") {
}
}

TEST_CASE("Image copy/move") {
TEST_CASE("Image copy/move", "[data]") {
Raz::Image imgBase(3, 3, Raz::ImageColorspace::RGB);

auto* imgData = static_cast<uint8_t*>(imgBase.getDataPtr());
Expand Down
14 changes: 7 additions & 7 deletions tests/src/RaZ/Data/ImageFormat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,30 +81,30 @@ void checkImage(const Raz::FilePath& filePath, uint8_t expectedChannelCount, con

} // namespace

TEST_CASE("ImageFormat load BMP") {
TEST_CASE("ImageFormat load BMP", "[data]") {
checkImage(RAZ_TESTS_ROOT "assets/images/dëfàùltTêst.bmp", 4, rawValues);
}

TEST_CASE("ImageFormat load GIF") {
TEST_CASE("ImageFormat load GIF", "[data]") {
checkImage(RAZ_TESTS_ROOT "assets/images/dëfàùltTêst.gif", 4, rawValues);
}

TEST_CASE("ImageFormat load JPEG") {
TEST_CASE("ImageFormat load JPEG", "[data]") {
checkImage(RAZ_TESTS_ROOT "assets/images/dëfàùltTêst.jpg", 3, jpegValues);
}

TEST_CASE("ImageFormat load PGM") {
TEST_CASE("ImageFormat load PGM", "[data]") {
checkImage(RAZ_TESTS_ROOT "assets/images/dëfàùltTêst.pgm", 1, rawValues);
}

TEST_CASE("ImageFormat load PNG") {
TEST_CASE("ImageFormat load PNG", "[data]") {
checkImage(RAZ_TESTS_ROOT "assets/images/dëfàùltTêst.png", 4, rawValues);
}

TEST_CASE("ImageFormat load PPM") {
TEST_CASE("ImageFormat load PPM", "[data]") {
checkImage(RAZ_TESTS_ROOT "assets/images/dëfàùltTêst.ppm", 3, rawValues);
}

TEST_CASE("ImageFormat load TGA") {
TEST_CASE("ImageFormat load TGA", "[data]") {
checkImage(RAZ_TESTS_ROOT "assets/images/dëfàùltTêst.tga", 3, rawValues);
}
Loading

0 comments on commit a963f48

Please sign in to comment.