make sure last_log changes, but isn't null on append
This commit is contained in:
parent
fc167d8d05
commit
5e8b1b73c7
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include <u.h>
|
||||
#include <libc.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "../9unit.h"
|
||||
#include "util.h"
|
||||
|
@ -31,6 +32,14 @@
|
|||
static void append_to_empty(TestState *);
|
||||
static void append_to_existing(TestState *);
|
||||
|
||||
static void chk_ptr_chg(
|
||||
TestState *,
|
||||
const char *,
|
||||
const char *,
|
||||
const void *,
|
||||
const void *
|
||||
);
|
||||
|
||||
// Public Functions
|
||||
|
||||
void
|
||||
|
@ -105,6 +114,50 @@ append_to_existing(TestState *s)
|
|||
test.first_log,
|
||||
&first
|
||||
);
|
||||
|
||||
// last should change
|
||||
print("\t\tlast_log\n");
|
||||
chk_ptr_chg(
|
||||
s,
|
||||
"\t\t\t",
|
||||
"ERROR: append_test_log(): last_log:",
|
||||
test.last_log,
|
||||
&second
|
||||
);
|
||||
}
|
||||
|
||||
static void
|
||||
chk_ptr_chg(
|
||||
TestState *s,
|
||||
const char *prefix,
|
||||
const char *context,
|
||||
const void *actual,
|
||||
const void *prohibited
|
||||
)
|
||||
{
|
||||
char str[STR_BUF_SIZE];
|
||||
|
||||
// make sure it's changed
|
||||
print(prefix);
|
||||
print("changed\n");
|
||||
snprintf(str, STR_BUF_SIZE, "%s changed:", context);
|
||||
chk_ptr_ne(
|
||||
s,
|
||||
str,
|
||||
actual,
|
||||
prohibited
|
||||
);
|
||||
|
||||
// make sure it's not null
|
||||
print(prefix);
|
||||
print("not null\n");
|
||||
snprintf(str, STR_BUF_SIZE, "%s not null:", context);
|
||||
chk_ptr_ne(
|
||||
s,
|
||||
str,
|
||||
actual,
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
//jl
|
||||
|
|
Loading…
Reference in New Issue
Block a user