1
0
Fork 0
mirror of https://github.com/tailix/libkernaux.git synced 2025-02-17 15:45:32 -05:00

Add example

This commit is contained in:
Alex Kotov 2022-01-14 11:35:20 +05:00
parent afe3556467
commit 377ba05c95
2 changed files with 18 additions and 9 deletions

View file

@ -1 +1,15 @@
static const uint8_t multiboot2_header_example1[1] = { 0 }; // TODO: do we really need this?
static const uint8_t multiboot2_header_example1[] = {
214, 80, 82, 232, 0, 0, 0, 0, 16, 1, 0, 0, 26, 174, 173, 23, 1, 0, 0, 0, 96,
0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 4, 0, 0, 0, 5, 0,
0, 0, 6, 0, 0, 0, 7, 0, 0, 0, 8, 0, 0, 0, 9, 0, 0, 0, 10, 0, 0, 0, 11, 0, 0,
0, 12, 0, 0, 0, 13, 0, 0, 0, 14, 0, 0, 0, 15, 0, 0, 0, 16, 0, 0, 0, 17, 0,
0, 0, 18, 0, 0, 0, 19, 0, 0, 0, 20, 0, 0, 0, 21, 0, 0, 0, 2, 0, 0, 0, 24, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 12, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 12, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0,
5, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6,
0, 0, 0, 8, 0, 0, 0, 7, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 12, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0,
0, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
8, 0, 0, 0,
};

View file

@ -7,10 +7,7 @@
#define __USE_POSIX2 #define __USE_POSIX2
#include <stdio.h> #include <stdio.h>
// static const char output1[] = ""; static const char output[] =
// TODO: add more tags
static const char output2[] =
"Multiboot 2 header\n" "Multiboot 2 header\n"
" magic: 3897708758\n" " magic: 3897708758\n"
" arch: 0 (i386)\n" " arch: 0 (i386)\n"
@ -63,25 +60,23 @@ static const char output2[] =
int main() int main()
{ {
/*
{ {
FILE *const fd = popen("tests/multiboot2_header_print1", "r"); FILE *const fd = popen("tests/multiboot2_header_print1", "r");
assert(fd != NULL); assert(fd != NULL);
for (const char *ch = output1; *ch; ++ch) { for (const char *ch = output; *ch; ++ch) {
assert(fgetc(fd) == *ch); assert(fgetc(fd) == *ch);
} }
const int status = pclose(fd); const int status = pclose(fd);
assert(status == 0); assert(status == 0);
} }
*/
{ {
FILE *const fd = popen("tests/multiboot2_header_print2", "r"); FILE *const fd = popen("tests/multiboot2_header_print2", "r");
assert(fd != NULL); assert(fd != NULL);
for (const char *ch = output2; *ch; ++ch) { for (const char *ch = output; *ch; ++ch) {
assert(fgetc(fd) == *ch); assert(fgetc(fd) == *ch);
} }