comparison tests/test-tileset.c @ 407:e6f972e04519

tests: don't use automatic feature
author David Demelier <markand@malikania.fr>
date Wed, 06 Apr 2022 12:09:25 +0200
parents 460c78706989
children 0ea90751a62d
comparison
equal deleted inserted replaced
406:107fc5c77df2 407:e6f972e04519
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */ 17 */
18 18
19 #include <rexo.h>
20
21 #include <core/core.h> 19 #include <core/core.h>
22 #include <core/window.h> 20 #include <core/window.h>
23 21
24 #include <rpg/tileset-file.h> 22 #include <rpg/tileset-file.h>
25 #include <rpg/tileset.h> 23 #include <rpg/tileset.h>
26 24
27 RX_TEST_CASE(test, basics_sample) 25 #include "test.h"
26
27 TEST_DECL(basics_sample)
28 { 28 {
29 struct tileset_file loader = {0}; 29 struct tileset_file loader = {0};
30 struct tileset tileset; 30 struct tileset tileset;
31 31
32 RX_REQUIRE(tileset_file_open(&loader, &tileset, DIRECTORY "/maps/sample-tileset.tileset") == 0); 32 RX_REQUIRE(tileset_file_open(&loader, &tileset, DIRECTORY "/maps/sample-tileset.tileset") == 0);
60 RX_UINT_REQUIRE_EQUAL(tileset.tiledefs[3].h, 40); 60 RX_UINT_REQUIRE_EQUAL(tileset.tiledefs[3].h, 40);
61 61
62 tileset_file_finish(&loader); 62 tileset_file_finish(&loader);
63 } 63 }
64 64
65 RX_TEST_CASE(test, error_tilewidth) 65 TEST_DECL(error_tilewidth)
66 { 66 {
67 struct tileset_file loader = {0}; 67 struct tileset_file loader = {0};
68 struct tileset tileset = {0}; 68 struct tileset tileset = {0};
69 69
70 RX_INT_REQUIRE_EQUAL(tileset_file_open(&loader, &tileset, DIRECTORY "/maps/error-tilewidth.tileset"), -1); 70 RX_INT_REQUIRE_EQUAL(tileset_file_open(&loader, &tileset, DIRECTORY "/maps/error-tilewidth.tileset"), -1);
71 } 71 }
72 72
73 RX_TEST_CASE(test, error_tileheight) 73 TEST_DECL(error_tileheight)
74 { 74 {
75 struct tileset_file loader = {0}; 75 struct tileset_file loader = {0};
76 struct tileset tileset = {0}; 76 struct tileset tileset = {0};
77 77
78 RX_INT_REQUIRE_EQUAL(tileset_file_open(&loader, &tileset, DIRECTORY "/maps/error-tileheight.tileset"), -1); 78 RX_INT_REQUIRE_EQUAL(tileset_file_open(&loader, &tileset, DIRECTORY "/maps/error-tileheight.tileset"), -1);
79 } 79 }
80 80
81 RX_TEST_CASE(test, error_image) 81 TEST_DECL(error_image)
82 { 82 {
83 struct tileset_file loader = {0}; 83 struct tileset_file loader = {0};
84 struct tileset tileset = {0}; 84 struct tileset tileset = {0};
85 85
86 RX_INT_REQUIRE_EQUAL(tileset_file_open(&loader, &tileset, DIRECTORY "/maps/error-image.tileset"), -1); 86 RX_INT_REQUIRE_EQUAL(tileset_file_open(&loader, &tileset, DIRECTORY "/maps/error-image.tileset"), -1);
87 } 87 }
88 88
89 static const struct rx_test_case tests[] = {
90 TEST_DEF("basics", "sample", basics_sample),
91 TEST_DEF("error", "tilewidth", error_tilewidth),
92 TEST_DEF("error", "tileheight", error_tileheight),
93 TEST_DEF("error", "image", error_image),
94 };
95
89 int 96 int
90 main(int argc, char **argv) 97 main(int argc, char **argv)
91 { 98 {
92 if (core_init("fr.malikania", "test") < 0 || window_open("test-tileset", 100, 100) < 0) 99 if (core_init("fr.malikania", "test") < 0 || window_open("test-tileset", 100, 100) < 0)
93 return 1; 100 return 1;
94 101
95 return rx_main(0, NULL, argc, (const char **)argv) == RX_SUCCESS ? 0 : 1; 102 return TEST_RUN(tests, argc, argv);
96 } 103 }