Hash :
47284d1c
Author :
Thomas de Grivel
Date :
2025-07-06T22:31:50
wip inspect
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
/* ext4fs
* Copyright 2025 kmx.io <contact@kmx.io>
*
* Permission is hereby granted to use this software granted the above
* copyright notice and this permission paragraph are included in all
* copies and substantial portions of this software.
*
* THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
* PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
* AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
* THIS SOFTWARE.
*/
#include <stdio.h>
#include <ext4fs.h>
long g_test_ko = 0;
long g_test_ok = 0;
long g_test_total = 0;
#define TEST_ASSERT(test) \
do { \
if (! (test)) { \
fprintf(stderr, "KO: %s\n", # test); \
g_test_ko++; \
g_test_total++; \
} \
else { \
g_test_ok++; \
g_test_total++; \
} \
} while (0)
#define TEST_EQ(test, expected) \
do { \
int64_t i_test = (test); \
int64_t i_expected = (expected); \
if (! ((i_test) == (i_expected))) { \
fprintf(stderr, "KO: expected %s == %ld, got %ld instead\n", \
# test, i_expected, i_test); \
g_test_ko++; \
g_test_total++; \
} \
else { \
g_test_ok++; \
g_test_total++; \
} \
} while (0)
void test_summary (void)
{
fflush(stdout);
fprintf(stderr, "OK: %ld\tKO: %ld\tTotal: %ld\n",
g_test_ok, g_test_ko, g_test_total);
fflush(stderr);
}
int main (int argc, char **argv)
{
(void) argc;
(void) argv;
TEST_EQ(offsetof(struct ext4fs_super_block, sb_mount_opts),
0x200);
TEST_EQ(offsetof(struct ext4fs_super_block, sb_orphan_file_inode),
0x280);
TEST_EQ(offsetof(struct ext4fs_super_block, sb_checksum),
0x3FC);
TEST_EQ(sizeof(struct ext4fs_super_block),
1024);
TEST_EQ(sizeof(struct ext4fs_group_desc),
64);
test_summary();
return 0;
}