32 #include <gtest/gtest.h> 36 #define OMAGIC_STRUCT (*((const aout_exechdr *)omagic)) 37 #define NMAGIC_STRUCT (*((const aout_exechdr *)nmagic)) 38 #define ZMAGIC_STRUCT (*((const aout_exechdr *)zmagic)) 39 #define NO_MAGIC_STRUCT (*((const aout_exechdr *)no_magic)) 41 #if (defined(_BIG_ENDIAN) || !defined(_LITTLE_ENDIAN))\ 42 && BYTE_ORDER==BIG_ENDIAN 44 0x01, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
45 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
46 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
47 0x00, 0x00, 0x00, 0x00, 0x00
51 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
52 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
53 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
54 0x00, 0x00, 0x00, 0x00, 0x00
58 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
59 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
60 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
61 0x00, 0x00, 0x00, 0x00, 0x00
65 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
66 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
67 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
68 0x00, 0x00, 0x00, 0x01, 0x00
70 #elif defined(_LITTLE_ENDIAN) || BYTE_ORDER==LITTLE_ENDIAN 72 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
73 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
74 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
75 0x00, 0x00, 0x00, 0x00, 0x00
79 0x08, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
80 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
81 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
82 0x00, 0x00, 0x00, 0x00, 0x00
86 0x0B, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
87 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
88 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
89 0x00, 0x00, 0x00, 0x00, 0x00
93 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
94 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
95 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
96 0x00, 0x00, 0x00, 0x00, 0x01
99 #error Invalid Endianess 102 TEST(ExecAoutTest, IsNotBadMagicNumber)
109 TEST(ExecAoutTest, IsBadMagicNumber)
114 TEST(ExecAoutTest, AlignNotZmagic)
126 TEST(ExecAoutTest, AlignIsZmagic)
132 int64_t
x = (1 << 20) + (1 << 18) + (1 << 12) + (1 << 5) + 1;
136 TEST(ExecAoutTest, AlignIsZmagicNoRounding)
141 int64_t
x = (1 << 20) + (1 << 18) + (1 << 13);
TEST(ExecAoutTest, IsNotBadMagicNumber)
#define EXPECT_TRUE(expr)
A macro which verifies that expr evaluates to true.
#define EXPECT_FALSE(expr)
A macro which verifies that expr evaluates to false.
#define EXPECT_EQ(lhs, rhs)
A macro which verifies that lhs and rhs are equal to each other.