Browse Source

build: compile with benchmark module

master
Dnomd343 2 years ago
parent
commit
7b7cc9bf91
  1. 17
      src/CMakeLists.txt
  2. 5
      src/benchmark/CMakeLists.txt
  3. 87
      src/main.cc

17
src/CMakeLists.txt

@ -1,18 +1,11 @@
cmake_minimum_required(VERSION 3.0)
#include_directories(klotski)
#include_directories(klotski/utils)
#include_directories(klotski/all_cases)
#
#include_directories(klotski/raw_code)
#include_directories(klotski/short_code)
#include_directories(klotski/common_code)
#
#include_directories(klotski/core)
#include_directories(klotski/analyse)
#include_directories(klotski/fast_cal)
include_directories(klotski)
include_directories(benchmark)
add_subdirectory(klotski)
add_subdirectory(benchmark)
#add_executable(klotski_bin main.cc)
add_executable(klotski_bin main.cc)
target_link_libraries(klotski_bin benchmark)
#target_link_libraries(klotski_bin klotski)

5
src/benchmark/CMakeLists.txt

@ -1 +1,6 @@
cmake_minimum_required(VERSION 3.0)
include_directories(../klotski/all_cases)
add_library(benchmark chore.cc benchmark.cc)
target_link_libraries(benchmark klotski)

87
src/main.cc

@ -1,19 +1,19 @@
#include <iostream>
#include "common.h"
#include "all_cases.h"
#include "raw_code.h"
#include "short_code.h"
#include "common_code.h"
#include "core.h"
#include "analyse.h"
#include "fast_cal.h"
//#include "utils/common.h"
//#include "all_cases/all_cases.h"
//
//#include "raw_code/raw_code.h"
//#include "short_code/short_code.h"
//#include "common_code/common_code.h"
//
//#include "core/core.h"
//#include "analyse/analyse.h"
//#include "fast_cal/fast_cal.h"
//#include "graph.h"
//#include "benchmark.h"
#include "benchmark.h"
//#include <unistd.h>
@ -21,39 +21,40 @@ int main() {
std::cout << "start test" << std::endl;
std::cout << (uint32_t)Common::check_range(1, Common::range_reverse(0xA9BF0C00)) << std::endl;
AllCases::build();
for (const auto &a : AllCases::fetch()) {
std::cout << a.size() << std::endl;
}
std::cout << RawCode::from_common_code("1a9bf0c") << std::endl;
std::cout << RawCode::create(0x0603EDF5CAFFF5E2) << std::endl;
std::cout << CommonCode::create(0x1A9BF0C00) << std::endl;
std::cout << CommonCode::from_string("1a9bf0c") << std::endl;
std::cout << CommonCode::from_short_code(4091296) << std::endl;
std::cout << CommonCode::from_raw_code(0x0603EDF5CAFFF5E2) << std::endl;
std::cout << ShortCode::create(4091296) << std::endl;
std::cout << ShortCode::from_string("4WVE1") << std::endl;
std::cout << ShortCode::from_common_code(0x1A9BF0C00) << std::endl;
auto core = Core([](uint64_t code, uint64_t mask) {
printf("new case -> code = %015lX | mask = %015lX\n", code, mask);
});
core.next_cases(RawCode::from_common_code("1a9bf0c").unwrap(), 0);
for (const auto &c : FastCal::resolve(RawCode::from_common_code("1a9bf0c"))) {
std::cout << c << std::endl;
}
auto a = Analyse(RawCode::from_common_code("1a9bf0c"));
for (const auto &s : a.build_resolve()) {
std::cout << s << std::endl;
}
// std::cout << (uint32_t)Common::check_range(1, Common::range_reverse(0xA9BF0C00)) << std::endl;
//
// AllCases::build();
// for (const auto &a : AllCases::fetch()) {
// std::cout << a.size() << std::endl;
// }
//
// std::cout << RawCode::from_common_code("1a9bf0c") << std::endl;
// std::cout << RawCode::create(0x0603EDF5CAFFF5E2) << std::endl;
//
// std::cout << CommonCode::create(0x1A9BF0C00) << std::endl;
// std::cout << CommonCode::from_string("1a9bf0c") << std::endl;
// std::cout << CommonCode::from_short_code(4091296) << std::endl;
// std::cout << CommonCode::from_raw_code(0x0603EDF5CAFFF5E2) << std::endl;
//
// std::cout << ShortCode::create(4091296) << std::endl;
// std::cout << ShortCode::from_string("4WVE1") << std::endl;
// std::cout << ShortCode::from_common_code(0x1A9BF0C00) << std::endl;
//
// auto core = Core([](uint64_t code, uint64_t mask) {
// printf("new case -> code = %015lX | mask = %015lX\n", code, mask);
// });
// core.next_cases(RawCode::from_common_code("1a9bf0c").unwrap(), 0);
//
// for (const auto &c : FastCal::resolve(RawCode::from_common_code("1a9bf0c"))) {
// std::cout << c << std::endl;
// }
//
// auto a = Analyse(RawCode::from_common_code("1a9bf0c"));
// for (const auto &s : a.build_resolve()) {
// std::cout << s << std::endl;
// }
Benchmark::basic_ranges(std::cout);
std::cout << "end test" << std::endl;

Loading…
Cancel
Save