diff options
author | Willian Paixao <willian@ufpa.br> | 2021-12-05 19:16:34 +0100 |
---|---|---|
committer | Willian Paixao <willian@ufpa.br> | 2021-12-05 19:16:34 +0100 |
commit | ac2e205ae9f465c27297ea542c72e8cfe4966f8c (patch) | |
tree | 16e4d1268b2631ba7e17dcda8f366f070fbd7475 /tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example | |
parent | bbd394a19aaa334a179c36cf2ed2a066f1bb312c (diff) | |
download | Sensor-Watch-ac2e205ae9f465c27297ea542c72e8cfe4966f8c.tar.gz Sensor-Watch-ac2e205ae9f465c27297ea542c72e8cfe4966f8c.tar.bz2 Sensor-Watch-ac2e205ae9f465c27297ea542c72e8cfe4966f8c.zip |
remove tinyusb directory
Diffstat (limited to 'tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example')
15 files changed, 0 insertions, 459 deletions
diff --git a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/project.yml b/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/project.yml deleted file mode 100755 index 6bda2229..00000000 --- a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/project.yml +++ /dev/null @@ -1,71 +0,0 @@ ---- - -# Notes: -# Sample project C code is not presently written to produce a release artifact. -# As such, release build options are disabled. -# This sample, therefore, only demonstrates running a collection of unit tests. - -:project: - :use_exceptions: FALSE - :use_test_preprocessor: TRUE - :use_auxiliary_dependencies: TRUE - :build_root: build -# :release_build: TRUE - :test_file_prefix: test_ - -#:release_build: -# :output: MyApp.out -# :use_assembly: FALSE - -:environment: - -:extension: - :executable: .out - -:paths: - :test: - - +:test/** - :source: - - src/** - :support: - -:defines: - # in order to add common defines: - # 1) remove the trailing [] from the :common: section - # 2) add entries to the :common: section (e.g. :test: has TEST defined) - :commmon: &common_defines [] - :test: - - *common_defines - - TEST - :test_preprocess: - - *common_defines - - TEST - -:cmock: - :mock_prefix: mock_ - :when_no_prototypes: :warn - :enforce_strict_ordering: TRUE - :plugins: - - :ignore - - :callback - :treat_as: - uint8: HEX8 - uint16: HEX16 - uint32: UINT32 - int8: INT8 - bool: UINT8 - -#:tools: -# Ceedling defaults to using gcc for compiling, linking, etc. -# As [:tools] is blank, gcc will be used (so long as it's in your system path) -# See documentation to configure a given toolchain for use - -:plugins: - :load_paths: - # This change from the default is for running Ceedling out of another folder. - - ../../../../plugins - :enabled: - - stdout_pretty_tests_report - - module_generator - - fake_function_framework -... diff --git a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/rakefile.rb b/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/rakefile.rb deleted file mode 100755 index e484d5fb..00000000 --- a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/rakefile.rb +++ /dev/null @@ -1,7 +0,0 @@ -# This change from the default is for running Ceedling out of another folder. -PROJECT_CEEDLING_ROOT = "../../../.." -load "#{PROJECT_CEEDLING_ROOT}/lib/ceedling.rb" - -Ceedling.load_project - -task :default => %w[ test:all release ] diff --git a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/bar.c b/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/bar.c deleted file mode 100755 index 6a403234..00000000 --- a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/bar.c +++ /dev/null @@ -1 +0,0 @@ -#include "bar.h" diff --git a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/bar.h b/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/bar.h deleted file mode 100755 index febc5865..00000000 --- a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/bar.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef bar_H -#define bar_H - -#include "custom_types.h" - -void bar_turn_on(void); -void bar_print_message(const char * message); -void bar_print_message_formatted(const char * format, ...); -void bar_numbers(int one, int two, char three); -void bar_const_test(const char * a, char * const b, const int c); -custom_t bar_needs_custom_type(void); -const char * bar_return_const_ptr(int one); - -#endif // bar_H diff --git a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/custom_types.h b/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/custom_types.h deleted file mode 100755 index b426b32c..00000000 --- a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/custom_types.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef custom_types_H -#define custom_types_H - -typedef int custom_t; - -#endif diff --git a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/display.c b/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/display.c deleted file mode 100755 index 2f03449b..00000000 --- a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/display.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <stdio.h> -#include "display.h" - -void display_turnOffStatusLed(void) -{ - printf("Display: Status LED off"); -}
\ No newline at end of file diff --git a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/display.h b/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/display.h deleted file mode 100755 index def29960..00000000 --- a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/display.h +++ /dev/null @@ -1,16 +0,0 @@ -#include <stdbool.h> - -void display_turnOffStatusLed(void); -void display_turnOnStatusLed(void); -void display_setVolume(int level); -void display_setModeToMinimum(void); -void display_setModeToMaximum(void); -void display_setModeToAverage(void); -bool display_isError(void); -void display_powerDown(void); -void display_updateData(int data, void(*updateCompleteCallback)(void)); - -/* - The entry is returned (up to `length` bytes) in the provided `entry` buffer. -*/ -void display_getKeyboardEntry(char * entry, int length); diff --git a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/event_processor.c b/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/event_processor.c deleted file mode 100755 index 916a9236..00000000 --- a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/event_processor.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - This module implements some business logic to test. - - Signal events by calling the functions on the module. -*/ - -#include <stdio.h> -#include <string.h> -#include "event_processor.h" -#include "display.h" - -void event_deviceReset(void) -{ - //printf ("Device reset\n"); - display_turnOffStatusLed(); -} - -void event_volumeKnobMaxed(void) -{ - display_setVolume(11); -} - -void event_powerReadingUpdate(int powerReading) -{ - if (powerReading >= 5) - { - display_turnOnStatusLed(); - } -} - -void event_modeSelectButtonPressed(void) -{ - static int mode = 0; - - if (mode == 0) - { - display_setModeToMinimum(); - mode++; - } - else if (mode == 1) - { - display_setModeToMaximum(); - mode++; - } - else if (mode == 2) - { - display_setModeToAverage(); - mode++; - } - else - { - mode = 0; - } -} - -void event_devicePoweredOn(void) -{ - if (display_isError()) - { - display_powerDown(); - } -} - -void event_keyboardCheckTimerExpired(void) -{ - char userEntry[100]; - - display_getKeyboardEntry(userEntry, 100); - - if (strcmp(userEntry, "sleep") == 0) - { - display_powerDown(); - } -} - -static bool event_lastComplete = false; - -/* Function called when the display update is complete. */ -static void displayUpdateComplete(void) -{ - event_lastComplete = true; -} - -void event_newDataAvailable(int data) -{ - event_lastComplete = false; - display_updateData(data, displayUpdateComplete); -} - -bool eventProcessor_isLastEventComplete(void) -{ - return event_lastComplete; -} diff --git a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/event_processor.h b/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/event_processor.h deleted file mode 100755 index a79e68c5..00000000 --- a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/event_processor.h +++ /dev/null @@ -1,11 +0,0 @@ -#include <stdbool.h> - -void event_deviceReset(void); -void event_volumeKnobMaxed(void); -void event_powerReadingUpdate(int powerReading); -void event_modeSelectButtonPressed(void); -void event_devicePoweredOn(void); -void event_keyboardCheckTimerExpired(void); -void event_newDataAvailable(int data); - -bool eventProcessor_isLastEventComplete(void); diff --git a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/foo.c b/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/foo.c deleted file mode 100755 index c05b1154..00000000 --- a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/foo.c +++ /dev/null @@ -1,16 +0,0 @@ -#include "foo.h" -#include "bar.h" -#include "subfolder/zzz.h" - -void foo_turn_on(void) { - bar_turn_on(); - zzz_sleep(1, "sleepy"); -} - -void foo_print_message(const char * message) { - bar_print_message(message); -} - -void foo_print_special_message(void) { - bar_print_message_formatted("The numbers are %d, %d and %d", 1, 2, 3); -} diff --git a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/foo.h b/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/foo.h deleted file mode 100755 index 3fea6994..00000000 --- a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/foo.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef foo_H -#define foo_H - -void foo_turn_on(void); -void foo_print_message(const char * message); -void foo_print_special_message(void); - -#endif // foo_H diff --git a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/subfolder/zzz.c b/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/subfolder/zzz.c deleted file mode 100755 index 85f370e1..00000000 --- a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/subfolder/zzz.c +++ /dev/null @@ -1 +0,0 @@ -#include "zzz.h" diff --git a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/subfolder/zzz.h b/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/subfolder/zzz.h deleted file mode 100755 index 32c52940..00000000 --- a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/src/subfolder/zzz.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef zzz_H -#define zzz_H - -int zzz_sleep(int time, char * name); - -#endif // zzz_H diff --git a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/test/test_event_processor.c b/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/test/test_event_processor.c deleted file mode 100755 index 9f999443..00000000 --- a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/test/test_event_processor.c +++ /dev/null @@ -1,155 +0,0 @@ -#include "unity.h" -#include "event_processor.h" -#include "mock_display.h" -#include <string.h> - -void setUp (void) -{ -} - -void tearDown (void) -{ -} -/* - Test that a single function was called. -*/ -void -test_whenTheDeviceIsReset_thenTheStatusLedIsTurnedOff() -{ - // When - event_deviceReset(); - - // Then - TEST_ASSERT_EQUAL(1, display_turnOffStatusLed_fake.call_count); - // or use the helper macro... - TEST_ASSERT_CALLED(display_turnOffStatusLed); -} - -/* - Test that a single function is NOT called. -*/ -void -test_whenThePowerReadingIsLessThan5_thenTheStatusLedIsNotTurnedOn(void) -{ - // When - event_powerReadingUpdate(4); - - // Then - TEST_ASSERT_EQUAL(0, display_turnOnStatusLed_fake.call_count); - // or use the helper macro... - TEST_ASSERT_NOT_CALLED(display_turnOffStatusLed); -} - -/* - Test that a single function was called with the correct arugment. -*/ -void -test_whenTheVolumeKnobIsMaxed_thenVolumeDisplayIsSetTo11(void) -{ - // When - event_volumeKnobMaxed(); - - // Then - TEST_ASSERT_EQUAL(1, display_setVolume_fake.call_count); - // or use the helper macro... - TEST_ASSERT_CALLED(display_setVolume); - TEST_ASSERT_EQUAL(11, display_setVolume_fake.arg0_val); -} - -/* - Test a sequence of calls. -*/ - -void -test_whenTheModeSelectButtonIsPressed_thenTheDisplayModeIsCycled(void) -{ - // When - event_modeSelectButtonPressed(); - event_modeSelectButtonPressed(); - event_modeSelectButtonPressed(); - - // Then - TEST_ASSERT_EQUAL_PTR((void *)display_setModeToMinimum, fff.call_history[0]); - TEST_ASSERT_EQUAL_PTR((void *)display_setModeToMaximum, fff.call_history[1]); - TEST_ASSERT_EQUAL_PTR((void *)display_setModeToAverage, fff.call_history[2]); - // or use the helper macros... - TEST_ASSERT_CALLED_IN_ORDER(0, display_setModeToMinimum); - TEST_ASSERT_CALLED_IN_ORDER(1, display_setModeToMaximum); - TEST_ASSERT_CALLED_IN_ORDER(2, display_setModeToAverage); -} - -/* - Mock a return value from a function. -*/ -void -test_givenTheDisplayHasAnError_whenTheDeviceIsPoweredOn_thenTheDisplayIsPoweredDown(void) -{ - // Given - display_isError_fake.return_val = true; - - // When - event_devicePoweredOn(); - - // Then - TEST_ASSERT_EQUAL(1, display_powerDown_fake.call_count); - // or use the helper macro... - TEST_ASSERT_CALLED(display_powerDown); -} - -/* - Mock a sequence of calls with return values. -*/ - -/* - Mocking a function with a value returned by reference. -*/ -void -test_givenTheUserHasTypedSleep_whenItIsTimeToCheckTheKeyboard_theDisplayIsPoweredDown(void) -{ - // Given - char mockedEntry[] = "sleep"; - void return_mock_value(char * entry, int length) - { - if (length > strlen(mockedEntry)) - { - strncpy(entry, mockedEntry, length); - } - } - display_getKeyboardEntry_fake.custom_fake = return_mock_value; - - // When - event_keyboardCheckTimerExpired(); - - // Then - TEST_ASSERT_EQUAL(1, display_powerDown_fake.call_count); - // or use the helper macro... - TEST_ASSERT_CALLED(display_powerDown); -} - -/* - Mock a function with a function pointer parameter. -*/ -void -test_givenNewDataIsAvailable_whenTheDisplayHasUpdated_thenTheEventIsComplete(void) -{ - // A mock function for capturing the callback handler function pointer. - void(*registeredCallback)(void) = 0; - void mock_display_updateData(int data, void(*callback)(void)) - { - //Save the callback function. - registeredCallback = callback; - } - display_updateData_fake.custom_fake = mock_display_updateData; - - // Given - event_newDataAvailable(10); - - // When - if (registeredCallback != 0) - { - registeredCallback(); - } - - // Then - TEST_ASSERT_EQUAL(true, eventProcessor_isLastEventComplete()); -} diff --git a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/test/test_foo.c b/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/test/test_foo.c deleted file mode 100755 index 12dd61a1..00000000 --- a/tinyusb/test/vendor/ceedling/plugins/fake_function_framework/examples/fff_example/test/test_foo.c +++ /dev/null @@ -1,47 +0,0 @@ -#include "unity.h" -#include "foo.h" -#include "mock_bar.h" -#include "mock_zzz.h" - -void setUp(void) -{ -} - -void tearDown(void) -{ -} - -void test_foo(void) -{ - //When - foo_turn_on(); - - //Then - TEST_ASSERT_EQUAL(1, bar_turn_on_fake.call_count); - TEST_ASSERT_EQUAL(1, zzz_sleep_fake.call_count); - TEST_ASSERT_EQUAL_STRING("sleepy", zzz_sleep_fake.arg1_val); -} - -void test_foo_again(void) -{ - //When - foo_turn_on(); - - //Then - TEST_ASSERT_EQUAL(1, bar_turn_on_fake.call_count); -} - -void test_foo_mock_with_const(void) -{ - foo_print_message("123"); - - TEST_ASSERT_EQUAL(1, bar_print_message_fake.call_count); - TEST_ASSERT_EQUAL_STRING("123", bar_print_message_fake.arg0_val); -} - -void test_foo_mock_with_variable_args(void) -{ - foo_print_special_message(); - TEST_ASSERT_EQUAL(1, bar_print_message_formatted_fake.call_count); - TEST_ASSERT_EQUAL_STRING("The numbers are %d, %d and %d", bar_print_message_formatted_fake.arg0_val); -} |