Browse Source

test: add ffi codec warm up test

master
Dnomd343 2 years ago
parent
commit
e2ddcd4c76
  1. 2
      test/CMakeLists.txt
  2. 22
      test/ffi/codec.cc

2
test/CMakeLists.txt

@ -40,7 +40,7 @@ add_test(NAME codec COMMAND test_codec)
include_directories(../src/klotski_core)
include_directories(../src/klotski_core/utils)
set(TEST_FFI_SRC metadata.cc all_cases.cc)
set(TEST_FFI_SRC metadata.cc codec.cc all_cases.cc)
list(TRANSFORM TEST_FFI_SRC PREPEND "ffi/")
add_executable(test_ffi ${TEST_FFI_SRC})
target_link_libraries(test_ffi ${TEST_DEPS})

22
test/ffi/codec.cc

@ -0,0 +1,22 @@
#include "klotski.h"
#include "all_cases.h"
#include "short_code.h"
#include "gtest/gtest.h"
using klotski::AllCases;
using klotski::ShortCode;
using klotski::BasicRanges;
TEST(FFI, codec_warm_up) {
// short code normal mode check
EXPECT_EQ(is_short_code_available(), BasicRanges::status() == BasicRanges::AVAILABLE);
short_code_enable();
EXPECT_EQ(is_short_code_available(), true);
EXPECT_EQ(is_short_code_available(), BasicRanges::status() == BasicRanges::AVAILABLE);
// short code fast mode check
EXPECT_EQ(is_short_code_available_fast(), AllCases::status() == AllCases::AVAILABLE);
short_code_enable_fast();
EXPECT_EQ(is_short_code_available_fast(), true);
EXPECT_EQ(is_short_code_available_fast(), AllCases::status() == AllCases::AVAILABLE);
}
Loading…
Cancel
Save