mirror of
https://github.com/tbamud/tbamud.git
synced 2026-02-17 00:51:45 +01:00
Refactor: fixtures in its own files.
Added readme for creating tests. Found and fixed interesting bugs in destroy_db when there is no world. renamed the testfile to testrunner to make it clear it is actually running the texts. Also, made testrunner more focused on the actual running of the tests. Added debug target to test makefile.
This commit is contained in:
@@ -15,12 +15,12 @@ UNIT_TEST(test_do_remove_should_remove_second_item_by_number) {
|
||||
char_data *ch = get_test_char();
|
||||
|
||||
obj_data *ring1 = create_obj();
|
||||
ring1->name = "ring";
|
||||
ring1->short_description = "ring1";
|
||||
ring1->name = strdup("ring");
|
||||
ring1->short_description = strdup("ring1");
|
||||
|
||||
obj_data *ring2 = create_obj();
|
||||
ring2->name = "ring";
|
||||
ring2->short_description = "ring2";
|
||||
ring2->name = strdup("ring");
|
||||
ring2->short_description = strdup("ring2");
|
||||
|
||||
equip_char(ch, ring1, WEAR_FINGER_R);
|
||||
equip_char(ch, ring2, WEAR_FINGER_L);
|
||||
@@ -33,9 +33,19 @@ UNIT_TEST(test_do_remove_should_remove_second_item_by_number) {
|
||||
return MUNIT_OK;
|
||||
}
|
||||
|
||||
static void* before_each(const MunitParameter params[], void* user_data) {
|
||||
simple_world();
|
||||
add_test_char(0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void after_each(void* fixture) {
|
||||
destroy_db();
|
||||
}
|
||||
|
||||
MunitTest act_item_c_tests[] = {
|
||||
STD_TEST("/do_remove/item_not_found", test_do_remove_should_give_message_on_removing_of_unknown_item),
|
||||
STD_TEST("/do_remove/remove_second_item", test_do_remove_should_remove_second_item_by_number),
|
||||
EXT_TEST("/do_remove/item_not_found", test_do_remove_should_give_message_on_removing_of_unknown_item, before_each, after_each),
|
||||
EXT_TEST("/do_remove/remove_second_item", test_do_remove_should_remove_second_item_by_number, before_each, after_each),
|
||||
|
||||
// end of array marker
|
||||
{ NULL, NULL, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL }
|
||||
|
||||
Reference in New Issue
Block a user