| 15 | |
| 16 | template<typename T> |
| 17 | bool test_literal(T val, const std::string &str, bool use_boxed_number = false) |
| 18 | { |
| 19 | std::cout << '(' << str << ") Comparing : C++ '" << val; |
| 20 | chaiscript::ChaiScript_Basic chai(create_chaiscript_stdlib(),create_chaiscript_parser()); |
| 21 | |
| 22 | // Note, after applying the `-` it's possible that chaiscript has internally converted |
| 23 | // between two equivalently sized types (ie, unsigned long and unsigned long long on a 64bit system) |
| 24 | // so we're going to allow some leeway with the signed tests |
| 25 | T val2 = [&](){ |
| 26 | if (!use_boxed_number) { |
| 27 | return chai.eval<T>(str); |
| 28 | } else { |
| 29 | return chai.eval<chaiscript::Boxed_Number>(str).get_as_checked<T>(); |
| 30 | } |
| 31 | }(); |
| 32 | |
| 33 | std::cout << "' chai '" << val2 << "'\n"; |
| 34 | return val == val2; |
| 35 | } |
| 36 | |
| 37 | int main() |
| 38 | { |
no test coverage detected