1
0
Fork 0
mirror of https://github.com/tailix/libkernaux.git synced 2024-11-13 11:04:27 -05:00

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

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;
}