summaryrefslogtreecommitdiff
path: root/src/or/test.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-10-17 16:55:44 +0000
committerNick Mathewson <nickm@torproject.org>2007-10-17 16:55:44 +0000
commitf988f93b1a54ccbfabbf464514c526033f48e15c (patch)
treed8b7ecfa712171ad29e960c410d3fbd1017c193a /src/or/test.c
parent4088a90d5580612bd3a347be3ddddf3891b60469 (diff)
downloadtor-f988f93b1a54ccbfabbf464514c526033f48e15c.tar.gz
tor-f988f93b1a54ccbfabbf464514c526033f48e15c.zip
r15877@catbus: nickm | 2007-10-17 12:54:56 -0400
Make unverified-consensus get removed when it is accepted or rejected. Make a new get_datadir_fname*() set of functions to eliminate the common code of "get the options, get the datadir, append some stuff". svn:r12000
Diffstat (limited to 'src/or/test.c')
-rw-r--r--src/or/test.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/or/test.c b/src/or/test.c
index b890959a86..4b74d41180 100644
--- a/src/or/test.c
+++ b/src/or/test.c
@@ -3033,6 +3033,36 @@ test_util_mempool(void)
smartlist_free(allocated);
}
+static void
+test_util_datadir(void)
+{
+ char buf[1024];
+ char *f;
+
+ f = get_datadir_fname(NULL);
+ test_streq(f, temp_dir);
+ tor_free(f);
+ f = get_datadir_fname("state");
+ tor_snprintf(buf, sizeof(buf), "%s"PATH_SEPARATOR"state", temp_dir);
+ test_streq(f, buf);
+ tor_free(f);
+ f = get_datadir_fname2("cache", "thingy");
+ tor_snprintf(buf, sizeof(buf),
+ "%s"PATH_SEPARATOR"cache"PATH_SEPARATOR"thingy", temp_dir);
+ test_streq(f, buf);
+ tor_free(f);
+ f = get_datadir_fname2_suffix("cache", "thingy", ".foo");
+ tor_snprintf(buf, sizeof(buf),
+ "%s"PATH_SEPARATOR"cache"PATH_SEPARATOR"thingy.foo", temp_dir);
+ test_streq(f, buf);
+ tor_free(f);
+ f = get_datadir_fname_suffix("cache", ".foo");
+ tor_snprintf(buf, sizeof(buf), "%s"PATH_SEPARATOR"cache.foo",
+ temp_dir);
+ test_streq(f, buf);
+ tor_free(f);
+}
+
/* Test AES-CTR encryption and decryption with IV. */
static void
test_crypto_aes_iv(void)
@@ -3194,6 +3224,7 @@ static struct {
ENT(util),
SUBENT(util, ip6_helpers),
SUBENT(util, gzip),
+ SUBENT(util, datadir),
SUBENT(util, smartlist),
SUBENT(util, bitarray),
SUBENT(util, mempool),