1 #include <cxxtest/TestSuite.h>\r
2 \r
3 #include "svg/svg-length.h"\r
4 #include <glib.h>\r
5 #include <utility>\r
6 \r
7 class SvgLengthTest : public CxxTest::TestSuite\r
8 {\r
9 private:\r
10 public:\r
11 SvgLengthTest() {\r
12 }\r
13 \r
14 void testRead()\r
15 {\r
16 struct test_t {\r
17 char const* str; float computed;\r
18 test_t(char const* str, float computed) : str(str), computed(computed) {}\r
19 };\r
20 test_t tests[] = {\r
21 test_t("0",0),\r
22 test_t("1",1),\r
23 test_t("1.00001",1.00001),\r
24 test_t("1px",1),\r
25 test_t(".1px",0.1)};\r
26 size_t n = G_N_ELEMENTS(tests);\r
27 for(size_t i=0; i<n; i++) {\r
28 SVGLength l;\r
29 TSM_ASSERT(tests[i].str , l.read(tests[i].str));\r
30 TSM_ASSERT_EQUALS(tests[i].str , l.computed , tests[i].computed);\r
31 }\r
32 }\r
33 \r
34 // TODO: More tests\r
35 };\r
36 \r
37 /*\r
38 Local Variables:\r
39 mode:c++\r
40 c-file-style:"stroustrup"\r
41 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))\r
42 indent-tabs-mode:nil\r
43 fill-column:99\r
44 End:\r
45 */\r
46 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :\r