mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
tests: version api tests
This commit is contained in:
parent
658ed7df7f
commit
220764fde9
2 changed files with 24 additions and 0 deletions
|
@ -23,9 +23,22 @@
|
||||||
#include <thorvg_capi.h>
|
#include <thorvg_capi.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "../catch.hpp"
|
#include "../catch.hpp"
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
TEST_CASE("Basic capi initialization", "[capiInitializer]")
|
TEST_CASE("Basic capi initialization", "[capiInitializer]")
|
||||||
{
|
{
|
||||||
REQUIRE(tvg_engine_init(TVG_ENGINE_SW, 0) == TVG_RESULT_SUCCESS);
|
REQUIRE(tvg_engine_init(TVG_ENGINE_SW, 0) == TVG_RESULT_SUCCESS);
|
||||||
REQUIRE(tvg_engine_term(TVG_ENGINE_SW) == TVG_RESULT_SUCCESS);
|
REQUIRE(tvg_engine_term(TVG_ENGINE_SW) == TVG_RESULT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("Version", "[tvgInitializer]")
|
||||||
|
{
|
||||||
|
REQUIRE(tvg_engine_version(NULL, NULL, NULL, NULL) == TVG_RESULT_SUCCESS);
|
||||||
|
uint32_t major, minor, micro;
|
||||||
|
const char* curVersion;
|
||||||
|
tvg_engine_version(&major, &minor, µ, &curVersion);
|
||||||
|
REQUIRE(strcmp(curVersion, THORVG_VERSION_STRING) == 0);
|
||||||
|
char curVersion2[10];
|
||||||
|
snprintf(curVersion2, sizeof(curVersion2), "%d.%d.%d", major, minor, micro);
|
||||||
|
REQUIRE(strcmp(curVersion2, THORVG_VERSION_STRING) == 0);
|
||||||
|
}
|
|
@ -23,6 +23,7 @@
|
||||||
#include <thorvg.h>
|
#include <thorvg.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "catch.hpp"
|
#include "catch.hpp"
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
using namespace tvg;
|
using namespace tvg;
|
||||||
|
|
||||||
|
@ -44,6 +45,16 @@ TEST_CASE("Multiple initialization", "[tvgInitializer]")
|
||||||
REQUIRE(Initializer::term(CanvasEngine::Sw) == Result::Success);
|
REQUIRE(Initializer::term(CanvasEngine::Sw) == Result::Success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("Version", "[tvgInitializer]")
|
||||||
|
{
|
||||||
|
REQUIRE(strcmp(Initializer::version(nullptr, nullptr, nullptr), THORVG_VERSION_STRING) == 0);
|
||||||
|
uint32_t major, minor, micro;
|
||||||
|
REQUIRE(strcmp(Initializer::version(&major, &minor, µ), THORVG_VERSION_STRING) == 0);
|
||||||
|
char curVersion[10];
|
||||||
|
snprintf(curVersion, sizeof(curVersion), "%d.%d.%d", major, minor, micro);
|
||||||
|
REQUIRE(strcmp(curVersion, THORVG_VERSION_STRING) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
TEST_CASE("Negative termination", "[tvgInitializer]")
|
TEST_CASE("Negative termination", "[tvgInitializer]")
|
||||||
{
|
{
|
||||||
REQUIRE(Initializer::term(CanvasEngine::Sw) == Result::InsufficientCondition);
|
REQUIRE(Initializer::term(CanvasEngine::Sw) == Result::InsufficientCondition);
|
||||||
|
|
Loading…
Add table
Reference in a new issue