2022-01-13 08:50:51 -05:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
|
|
|
|
#define __USE_POSIX2
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2022-01-13 09:55:24 -05:00
|
|
|
// static const char output1[] = "";
|
|
|
|
|
|
|
|
// TODO: add more tags
|
|
|
|
static const char output2[] =
|
|
|
|
"Multiboot 2 header\n"
|
|
|
|
" magic: 920085129\n"
|
|
|
|
" arch: 1\n"
|
2022-01-13 23:17:11 -05:00
|
|
|
" size: 144\n"
|
|
|
|
" checksum: 3374882022\n"
|
2022-01-13 23:10:41 -05:00
|
|
|
"Multiboot 2 header tag\n"
|
|
|
|
" type: 1 (information request)\n"
|
|
|
|
" flags: 0\n"
|
|
|
|
" size: 96\n"
|
2022-01-13 09:55:24 -05:00
|
|
|
"Multiboot 2 header tag\n"
|
2022-01-13 23:17:11 -05:00
|
|
|
" type: 2 (address)\n"
|
|
|
|
" flags: 0\n"
|
|
|
|
" size: 24\n"
|
|
|
|
"Multiboot 2 header tag\n"
|
2022-01-13 09:55:24 -05:00
|
|
|
" type: 0 (none)\n"
|
|
|
|
" flags: 0\n"
|
|
|
|
" size: 8\n";
|
2022-01-13 08:50:51 -05:00
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
2022-01-13 09:55:24 -05:00
|
|
|
/*
|
2022-01-13 08:50:51 -05:00
|
|
|
{
|
|
|
|
FILE *const fd = popen("tests/multiboot2_header_print1", "r");
|
|
|
|
assert(fd != NULL);
|
|
|
|
|
|
|
|
for (const char *ch = output1; *ch; ++ch) {
|
|
|
|
assert(fgetc(fd) == *ch);
|
|
|
|
}
|
|
|
|
|
|
|
|
const int status = pclose(fd);
|
|
|
|
assert(status == 0);
|
|
|
|
}
|
2022-01-13 09:55:24 -05:00
|
|
|
*/
|
2022-01-13 08:50:51 -05:00
|
|
|
|
|
|
|
{
|
|
|
|
FILE *const fd = popen("tests/multiboot2_header_print2", "r");
|
|
|
|
assert(fd != NULL);
|
|
|
|
|
|
|
|
for (const char *ch = output2; *ch; ++ch) {
|
|
|
|
assert(fgetc(fd) == *ch);
|
|
|
|
}
|
|
|
|
|
|
|
|
const int status = pclose(fd);
|
|
|
|
assert(status == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|