Add test for "class_info()".
[luabind.git] / test / test_builtin_converters.cpp
blobec5d7340d1411d176b26c31fe54edc9266a3f34b
1 // Copyright Daniel Wallin 2009. Use, modification and distribution is
2 // subject to the Boost Software License, Version 1.0. (See accompanying
3 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 #include "test.hpp"
7 #include <luabind/luabind.hpp>
9 #define LUABIND_TEST_BUILTIN(type, value) \
10 default_converter<type>().to(L, value); \
11 TEST_CHECK(default_converter<type>().from(L, -1) == value); \
12 lua_pop(L, 1)
14 void test_main(lua_State* L)
16 using namespace luabind;
18 LUABIND_TEST_BUILTIN(int, 1);
19 LUABIND_TEST_BUILTIN(int, -1);
20 LUABIND_TEST_BUILTIN(unsigned int, 1);
21 LUABIND_TEST_BUILTIN(unsigned int, 2);
23 LUABIND_TEST_BUILTIN(short, 1);
24 LUABIND_TEST_BUILTIN(short, -1);
25 LUABIND_TEST_BUILTIN(unsigned short, 1);
26 LUABIND_TEST_BUILTIN(unsigned short, 2);
28 LUABIND_TEST_BUILTIN(long, 1);
29 LUABIND_TEST_BUILTIN(long, -1);
30 LUABIND_TEST_BUILTIN(unsigned long, 1);
31 LUABIND_TEST_BUILTIN(unsigned long, 2);
33 LUABIND_TEST_BUILTIN(char, 1);
34 LUABIND_TEST_BUILTIN(char, 2);
35 LUABIND_TEST_BUILTIN(unsigned char, 1);
36 LUABIND_TEST_BUILTIN(unsigned char, 2);
37 LUABIND_TEST_BUILTIN(signed char, -1);
38 LUABIND_TEST_BUILTIN(signed char, 1);
40 LUABIND_TEST_BUILTIN(float, 1.5);
41 LUABIND_TEST_BUILTIN(float, -1.5);
43 LUABIND_TEST_BUILTIN(double, 1.5);
44 LUABIND_TEST_BUILTIN(double, -1.5);
46 LUABIND_TEST_BUILTIN(bool, true);
47 LUABIND_TEST_BUILTIN(bool, false);