Compare commits

..

No commits in common. "5e8b1b73c769ab7f012c2ee322c7f3f2d09e0608" and "e41263adf0868e2e4ae8646ee1b006eb864dd95b" have entirely different histories.

View File

@ -21,7 +21,6 @@
#include <u.h>
#include <libc.h>
#include <stdio.h>
#include "../9unit.h"
#include "util.h"
@ -30,15 +29,6 @@
// Local Prototypes
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
@ -47,7 +37,6 @@ test_append_test_log(TestState *s)
{
print("append_test_log()\n");
append_to_empty(s);
append_to_existing(s);
}
// Local Functions
@ -88,76 +77,4 @@ append_to_empty(TestState *s)
);
}
static void
append_to_existing(TestState *s)
{
TestState test;
TestLogEntry first, second;
print("\tappend to existing\n");
// build initial state/log
mk_sample_state(&test);
first.text = "foo";
first.next = &second;
second.text = "bar";
second.next = 0;
test.first_log = &first;
test.last_log = &second;
append_test_log(&test, "baz");
// first shouldn't change
print("\t\tfirst_log\n");
chk_ptr_eq(
s,
"ERROR: append_test_log(): first_log:",
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