diff options
author | Nick Mathewson <nickm@torproject.org> | 2004-10-07 21:37:06 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2004-10-07 21:37:06 +0000 |
commit | 6c970aec946942d10996cda55798859dbc90f105 (patch) | |
tree | 90681cc5e09b7454250d5c79bb336bebc89c9563 /src/or/test.c | |
parent | c7e8c2098abd93bf24439f869016c385067e5e5b (diff) | |
download | tor-6c970aec946942d10996cda55798859dbc90f105.tar.gz tor-6c970aec946942d10996cda55798859dbc90f105.zip |
Turn tor_strpartion into a swiss-army-knife function, so it can terminate or not-terminate appropriately.
svn:r2429
Diffstat (limited to 'src/or/test.c')
-rw-r--r-- | src/or/test.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/or/test.c b/src/or/test.c index ed89df1f3f..8b4917f381 100644 --- a/src/or/test.c +++ b/src/or/test.c @@ -620,10 +620,18 @@ test_util() { test_streq(buf, "Testing123"); /* Test tor_strpartition() */ - test_assert(! tor_strpartition(buf, sizeof(buf), "abcdefg", "##", 3)); + test_assert(! tor_strpartition(buf, sizeof(buf), "abcdefg", "##", 3, + TERMINATE_IF_EVEN)); test_streq(buf, "abc##def##g"); - test_assert(! tor_strpartition(buf, sizeof(buf), "abcdefghi", "##", 3)); + test_assert(! tor_strpartition(buf, sizeof(buf), "abcdefg", "##", 3, + ALWAYS_TERMINATE)); + test_streq(buf, "abc##def##g##"); + test_assert(! tor_strpartition(buf, sizeof(buf), "abcdefghi", "##", 3, + TERMINATE_IF_EVEN)); test_streq(buf, "abc##def##ghi##"); + test_assert(! tor_strpartition(buf, sizeof(buf), "abcdefghi", "##", 3, + NEVER_TERMINATE)); + test_streq(buf, "abc##def##ghi"); /* XXXX test older functions. */ smartlist_free(sl); @@ -915,7 +923,7 @@ test_dir_format() strcat(buf2, "\n" "published 1970-01-01 00:00:00\n" "opt fingerprint "); - crypto_pk_get_fingerprint(pk2, fingerprint, 1); + test_assert(!crypto_pk_get_fingerprint(pk2, fingerprint, 1)); strcat(buf2, fingerprint); strcat(buf2, "\nopt uptime 0\n" /* XXX the "0" above is hardcoded, but even if we made it reflect |