36 #if !defined(LUTOK_TEST_UTILS_HPP)
37 # define LUTOK_TEST_UTILS_HPP
39 # error "test_utils.hpp can only be included once"
42 #include <atf-c++.hpp>
61 #define REQUIRE_API_ERROR(exp_api_function, statement) \
65 ATF_FAIL("api_error not raised by " #statement); \
66 } catch (const lutok::api_error& api_error) { \
67 ATF_REQUIRE_EQ(exp_api_function, api_error.api_function()); \
79 static inline lua_State*
111 const bool with_sentinel_ =
true) :
113 _with_sentinel(with_sentinel_),
114 _old_count(_state.get_top())
117 _state.push_integer(987654321);
126 if (_with_sentinel) {
127 if (!_state.is_number(-1) || _state.to_integer(-1) != 987654321)
128 ATF_FAIL(
"Stack corrupted: sentinel not found");
132 unsigned int new_count = _state.get_top();
133 if (_old_count != new_count)
136 ATF_FAIL(
"Stack not balanced");