mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-10-28 11:55:23 +03:00
test-alloc-util: add a "test" for bool casts
Just in case ;) There is no good place, test-alloc-util.c is as good as any, and it's quite short so far, so let's add this there.
This commit is contained in:
parent
3b253ad689
commit
37e744e866
@ -57,9 +57,26 @@ static void test_memdup_multiply_and_greedy_realloc(void) {
|
||||
assert_se(p[i] == 0);
|
||||
}
|
||||
|
||||
static void test_bool_assign(void) {
|
||||
bool b, c, *cp = &c, d, e, f;
|
||||
|
||||
b = 123;
|
||||
*cp = -11;
|
||||
d = 0xF & 0xFF;
|
||||
e = b & d;
|
||||
f = 0x0;
|
||||
|
||||
assert(b);
|
||||
assert(c);
|
||||
assert(d);
|
||||
assert(e);
|
||||
assert(!f);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
test_alloca();
|
||||
test_memdup_multiply_and_greedy_realloc();
|
||||
test_bool_assign();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user