mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
r14185@tombo: nickm | 2008-02-15 18:05:54 -0500
Replace the hefty tor_strpartition with a simple function to replace its only (trivial) use. svn:r13532
This commit is contained in:
+11
-4
@@ -624,6 +624,17 @@ test_crypto(void)
|
||||
tor_free(data1);
|
||||
tor_free(data2);
|
||||
tor_free(data3);
|
||||
|
||||
/* Add spaces to fingerprint */
|
||||
{
|
||||
data1 = tor_strdup("ABCD1234ABCD56780000ABCD1234ABCD56780000");
|
||||
test_eq(strlen(data1), 40);
|
||||
data2 = tor_malloc(FINGERPRINT_LEN+1);
|
||||
add_spaces_to_fp(data2, FINGERPRINT_LEN+1, data1);
|
||||
test_streq(data2, "ABCD 1234 ABCD 5678 0000 ABCD 1234 ABCD 5678 0000");
|
||||
tor_free(data1);
|
||||
tor_free(data2);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -758,10 +769,6 @@ test_util(void)
|
||||
test_eq(5, tor_strstrip(buf, "!? "));
|
||||
test_streq(buf, "Testing123");
|
||||
|
||||
/* Test tor_strpartition() */
|
||||
test_assert(! tor_strpartition(buf, sizeof(buf), "abcdefghi", "##", 3));
|
||||
test_streq(buf, "abc##def##ghi");
|
||||
|
||||
/* Test parse_addr_port */
|
||||
cp = NULL; u32 = 3; u16 = 3;
|
||||
test_assert(!parse_addr_port(LOG_WARN, "1.2.3.4", &cp, &u32, &u16));
|
||||
|
||||
Reference in New Issue
Block a user