Fix tests
This commit is contained in:
2023-11-28 13:44:34 +01:00
parent f67a0b48a7
commit 9cd69dc6f8
3 changed files with 41 additions and 11 deletions

View File

@@ -15,17 +15,43 @@ uint32_t logger_get_timestamp(void) {
} }
int tftp_init(struct tftp_context* context) { int tftp_init(struct tftp_context* context) {
UNUSED(context);
return 0; return 0;
} }
void lcd_display_text(uint8_t* text, uint16_t x_pos, uint16_t y_pos, uint32_t color, uint32_t bg_color, sFONT *font) { void lcd_display_text(uint8_t* text, uint16_t x_pos, uint16_t y_pos, uint32_t color, uint32_t bg_color, sFONT *font) {
UNUSED(text);
UNUSED(x_pos);
UNUSED(y_pos);
UNUSED(color);
UNUSED(bg_color);
UNUSED(font);
}
void lcd_clear_images(void) {
} }
void lcd_clear(uint32_t color) { void lcd_clear_text(void) {
} }
void lcd_draw_bmp_img(uint8_t* bmp_buff, uint32_t x_pos, uint32_t y_pos) { void lcd_draw_bmp_img(uint8_t* bmp_buff, uint32_t x_pos, uint32_t y_pos) {
UNUSED(bmp_buff);
UNUSED(x_pos);
UNUSED(y_pos);
}
void lcd_draw_gif(uint8_t* gif_buff, size_t len, uint32_t x_pos, uint32_t y_pos) {
UNUSED(gif_buff);
UNUSED(len);
UNUSED(x_pos);
UNUSED(y_pos);
}
llfs_file_t* llfs_next_file(void** mem, char* filter) {
UNUSED(mem);
UNUSED(filter);
return NULL;
} }

View File

@@ -10,21 +10,21 @@ tftp_custom_file_t file = {
.data = (char*)"1234567890", .data = (char*)"1234567890",
.len = 11, .len = 11,
.name = (char*)"test.txt", .name = (char*)"test.txt",
.ofset = 0 .offset = 0
}; };
tftp_custom_file_t write_file = { tftp_custom_file_t write_file = {
.data = NULL, .data = NULL,
.len = 0, .len = 0,
.name = (char*)"test.txt", .name = (char*)"test.txt",
.ofset = 0 .offset = 0
}; };
TEST(TFTP, custom_fseek) TEST(TFTP, custom_fseek)
{ {
tftp_custom_fseek(&file, 5, SEEK_SET); tftp_custom_fseek(&file, 5, SEEK_SET);
EXPECT_EQ(file.ofset, 5); EXPECT_EQ(file.offset, 5);
tftp_custom_fseek(&file, 5, SEEK_CUR); tftp_custom_fseek(&file, 5, SEEK_CUR);
EXPECT_EQ(file.ofset, 10); EXPECT_EQ(file.offset, 10);
} }
TEST(TFTP, custom_fread) TEST(TFTP, custom_fread)
@@ -33,7 +33,7 @@ TEST(TFTP, custom_fread)
tftp_custom_fseek(&file, 0, SEEK_SET); tftp_custom_fseek(&file, 0, SEEK_SET);
size_t bytes = tftp_custom_fread(buf, 11, &file); size_t bytes = tftp_custom_fread(buf, 11, &file);
EXPECT_EQ(bytes, 11); EXPECT_EQ(bytes, 11);
EXPECT_EQ(file.ofset, 11); EXPECT_EQ(file.offset, 11);
EXPECT_EQ(memcmp(buf, "1234567890", 10), 0); EXPECT_EQ(memcmp(buf, "1234567890", 10), 0);
memset(buf, 0, 11); memset(buf, 0, 11);
@@ -61,12 +61,12 @@ TEST(TFTP, custom_fwrite) {
write_file.data = (char*)malloc(21 * sizeof(char)); write_file.data = (char*)malloc(21 * sizeof(char));
write_file.len = 21; write_file.len = 21;
tftp_custom_fwrite("0987654321", 10, &write_file); tftp_custom_fwrite("0987654321", 10, &write_file);
EXPECT_EQ(write_file.ofset, 10); EXPECT_EQ(write_file.offset, 10);
EXPECT_EQ(write_file.len, 21); EXPECT_EQ(write_file.len, 21);
EXPECT_EQ(memcmp(write_file.data, "0987654321", 10), 0); EXPECT_EQ(memcmp(write_file.data, "0987654321", 10), 0);
tftp_custom_fwrite("1234567890", 10, &write_file); tftp_custom_fwrite("1234567890", 10, &write_file);
EXPECT_EQ(write_file.ofset, 20); EXPECT_EQ(write_file.offset, 20);
EXPECT_EQ(write_file.len, 21); EXPECT_EQ(write_file.len, 21);
EXPECT_EQ(memcmp(write_file.data, "09876543211234567890", 20), 0); EXPECT_EQ(memcmp(write_file.data, "09876543211234567890", 20), 0);

View File

@@ -23,6 +23,7 @@ typedef void sFONT;
#define ERR_OK 0 #define ERR_OK 0
#define LCD_COLOR_BLACK 0 #define LCD_COLOR_BLACK 0
#define LCD_COLOR_WHITE 1 #define LCD_COLOR_WHITE 1
#define LCD_TRANSPARENT 2
#define LCD_FONT16 0 #define LCD_FONT16 0
@@ -38,7 +39,10 @@ uint32_t logger_get_timestamp(void);
int tftp_init(struct tftp_context* context); int tftp_init(struct tftp_context* context);
void lcd_display_text(uint8_t* text, uint16_t x_pos, uint16_t y_pos, uint32_t color, uint32_t bg_color, sFONT *font); void lcd_display_text(uint8_t* text, uint16_t x_pos, uint16_t y_pos, uint32_t color, uint32_t bg_color, sFONT *font);
void lcd_draw_bmp_img(uint8_t* bmp_buff, uint32_t x_pos, uint32_t y_pos); void lcd_draw_bmp_img(uint8_t* bmp_buff, uint32_t x_pos, uint32_t y_pos);
void lcd_clear(uint32_t color); void lcd_draw_gif(uint8_t* gif_buff, size_t len, uint32_t x_pos, uint32_t y_pos);
void lcd_clear_images(void);
void lcd_clear_text(void);
#ifdef __cplusplus #ifdef __cplusplus
} }