1
0
mirror of https://github.com/meekrosoft/fff synced 2026-01-23 00:15:59 +01:00

Moved global variables into struct so they don't pollute the global namespace

This commit is contained in:
Mike Long
2012-05-29 07:46:21 +08:00
parent fef801e995
commit 3d6cfd218b
12 changed files with 68 additions and 66 deletions

View File

@@ -1,10 +1,3 @@
/*
* UI.c
*
* Created on: Dec 17, 2010
* Author: mlong
*/
#include "UI.h"
#include "DISPLAY.h"
#include "SYSTEM.h"

View File

@@ -1,10 +1,3 @@
/*
* UI.h
*
* Created on: Dec 17, 2010
* Author: mlong
*/
#ifndef UI_H_
#define UI_H_

View File

@@ -40,7 +40,7 @@ void setup()
RESET_FAKE(button_press_cbk);
RESET_HISTORY();
FFF_RESET_HISTORY();
DISPLAY_get_line_capacity_fake.return_val = 2;
}
@@ -105,9 +105,9 @@ TEST_F(UITests, when_no_empty_lines_write_line_clears_screen_and_outputs_lines_t
assert(DISPLAY_output_fake.call_count == 1);
// Check the order of the calls: Don't care about the first two:
// DISPLAY_get_line_capacity and DISPLAY_get_line_insert_index
assert(call_history_idx == 4);
assert(call_history[2] == (void *) DISPLAY_clear);
assert(call_history[3] == (void *) DISPLAY_output);
assert(fff.call_history_idx == 4);
assert(fff.call_history[2] == (void *) DISPLAY_clear);
assert(fff.call_history[3] == (void *) DISPLAY_output);
}
TEST_F(UITests, when_empty_lines_write_line_doesnt_clear_screen)

View File

@@ -38,7 +38,7 @@ public:
RESET_FAKE(button_press_cbk);
RESET_HISTORY();
FFF_RESET_HISTORY();
// non default init
DISPLAY_get_line_capacity_fake.return_val = 2;
}
@@ -106,9 +106,9 @@ TEST_F(UITests, when_no_empty_lines_write_line_clears_screen_and_outputs_lines_t
ASSERT_EQ(DISPLAY_output_fake.call_count, 1);
// Check the order of the calls: Don't care about the first two:
// DISPLAY_get_line_capacity and DISPLAY_get_line_insert_index
ASSERT_EQ(call_history_idx, 4);
ASSERT_EQ(call_history[2], (void *) DISPLAY_clear);
ASSERT_EQ(call_history[3], (void *) DISPLAY_output);
ASSERT_EQ(fff.call_history_idx, 4);
ASSERT_EQ(fff.call_history[2], (void *) DISPLAY_clear);
ASSERT_EQ(fff.call_history[3], (void *) DISPLAY_output);
}
TEST_F(UITests, when_empty_lines_write_line_doesnt_clear_screen)

View File

@@ -1,10 +1,4 @@
#include <assert.h>
#include <stdio.h>
void setup();
#define TEST_F(SUITE, NAME) void NAME()
#define RUN_TEST(TESTNAME) printf(" Running %s: ", #TESTNAME); fflush(0); setup(); TESTNAME(); printf(" SUCCESS\n");
#include "../test/c_test_framework.h"
/* Initialializers called for every test */
void setup()
@@ -29,7 +23,7 @@ int main()
fflush(0);
/* Run tests */
RUN_TEST(hello_world);
RUN_TEST(GreeterTests, hello_world);
printf("\n-------------\n");