diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-06-04 23:32:09 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-06-04 23:32:09 +0200 |
commit | 324f6168c2374d7bb71c3632fb6521860d8fdfa1 (patch) | |
tree | 0fa116e131ce1f8e440093cd9ce696f8c0c82ff2 /src | |
parent | eec5a96f455942cac2f972f76babfe624849dccc (diff) | |
download | gnunet-324f6168c2374d7bb71c3632fb6521860d8fdfa1.tar.gz gnunet-324f6168c2374d7bb71c3632fb6521860d8fdfa1.zip |
testcase cleanup
Diffstat (limited to 'src')
-rw-r--r-- | src/datacache/test_datacache_quota.c | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/src/datacache/test_datacache_quota.c b/src/datacache/test_datacache_quota.c index 35357a8d2..b89d71a27 100644 --- a/src/datacache/test_datacache_quota.c +++ b/src/datacache/test_datacache_quota.c | |||
@@ -49,8 +49,6 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
49 | struct GNUNET_DATACACHE_Handle *h; | 49 | struct GNUNET_DATACACHE_Handle *h; |
50 | struct GNUNET_HashCode k; | 50 | struct GNUNET_HashCode k; |
51 | struct GNUNET_HashCode n; | 51 | struct GNUNET_HashCode n; |
52 | unsigned int i; | ||
53 | unsigned int j; | ||
54 | char buf[3200]; | 52 | char buf[3200]; |
55 | struct GNUNET_TIME_Absolute exp; | 53 | struct GNUNET_TIME_Absolute exp; |
56 | 54 | ||
@@ -59,36 +57,43 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
59 | 57 | ||
60 | if (h == NULL) | 58 | if (h == NULL) |
61 | { | 59 | { |
62 | FPRINTF (stderr, "%s", "Failed to initialize datacache. Database likely not setup, skipping test.\n"); | 60 | FPRINTF (stderr, |
61 | "%s", | ||
62 | "Failed to initialize datacache. Database likely not setup, skipping test.\n"); | ||
63 | return; | 63 | return; |
64 | } | 64 | } |
65 | exp = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS); | 65 | exp = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS); |
66 | memset (buf, 1, sizeof (buf)); | 66 | memset (buf, 1, sizeof (buf)); |
67 | memset (&k, 0, sizeof (struct GNUNET_HashCode)); | 67 | memset (&k, 0, sizeof (struct GNUNET_HashCode)); |
68 | for (i = 0; i < 10; i++) | 68 | for (unsigned int i = 0; i < 10; i++) |
69 | { | 69 | { |
70 | FPRINTF (stderr, "%s", "."); | 70 | FPRINTF (stderr, |
71 | GNUNET_CRYPTO_hash (&k, sizeof (struct GNUNET_HashCode), &n); | 71 | "%s", |
72 | for (j = i; j < sizeof (buf); j += 10) | 72 | "."); |
73 | GNUNET_CRYPTO_hash (&k, | ||
74 | sizeof (struct GNUNET_HashCode), | ||
75 | &n); | ||
76 | for (unsigned int j = i; j < sizeof (buf); j += 10) | ||
73 | { | 77 | { |
74 | exp.abs_value_us++; | 78 | exp.abs_value_us++; |
75 | buf[j] = i; | 79 | buf[j] = i; |
76 | ASSERT (GNUNET_OK == GNUNET_DATACACHE_put (h, | 80 | ASSERT (GNUNET_OK == |
77 | &k, | 81 | GNUNET_DATACACHE_put (h, |
78 | GNUNET_YES, | 82 | &k, |
79 | j, | 83 | GNUNET_YES, |
80 | buf, | 84 | j, |
81 | 1 + i, | 85 | buf, |
82 | exp, | 86 | 1 + i, |
83 | 0, | 87 | exp, |
84 | NULL)); | 88 | 0, |
89 | NULL)); | ||
85 | ASSERT (0 < GNUNET_DATACACHE_get (h, &k, 1 + i, NULL, NULL)); | 90 | ASSERT (0 < GNUNET_DATACACHE_get (h, &k, 1 + i, NULL, NULL)); |
86 | } | 91 | } |
87 | k = n; | 92 | k = n; |
88 | } | 93 | } |
89 | FPRINTF (stderr, "%s", "\n"); | 94 | FPRINTF (stderr, "%s", "\n"); |
90 | memset (&k, 0, sizeof (struct GNUNET_HashCode)); | 95 | memset (&k, 0, sizeof (struct GNUNET_HashCode)); |
91 | for (i = 0; i < 10; i++) | 96 | for (unsigned int i = 0; i < 10; i++) |
92 | { | 97 | { |
93 | FPRINTF (stderr, "%s", "."); | 98 | FPRINTF (stderr, "%s", "."); |
94 | GNUNET_CRYPTO_hash (&k, sizeof (struct GNUNET_HashCode), &n); | 99 | GNUNET_CRYPTO_hash (&k, sizeof (struct GNUNET_HashCode), &n); |