diff --git a/.github/workflows/run_lcd_hd44780_test .yml b/.github/workflows/run_lcd_hd44780_test .yml index 66ec955..d6bd2de 100644 --- a/.github/workflows/run_lcd_hd44780_test .yml +++ b/.github/workflows/run_lcd_hd44780_test .yml @@ -7,7 +7,7 @@ on: pull_request: branches: [main, develop] jobs: - template_test_running: + LCD_HD44780_test_running_win: name: LCD HD44780 Test RUN runs-on: windows-latest # strategy: @@ -29,14 +29,71 @@ jobs: cmake -Bout -GNinja cmake --build out - - name: List files - working-directory: test/lcd_hd44780/out - run: dir + # - name: List files + # working-directory: test/lcd_hd44780/out + # run: dir - name: Run LCD HD44780 tests working-directory: test/lcd_hd44780/out run: ./lcd_hd44780_test.exe -v + LCD_HD44780_AVR_test_running_win: + name: LCD HD44780 AVR Test RUN + runs-on: windows-latest + steps: + - name: Checkout code + uses: actions/checkout@v4.0.0 + with: + submodules: recursive + + - name: Install Ninja + uses: seanmiddleditch/gha-setup-ninja@v3 + + - name: Build binary + working-directory: test/lcd_hd44780 + run: | + mkdir out_avr + cmake -S ./avr_code_test -B out_avr -GNinja + cmake --build out_avr + + # - name: List files + # working-directory: test/lcd_hd44780/out + # run: dir + + - name: Run LCD HD44780 tests + working-directory: test/lcd_hd44780/out_avr + run: ./lcd_hd44780_test.exe -v + + LCD_HD44780_test_running_ubuntu: + name: LCD HD44780 Test RUN Ubuntu + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4.0.0 + with: + submodules: recursive + + - name: Install Ninja + uses: seanmiddleditch/gha-setup-ninja@v3 + + - name: Build binary + working-directory: test/lcd_hd44780 + run: | + mkdir out + cmake -Bout -GNinja + cmake --build out + + # - name: List files + # working-directory: test/lcd_hd44780/out + # run: dir + + - name: Run LCD HD44780 tests + working-directory: test/lcd_hd44780/out + run: ./lcd_hd44780_test -v + + + + # template_2_test_running: # name: template_2 Test RUN # runs-on: windows-latest diff --git a/.gitignore b/.gitignore index e49b04c..a81b62c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ out/ +out_avr/ Release/ Debug/ Build/ diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 859fa32..e876618 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -92,9 +92,10 @@ "--force" , "--inline-suppr", // "--output-file=reports/cppcheck.out", // this will print out report instead of printing problems in terminal - // "--platform=win64", + "--platform=win64", "--suppress=missingInclude", - //"--suppress=unusedFunction", + "--suppress=missingIncludeSystem", + "--suppress=unusedFunction", ], "options": { "cwd": "${workspaceFolder}" diff --git a/src/lcd_hd44780.c b/src/lcd_hd44780.c index 7df291f..f14b883 100644 --- a/src/lcd_hd44780.c +++ b/src/lcd_hd44780.c @@ -99,16 +99,7 @@ static void lcd_hex_AVR(int val, uint8_t width, enum alignment alignment); static void lcd_bin_AVR(int val, uint8_t width); #else static void fill_bin_value_buffer(int val, char *bin_val_buffer); -static void fill_zeros_buffer(char *buffer, uint8_t width, char *zeros_buf); -#endif -#ifdef AVR -static void lcd_put_spaces(uint8_t empty_spaces); -static void lcd_int_AVR(int val, uint8_t width, enum alignment alignment); -static void lcd_hex_AVR(int val, uint8_t width, enum alignment alignment); -static void lcd_bin_AVR(int val, uint8_t width); -#else -static void fill_bin_value_buffer(int val, char *bin_val_buffer); -static void fill_zeros_buffer(char *buffer, uint8_t width, char *zeros_buf); +static void fill_zeros_buffer(const char *buffer, uint8_t width, char *zeros_buf); #endif static void register_LCD_IO_driver(void) @@ -116,8 +107,7 @@ static void register_LCD_IO_driver(void) LCD = LCD_IO_driver_interface_get(); } -static void lcd_set_all_SIG(void) -{ +static void lcd_set_all_SIG(void){ LCD->set_SIG(LCD_E); LCD->set_SIG(LCD_RS); #if USE_RW_PIN == ON @@ -304,7 +294,7 @@ static void fill_bin_value_buffer(int val, char *bin_val_buffer) bit_mask = bit_mask >> 1; } } -static void fill_zeros_buffer(char *buffer, uint8_t width, char *zeros_buf) +static void fill_zeros_buffer(const char *buffer, uint8_t width, char *zeros_buf) { if (strlen(buffer) < (width + VAL_PREFIX_LENGHT)) { diff --git a/test/lcd_hd44780/avr_code_test/CMakeLists.txt b/test/lcd_hd44780/avr_code_test/CMakeLists.txt new file mode 100644 index 0000000..983f1fa --- /dev/null +++ b/test/lcd_hd44780/avr_code_test/CMakeLists.txt @@ -0,0 +1,43 @@ +cmake_minimum_required(VERSION 3.10) + +project(lcd_hd44780_test C) + +add_subdirectory(../../unity unity) + +set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") + +set(INCLUDE_DIRS + ../../../src +) + +set(TEST_INCLUDE_DIRS + ../.. + ../. +) + +set(SRCS + ../../../src/lcd_hd44780.c +) + +set(TEST_SRCS + ../lcd_hd44780_test_main.c + ../lcd_hd44780_test_runner.c + ../lcd_hd44780_test_init.c + ../mock_LCD_IO_driver.c + ../lcd_hd44780_test_basic_func.c + ../lcd_hd44780_test_common.c + #mock_module.c +) + +set(GLOBAL_DEFINES + -DAVR +) + +include_directories(${INCLUDE_DIRS} ${TEST_INCLUDE_DIRS}) +add_definitions(${GLOBAL_DEFINES}) + +link_libraries(unity) +add_executable(${PROJECT_NAME} ${SRCS} ${TEST_SRCS}) + +target_compile_options(${PROJECT_NAME} PRIVATE -fprofile-arcs -ftest-coverage) +target_link_options(${PROJECT_NAME} PRIVATE -fprofile-arcs) \ No newline at end of file