Add failing test for short comparisons #26
This commit is contained in:
parent
41b0c7768c
commit
277b4eec9a
@ -183,6 +183,11 @@ if(BUILD_TESTING)
|
||||
target_link_libraries(eval_catch_exception_test ${LIBS})
|
||||
add_test(NAME Eval_Catch_Exception_Test COMMAND eval_catch_exception_test)
|
||||
|
||||
add_executable(short_comparison_test unittests/short_comparison_test.cpp)
|
||||
target_link_libraries(short_comparison_test ${LIBS})
|
||||
add_test(NAME short_comparison_test COMMAND short_comparison_test)
|
||||
|
||||
|
||||
add_executable(multifile_test unittests/multifile_test_main.cpp unittests/multifile_test_chai.cpp
|
||||
unittests/multifile_test_module.cpp)
|
||||
target_link_libraries(multifile_test ${LIBS})
|
||||
|
29
unittests/short_comparison_test.cpp
Normal file
29
unittests/short_comparison_test.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
#include <chaiscript/utility/utility.hpp>
|
||||
|
||||
class Test {
|
||||
public:
|
||||
Test() : value_(5) {}
|
||||
|
||||
short get_value() { return value_; }
|
||||
|
||||
short value_;
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
chaiscript::ChaiScript chai;
|
||||
chai.add(chaiscript::user_type<Test>(), "Test");
|
||||
chai.add(chaiscript::constructor<Test()>(), "Test");
|
||||
|
||||
chai.add(chaiscript::fun(&Test::get_value), "get_value");
|
||||
|
||||
chai.eval("var t := Test();");
|
||||
|
||||
if (chai.eval<bool>("t.get_value() == 5"))
|
||||
{
|
||||
return EXIT_SUCCESS;
|
||||
} else {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user