15 #define GETTEXT_DOMAIN "wesnoth-test"
17 #include <boost/test/unit_test.hpp>
32 .evaluate().as_string()
37 .evaluate().as_string()
44 .evaluate().as_string()
51 .evaluate().as_string()
56 .evaluate().as_string()
61 .evaluate().as_string()
68 .evaluate().as_string()
75 .evaluate().as_string()
80 .evaluate().as_string()
87 .evaluate().as_string()
92 .evaluate().as_string()
97 .evaluate().as_string()
102 .evaluate().as_string()
107 .evaluate().as_string()
131 .evaluate().as_string()
136 .evaluate().as_string()
141 "concatenate([1.0, 1.00, 1.000, 1.2, 1.23, 1.234])")
142 .evaluate().as_string()
143 ,
"1.000, 1.000, 1.000, 1.200, 1.230, 1.234");
148 BOOST_CHECK_EQUAL(
formula(
"abs(5)").evaluate().as_int(), 5);
149 BOOST_CHECK_EQUAL(
formula(
"abs(-5)").evaluate().as_int(), 5);
150 BOOST_CHECK_EQUAL(
formula(
"abs(5.0)").evaluate().as_int(), 5);
151 BOOST_CHECK_EQUAL(
formula(
"abs(-5.0)").evaluate().as_int(), 5);
153 BOOST_CHECK_EQUAL(
formula(
"min(3,5)").evaluate().as_int(), 3);
154 BOOST_CHECK_EQUAL(
formula(
"min(5,2)").evaluate().as_int(), 2);
155 BOOST_CHECK_EQUAL(
formula(
"max(3,5)").evaluate().as_int(), 5);
156 BOOST_CHECK_EQUAL(
formula(
"max(5,2)").evaluate().as_int(), 5);
157 BOOST_CHECK_EQUAL(
formula(
"max(5.5,5)").evaluate().as_decimal(),
158 static_cast<int>(1000.0 * 5.5));
160 BOOST_CHECK_EQUAL(
formula(
"max(4,5,[2,18,7])").evaluate().as_int(), 18);
162 BOOST_CHECK_EQUAL(
formula(
"log(8,2)").evaluate().as_int(), 3);
163 BOOST_CHECK_EQUAL(
formula(
"log(12)").evaluate().as_decimal(),
164 static_cast<int>(round(1000.0 * log(12))));
165 BOOST_CHECK_EQUAL(
formula(
"exp(3)").evaluate().as_decimal(),
166 static_cast<int>(round(1000.0 * exp(3))));
171 const double pi = 4. * atan(1.);
175 for(
size_t x = 0;
x <= 360; ++
x) {
180 .evaluate(variables).as_decimal()
181 , static_cast<int>(round(1000. * sin(
x * pi / 180.))));
185 .evaluate(variables).as_decimal()
186 , static_cast<int>(round(1000. * cos(
x * pi / 180.))));
188 if(
x % 90 == 0 &&
x % 180 != 0) {
191 .evaluate(variables).is_null());
195 .evaluate(variables).as_decimal(),
196 static_cast<int>(round(1000. * tan(
x * pi / 180.))));
201 BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_SUITE(test_map_location)
bool set_log_domain_severity(std::string const &name, int severity)
GLint GLint GLint GLint GLint x
Standard logging facilities (interface).