Skip to content

Commit

Permalink
..
Browse files Browse the repository at this point in the history
  • Loading branch information
koekeishiya committed Mar 29, 2024
1 parent 8a8bd34 commit 7188d58
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions tests/src/area.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ TEST_FUNC(display_area_is_in_direction,
TEST_CHECK(t4, true);
});

static inline int test_display_in_direction(struct test_area *display_list, int display_count, int source, int direction)
static inline int closest_display_in_direction(struct test_area *display_list, int display_count, int source, int direction)
{
int best_index = -1;
int best_distance = INT_MAX;
Expand All @@ -63,27 +63,27 @@ static inline int test_display_in_direction(struct test_area *display_list, int
return best_index;
}

TEST_FUNC(display_area_distance_in_direction,
TEST_FUNC(closest_display_in_direction,
{
int best_index;
struct test_area display_list[3];
init_test_display_list(display_list);

best_index = test_display_in_direction(display_list, array_count(display_list), 0, DIR_WEST);
best_index = closest_display_in_direction(display_list, array_count(display_list), 0, DIR_WEST);
TEST_CHECK(best_index, 1);

best_index = test_display_in_direction(display_list, array_count(display_list), 1, DIR_WEST);
best_index = closest_display_in_direction(display_list, array_count(display_list), 1, DIR_WEST);
TEST_CHECK(best_index, -1);

best_index = test_display_in_direction(display_list, array_count(display_list), 2, DIR_WEST);
best_index = closest_display_in_direction(display_list, array_count(display_list), 2, DIR_WEST);
TEST_CHECK(best_index, 0);

best_index = test_display_in_direction(display_list, array_count(display_list), 0, DIR_EAST);
best_index = closest_display_in_direction(display_list, array_count(display_list), 0, DIR_EAST);
TEST_CHECK(best_index, 2);

best_index = test_display_in_direction(display_list, array_count(display_list), 1, DIR_EAST);
best_index = closest_display_in_direction(display_list, array_count(display_list), 1, DIR_EAST);
TEST_CHECK(best_index, 0);

best_index = test_display_in_direction(display_list, array_count(display_list), 2, DIR_EAST);
best_index = closest_display_in_direction(display_list, array_count(display_list), 2, DIR_EAST);
TEST_CHECK(best_index, -1);
});
2 changes: 1 addition & 1 deletion tests/src/tests.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#define TEST_ENTRY(name) { #name, test_##name },
#define TEST_LIST \
TEST_ENTRY(display_area_is_in_direction) \
TEST_ENTRY(display_area_distance_in_direction)
TEST_ENTRY(closest_display_in_direction)

static struct {
char *name;
Expand Down

0 comments on commit 7188d58

Please sign in to comment.