Files
raylib-cpp/tests/raylib_test.cpp
2021-05-06 18:43:34 -04:00

43 lines
1.1 KiB
C++

#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file
#include <string>
#include <vector>
#include "raylib-cpp.hpp"
#include "catch.hpp"
TEST_CASE("raylib_test", "[raylib_test]" ) {
SECTION("Vector2") {
raylib::Vector2 position(50, 100);
REQUIRE(position.GetX() == position.x);
position.x = 150;
REQUIRE(position.GetX() == 150);
// Addition operator.
raylib::Vector2 speed(10, 10);
position += speed;
REQUIRE(position.x == 160);
}
SECTION("Window") {
REQUIRE(raylib::Window::IsReady() == false);
}
SECTION("Color") {
raylib::Color color = RED;
REQUIRE(color.ToInt() == ::ColorToInt(RED));
color = RAYWHITE;
REQUIRE(color.r == RAYWHITE.r);
}
SECTION("RayMath") {
raylib::Vector2 direction(50, 50);
raylib::Vector2 newDirection = direction.Rotate(30);
REQUIRE((int)newDirection.x == 18);
}
SECTION("Functions") {
std::vector<std::string> files = raylib::GetDirectoryFiles(::GetWorkingDirectory());
REQUIRE(files.size() > 3);
}
}