summaryrefslogtreecommitdiff
path: root/src/or/test.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-01-19 22:47:48 +0000
committerNick Mathewson <nickm@torproject.org>2005-01-19 22:47:48 +0000
commit1eddb28f82c7b8a23b9552e8bbd460a485d0341e (patch)
treefab016ce6b73bbdac04b5a799fd18dba00914822 /src/or/test.c
parent69fa5be7b624fcda98c7d2e7e8f678f8ee592404 (diff)
downloadtor-1eddb28f82c7b8a23b9552e8bbd460a485d0341e.tar.gz
tor-1eddb28f82c7b8a23b9552e8bbd460a485d0341e.zip
Add unittests for compression detection. Make all rendezvous descriptors "plausible".
svn:r3375
Diffstat (limited to 'src/or/test.c')
-rw-r--r--src/or/test.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/or/test.c b/src/or/test.c
index c2538fb157..632968ba2a 100644
--- a/src/or/test.c
+++ b/src/or/test.c
@@ -802,11 +802,13 @@ test_gzip(void)
size_t len1, len2;
buf1 = tor_strdup("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
+ test_eq(detect_compression_method(buf1, strlen(buf1)), 0);
if (is_gzip_supported()) {
test_assert(!tor_gzip_compress(&buf2, &len1, buf1, strlen(buf1)+1,
GZIP_METHOD));
test_assert(buf2);
test_assert(!memcmp(buf2, "\037\213", 2)); /* Gzip magic. */
+ test_eq(detect_compression_method(buf2, strlen(buf1)), GZIP_METHOD);
test_assert(!tor_gzip_uncompress(&buf3, &len2, buf2, len1, GZIP_METHOD));
test_assert(buf3);
@@ -820,6 +822,7 @@ test_gzip(void)
ZLIB_METHOD));
test_assert(buf2);
test_assert(!memcmp(buf2, "\x78\xDA", 2)); /* deflate magic. */
+ test_eq(detect_compression_method(buf2, strlen(buf1)), ZLIB_METHOD);
test_assert(!tor_gzip_uncompress(&buf3, &len2, buf2, len1, ZLIB_METHOD));
test_assert(buf3);