mountcontrol/cxx/tests/fsm_test.cpp
Timur A. Fatkhullin 156dfb13ba FSM ...
2025-05-27 23:40:43 +03:00

42 lines
1.4 KiB
C++

#include <iostream>
#include <typeinfo>
#include "../mcc_fsm.h"
struct S {
};
int main()
{
using namespace mcc;
typedef fsm::unique_tuple_t<int, float, long, int, double, char, long> ut_t;
std::cout << "type index: " << fsm::unique_tuple_type_index_t<double, ut_t>::index << " (double)\n";
std::cout << "type index: " << fsm::unique_tuple_type_index_t<int, ut_t>::index << " (int)\n";
std::cout << "type index: " << fsm::unique_tuple_type_index_t<long, ut_t>::index << " (long)\n";
// std::cout << "type index: " << fsm::unique_tuple_type_index_t<S, ut_t>::index << " (struct S)\n";
std::cout << typeid(ut_t::tuple_t).name() << "\n";
std::cout << typeid(ut_t::non_unique_t).name() << "\n";
typedef fsm::pair_holder_t<std::pair<int, long>, std::pair<float, double>, std::pair<char, char*>> ph_t;
// using s_t = fsm::pair_holder_find_t<float, ph_t>::result_t;
using s_t = fsm::pair_holder_find_t<S, ph_t>::result_t;
if constexpr (std::is_null_pointer_v<s_t>) {
std::cout << "second type: invalid input type!\n";
} else {
std::cout << "second type: " << typeid(s_t).name() << "\n";
}
using t1_t = fsm::pair_holder_first_t<ph_t>::first_t;
std::cout << "first types: " << typeid(t1_t).name() << "\n";
using t2_t = fsm::pair_holder_second_t<ph_t>::second_t;
std::cout << "second types: " << typeid(t2_t).name() << "\n";
return 0;
}