Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hotstreams committed Aug 30, 2024
1 parent 10defad commit be7b141
Show file tree
Hide file tree
Showing 16 changed files with 143 additions and 143 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: build
run: |
mkdir build
cmake -DBUILD_SAMPLES=OFF -DBUILD_TESTS=OFF -DOPENGL_SHADER_OUTPUT=ON -S . -B build
cmake -DBUILD_SAMPLES=OFF -DBUILD_TESTS=ON -DOPENGL_SHADER_OUTPUT=ON -S . -B build
cd build
make
- name: test
Expand Down
8 changes: 4 additions & 4 deletions tests/limitless/core/context_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ using namespace Limitless;
using namespace LimitlessTest;

TEST_CASE("Context constructor") {
Context context = {"Title", {1024, 1024}, {{WindowHint::Visible, false}}};
Context context = {"Title", {1024, 1024}, nullptr, {{WindowHint::Hint::Visible, false}}};

REQUIRE(static_cast<GLFWwindow*>(context) != nullptr);

check_opengl_state();
}

TEST_CASE("Context move constructor") {
Context context1 = {"Title1", {1024, 1024}, {{WindowHint::Visible, false}}};
Context context1 = {"Title1", {1024, 1024}, nullptr , {{WindowHint::Hint::Visible, false}}};
Context context2 = {std::move(context1)};

REQUIRE(context2.getSize() == glm::uvec2{1024, 1024});
Expand All @@ -28,8 +28,8 @@ TEST_CASE("Context move constructor") {
}

TEST_CASE("Context move operator") {
Context context1 = {"Title1", {1024, 1024}, {{WindowHint::Visible, false}}};
Context context2 = {"Title2", {512, 512}, {{WindowHint::Visible, false}}};
Context context1 = {"Title1", {1024, 1024}, nullptr , {{WindowHint::Hint::Visible, false}}};
Context context2 = {"Title2", {512, 512}, nullptr , {{WindowHint::Hint::Visible, false}}};

context2 = {std::move(context1)};

Expand Down
8 changes: 4 additions & 4 deletions tests/limitless/core/shader_compiler_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ using namespace Limitless;
using namespace LimitlessTest;

TEST_CASE("Manual shader program compilation") {
Context context = Context{"Title", {512, 512}, {{WindowHint::Visible, false}}};
Context context = {"Title", {512, 512}, nullptr, {{WindowHint::Hint::Visible, false}}};

{
RendererSettings settings;
Expand All @@ -27,7 +27,7 @@ TEST_CASE("Manual shader program compilation") {
}

TEST_CASE("Auto shader program compilation") {
Context context = Context{"Title", {512, 512}, {{WindowHint::Visible, false}}};
Context context = {"Title", {512, 512}, nullptr, {{WindowHint::Hint::Visible, false}}};

{
RendererSettings settings;
Expand All @@ -43,7 +43,7 @@ TEST_CASE("Auto shader program compilation") {
}

TEST_CASE("Auto shader program compilation with specified actions") {
Context context = Context{"Title", {512, 512}, {{WindowHint::Visible, false}}};
Context context = {"Title", {512, 512}, nullptr, {{WindowHint::Hint::Visible, false}}};

{
RendererSettings settings;
Expand All @@ -63,7 +63,7 @@ TEST_CASE("Auto shader program compilation with specified actions") {
}

TEST_CASE("Throw on not existing path") {
Context context = Context{"Title", {512, 512}, {{WindowHint::Visible, false}}};
Context context = {"Title", {512, 512}, nullptr, {{WindowHint::Hint::Visible, false}}};

{
RendererSettings settings;
Expand Down
18 changes: 9 additions & 9 deletions tests/limitless/core/shader_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ using namespace Limitless;
using namespace LimitlessTest;

TEST_CASE("Loads simple shader without error") {
Context context = Context{"Title", {512, 512}, {{WindowHint::Visible, false}}};
Context context = {"Title", {512, 512}, nullptr, {{WindowHint::Hint::Visible, false}}};

{
Shader shader = Shader{"../../tests/limitless/assets/shader1.vert", Shader::Type::Vertex};
Expand All @@ -22,7 +22,7 @@ TEST_CASE("Loads simple shader without error") {
}

TEST_CASE("Replaces version in shader") {
Context context = Context{"Title", {512, 512}, {{WindowHint::Visible, false}}};
Context context = {"Title", {512, 512}, nullptr, {{WindowHint::Hint::Visible, false}}};

{
Shader shader = Shader{"../../tests/limitless/assets/shader2.vert", Shader::Type::Vertex};
Expand All @@ -36,7 +36,7 @@ TEST_CASE("Replaces version in shader") {
}

TEST_CASE("Resolves include in shader") {
Context context = Context{"Title", {512, 512}, {{WindowHint::Visible, false}}};
Context context = {"Title", {512, 512}, nullptr, {{WindowHint::Hint::Visible, false}}};

{
Shader shader = Shader{"../../tests/limitless/assets/shader4.vert", Shader::Type::Vertex};
Expand All @@ -50,7 +50,7 @@ TEST_CASE("Resolves include in shader") {
}

TEST_CASE("Replaces key-line in shader") {
Context context = Context{"Title", {512, 512}, {{WindowHint::Visible, false}}};
Context context = {"Title", {512, 512}, nullptr, {{WindowHint::Hint::Visible, false}}};

{
Shader shader = Shader{"../../tests/limitless/assets/shader6.vert", Shader::Type::Vertex};
Expand All @@ -66,7 +66,7 @@ TEST_CASE("Replaces key-line in shader") {
}

TEST_CASE("Throw file not found") {
Context context = Context{"Title", {512, 512}, {{WindowHint::Visible, false}}};
Context context = {"Title", {512, 512}, nullptr, {{WindowHint::Hint::Visible, false}}};

{
REQUIRE_THROWS_AS(Shader("../../tests/limitless/assets/3228.vert", Shader::Type::Vertex), shader_file_not_found);
Expand All @@ -78,7 +78,7 @@ TEST_CASE("Throw file not found") {
}

TEST_CASE("Throw include not found") {
Context context = Context{"Title", {512, 512}, {{WindowHint::Visible, false}}};
Context context = {"Title", {512, 512}, nullptr, {{WindowHint::Hint::Visible, false}}};

{
REQUIRE_THROWS_AS(Shader("../../tests/limitless/assets/shader7.vert", Shader::Type::Vertex), shader_include_not_found);
Expand All @@ -90,7 +90,7 @@ TEST_CASE("Throw include not found") {
}

TEST_CASE("Throw shader_compilation_error") {
Context context = Context{"Title", {512, 512}, {{WindowHint::Visible, false}}};
Context context = {"Title", {512, 512}, nullptr, {{WindowHint::Hint::Visible, false}}};

{
Shader shader = Shader{"../../tests/limitless/assets/shader8.vert", Shader::Type::Vertex};
Expand All @@ -103,7 +103,7 @@ TEST_CASE("Throw shader_compilation_error") {
}

TEST_CASE("Compiles simple shader") {
Context context = Context{"Title", {512, 512}, {{WindowHint::Visible, false}}};
Context context = {"Title", {512, 512}, nullptr, {{WindowHint::Hint::Visible, false}}};

{
Shader shader = Shader{"../../tests/limitless/assets/shader1.vert", Shader::Type::Vertex};
Expand All @@ -117,7 +117,7 @@ TEST_CASE("Compiles simple shader") {
}

TEST_CASE("Shader move ctor") {
Context context = Context{"Title", {512, 512}, {{WindowHint::Visible, false}}};
Context context = {"Title", {512, 512}, nullptr, {{WindowHint::Hint::Visible, false}}};

{
Shader shader1 = Shader{"../../tests/limitless/assets/shader1.vert", Shader::Type::Vertex};
Expand Down
34 changes: 17 additions & 17 deletions tests/limitless/core/state_buffer_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class BufferChecker {
};

TEST_CASE("Buffer mutable constructor") {
Context context = {"Title", {512, 512}, {{WindowHint::Visible, false}}};
Context context = {"Title", {512, 512}, nullptr, {{WindowHint::Hint::Visible, false}}};

{
StateBuffer buffer = StateBuffer(Buffer::Type::Array, 1024, nullptr, Buffer::Usage::StaticDraw, Buffer::MutableAccess::None);
Expand All @@ -81,7 +81,7 @@ TEST_CASE("Buffer mutable constructor") {
}

TEST_CASE("Buffer immutable constructor") {
Context context = {"Title", {512, 512}, {{WindowHint::Visible, false}}};
Context context = {"Title", {512, 512}, nullptr, {{WindowHint::Hint::Visible, false}}};

{
StateBuffer buffer = StateBuffer(Buffer::Type::Array, 1024, nullptr, Buffer::Storage::Static, Buffer::ImmutableAccess::None);
Expand All @@ -97,7 +97,7 @@ TEST_CASE("Buffer immutable constructor") {
}

TEST_CASE("Buffer bind function changes state correctly") {
Context context = {"Title", {512, 512}, {{WindowHint::Visible, false}}};
Context context = {"Title", {512, 512}, nullptr, {{WindowHint::Hint::Visible, false}}};

{
StateBuffer buffer = StateBuffer(Buffer::Type::Array, 1024, nullptr, Buffer::Usage::StaticDraw, Buffer::MutableAccess::None);
Expand All @@ -111,7 +111,7 @@ TEST_CASE("Buffer bind function changes state correctly") {
}

TEST_CASE("Buffer bindAs function changes state correctly") {
Context context = {"Title", {512, 512}, {{WindowHint::Visible, false}}};
Context context = {"Title", {512, 512}, nullptr, {{WindowHint::Hint::Visible, false}}};

{
StateBuffer buffer = StateBuffer(Buffer::Type::Array, 1024, nullptr, Buffer::Usage::StaticDraw, Buffer::MutableAccess::None);
Expand All @@ -125,7 +125,7 @@ TEST_CASE("Buffer bindAs function changes state correctly") {
}

TEST_CASE("Buffer bindBase function changes state correctly") {
Context context = {"Title", {512, 512}, {{WindowHint::Visible, false}}};
Context context = {"Title", {512, 512}, nullptr, {{WindowHint::Hint::Visible, false}}};

{
StateBuffer buffer = StateBuffer(Buffer::Type::Uniform, 1024, nullptr, Buffer::Usage::StaticDraw, Buffer::MutableAccess::None);
Expand All @@ -139,7 +139,7 @@ TEST_CASE("Buffer bindBase function changes state correctly") {
}

TEST_CASE("Buffer bindBaseAs function changes state correctly") {
Context context = {"Title", {512, 512}, {{WindowHint::Visible, false}}};
Context context = {"Title", {512, 512}, nullptr, {{WindowHint::Hint::Visible, false}}};

{
StateBuffer buffer = StateBuffer(Buffer::Type::Uniform, 1024, nullptr, Buffer::Usage::StaticDraw, Buffer::MutableAccess::None);
Expand All @@ -153,7 +153,7 @@ TEST_CASE("Buffer bindBaseAs function changes state correctly") {
}

TEST_CASE("Buffer bindBufferRange function changes state correctly") {
Context context = {"Title", {512, 512}, {{WindowHint::Visible, false}}};
Context context = {"Title", {512, 512}, nullptr, {{WindowHint::Hint::Visible, false}}};

{
StateBuffer buffer = StateBuffer(Buffer::Type::Uniform, 1024, nullptr, Buffer::Usage::StaticDraw, Buffer::MutableAccess::None);
Expand All @@ -167,7 +167,7 @@ TEST_CASE("Buffer bindBufferRange function changes state correctly") {
}

TEST_CASE("Buffer bindBufferRangeAs function changes state correctly") {
Context context = {"Title", {512, 512}, {{WindowHint::Visible, false}}};
Context context = {"Title", {512, 512}, nullptr, {{WindowHint::Hint::Visible, false}}};

{
StateBuffer buffer = StateBuffer(Buffer::Type::Uniform, 1024, nullptr, Buffer::Usage::StaticDraw, Buffer::MutableAccess::None);
Expand All @@ -181,7 +181,7 @@ TEST_CASE("Buffer bindBufferRangeAs function changes state correctly") {
}

TEST_CASE("Buffer mutable mapData function changes state correctly") {
Context context = {"Title", {512, 512}, {{WindowHint::Visible, false}}};
Context context = {"Title", {512, 512}, nullptr, {{WindowHint::Hint::Visible, false}}};

{
StateBuffer buffer = StateBuffer(Buffer::Type::Uniform, 1024, nullptr, Buffer::Usage::StaticDraw, Buffer::MutableAccess::Write);
Expand Down Expand Up @@ -223,7 +223,7 @@ TEST_CASE("Buffer mutable mapData function changes state correctly") {
}

TEST_CASE("Buffer immutable mapData function changes state correctly") {
Context context = {"Title", {512, 512}, {{WindowHint::Visible, false}}};
Context context = {"Title", {512, 512}, nullptr, {{WindowHint::Hint::Visible, false}}};

{
unsigned char data[1024] = {1};
Expand Down Expand Up @@ -263,7 +263,7 @@ TEST_CASE("Buffer immutable mapData function changes state correctly") {
}

TEST_CASE("Buffer bufferSubData function changes state correctly") {
Context context = {"Title", {512, 512}, {{WindowHint::Visible, false}}};
Context context = {"Title", {512, 512}, nullptr, {{WindowHint::Hint::Visible, false}}};

{
StateBuffer buffer = StateBuffer(Buffer::Type::Uniform, 1024, nullptr, Buffer::Usage::StaticDraw, Buffer::MutableAccess::None);
Expand All @@ -277,7 +277,7 @@ TEST_CASE("Buffer bufferSubData function changes state correctly") {
}

TEST_CASE("Buffer clone function changes state correctly for mutable buffer") {
Context context = {"Title", {512, 512}, {{WindowHint::Visible, false}}};
Context context = {"Title", {512, 512}, nullptr, {{WindowHint::Hint::Visible, false}}};

{
unsigned char data[1024] = {42};
Expand All @@ -298,7 +298,7 @@ TEST_CASE("Buffer clone function changes state correctly for mutable buffer") {
}

TEST_CASE("Buffer clone function changes state correctly for immutable buffer") {
Context context = {"Title", {512, 512}, {{WindowHint::Visible, false}}};
Context context = {"Title", {512, 512}, nullptr, {{WindowHint::Hint::Visible, false}}};

{
unsigned char data[1024] = {42};
Expand All @@ -319,7 +319,7 @@ TEST_CASE("Buffer clone function changes state correctly for immutable buffer")
}

TEST_CASE("Buffer resize function changes state correctly for mutable buffer") {
Context context = {"Title", {512, 512}, {{WindowHint::Visible, false}}};
Context context = {"Title", {512, 512}, nullptr, {{WindowHint::Hint::Visible, false}}};

{
unsigned char data[1024] = {42};
Expand All @@ -336,7 +336,7 @@ TEST_CASE("Buffer resize function changes state correctly for mutable buffer") {
}

TEST_CASE("Buffer resize function changes state correctly for immutable buffer") {
Context context = {"Title", {512, 512}, {{WindowHint::Visible, false}}};
Context context = {"Title", {512, 512}, nullptr, {{WindowHint::Hint::Visible, false}}};

{
unsigned char data[1024] = {42};
Expand All @@ -353,7 +353,7 @@ TEST_CASE("Buffer resize function changes state correctly for immutable buffer")
}

TEST_CASE("Buffer resize function changes state correctly for immutable buffer with immutable buffers bound") {
Context context = {"Title", {512, 512}, {{WindowHint::Visible, false}}};
Context context = {"Title", {512, 512}, nullptr, {{WindowHint::Hint::Visible, false}}};

StateBuffer fake1 = StateBuffer(Buffer::Type::Uniform, 1024, nullptr, Buffer::Storage::Static, Buffer::ImmutableAccess::None);
StateBuffer fake2 = StateBuffer(Buffer::Type::Uniform, 1024, nullptr, Buffer::Storage::Static, Buffer::ImmutableAccess::None);
Expand All @@ -378,7 +378,7 @@ TEST_CASE("Buffer resize function changes state correctly for immutable buffer w
}

TEST_CASE("Buffer clone function changes state correctly for immutable buffer with immutable buffers bound") {
Context context = {"Title", {512, 512}, {{WindowHint::Visible, false}}};
Context context = {"Title", {512, 512}, nullptr, {{WindowHint::Hint::Visible, false}}};

StateBuffer fake1 = StateBuffer(Buffer::Type::Uniform, 1024, nullptr, Buffer::Storage::Static, Buffer::ImmutableAccess::None);
StateBuffer fake2 = StateBuffer(Buffer::Type::ShaderStorage, 1024, nullptr, Buffer::Storage::Static, Buffer::ImmutableAccess::None);
Expand Down
6 changes: 3 additions & 3 deletions tests/limitless/core/state_texture_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class TextureChecker {
};

TEST_CASE("Texture constructor") {
Context context = {"Title", {512, 512}, {{WindowHint::Visible, false}}};
Context context = {"Title", {512, 512}, nullptr, {{WindowHint::Hint::Visible, false}}};

{
StateTexture tex = StateTexture();
Expand All @@ -98,7 +98,7 @@ TEST_CASE("Texture constructor") {
}

TEST_CASE("Texture activate function") {
Context context = {"Title", {512, 512}, {{WindowHint::Visible, false}}};
Context context = {"Title", {512, 512}, nullptr, {{WindowHint::Hint::Visible, false}}};

{
StateTexture tex = StateTexture();
Expand All @@ -112,7 +112,7 @@ TEST_CASE("Texture activate function") {
}

TEST_CASE("Texture bind function") {
Context context = {"Title", {512, 512}, {{WindowHint::Visible, false}}};
Context context = {"Title", {512, 512}, nullptr, {{WindowHint::Hint::Visible, false}}};

{
StateTexture tex = StateTexture();
Expand Down
Loading

0 comments on commit be7b141

Please sign in to comment.