From: Lukel495 Date: Mon, 11 Dec 2023 10:11:06 +0000 (+0100) Subject: added tests X-Git-Url: https://gitweb.forssennils.se/?a=commitdiff_plain;h=55fc5589d93c287a0cfe00ebce5813be70ebceff;p=TDDC76_proj.git added tests --- diff --git a/src/_test.cc b/src/_test.cc index 5292fab..bcc4ffc 100644 --- a/src/_test.cc +++ b/src/_test.cc @@ -25,17 +25,23 @@ TEST_CASE("functions") { Context game_context{}; - std::ifstream f("assets/data.json"); - json data = json::parse(f); - game_context.current_state = std::make_unique(data); + std::ifstream f("assets/data_test.json"); + json test_data = json::parse(f); + + game_context.current_state = std::make_unique(test_data); + sf::Texture helper_texture; - helper_texture.loadFromFile(data["game_state_assets"]["helper_file"]); - Helper helper {helper_texture, data["helper"]}; + helper_texture.loadFromFile(test_data["game_state_assets"]["helper_file"]); + Helper helper {helper_texture, test_data["helper"]}; CHECK(helper.get_hitbox().getPosition().x == 989.33502f); CHECK(helper.get_hitbox().getPosition().y == 37.94f); helper.update(game_context); CHECK_FALSE(helper.get_hitbox().getPosition().x == 1000); CHECK_FALSE(helper.get_hitbox().getPosition().y == 50); + + + + } }