Add some tests for Multiboot 2 tag validation functions

This commit is contained in:
Alex Kotov 2020-11-28 03:58:20 +05:00
parent 9a18e7e2dd
commit 799f62269d
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
1 changed files with 60 additions and 0 deletions

View File

@ -421,6 +421,52 @@ static const struct {
},
};
/***************
* Tag_VBEInfo *
***************/
static const struct KernAux_Multiboot2_Tag_VBEInfo
tag_vbe_info_valid = {
.base = {
.type = KERNAUX_MULTIBOOT2_TAGTYPE_VBE_INFO,
.size = 784,
},
.vbe_mode = 123,
.vbe_interface_seg = 456,
.vbe_interface_off = 789,
.vbe_interface_len = 123,
.vbe_control_info = {0, 0, 0},
.vbe_mode_info = {0, 0, 0},
};
static const struct KernAux_Multiboot2_Tag_VBEInfo
tag_vbe_info_invalid_type = {
.base = {
.type = KERNAUX_MULTIBOOT2_TAGTYPE_NONE,
.size = 784,
},
.vbe_mode = 123,
.vbe_interface_seg = 456,
.vbe_interface_off = 789,
.vbe_interface_len = 123,
.vbe_control_info = {0, 0, 0},
.vbe_mode_info = {0, 0, 0},
};
static const struct KernAux_Multiboot2_Tag_VBEInfo
tag_vbe_info_invalid_size = {
.base = {
.type = KERNAUX_MULTIBOOT2_TAGTYPE_VBE_INFO,
.size = 784 + 1,
},
.vbe_mode = 123,
.vbe_interface_seg = 456,
.vbe_interface_off = 789,
.vbe_interface_len = 123,
.vbe_control_info = {0, 0, 0},
.vbe_mode_info = {0, 0, 0},
};
/********
* main *
********/
@ -557,5 +603,19 @@ int main()
&tag_memory_map_with_some_large_data_items_invalid_size.tag
));
// Tag_VBEInfo
assert(KernAux_Multiboot2_Tag_VBEInfo_is_valid(
&tag_vbe_info_valid
));
assert(!KernAux_Multiboot2_Tag_VBEInfo_is_valid(
&tag_vbe_info_invalid_type
));
assert(!KernAux_Multiboot2_Tag_VBEInfo_is_valid(
&tag_vbe_info_invalid_size
));
return 0;
}