diff options
Diffstat (limited to 'src/datacache/test_datacache_quota.c')
-rw-r--r-- | src/datacache/test_datacache_quota.c | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/src/datacache/test_datacache_quota.c b/src/datacache/test_datacache_quota.c index 78b56ce42..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,28 +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, &k, j, buf, 1 + i, exp, 0, NULL)); | 80 | ASSERT (GNUNET_OK == |
81 | GNUNET_DATACACHE_put (h, | ||
82 | &k, | ||
83 | GNUNET_YES, | ||
84 | j, | ||
85 | buf, | ||
86 | 1 + i, | ||
87 | exp, | ||
88 | 0, | ||
89 | NULL)); | ||
77 | ASSERT (0 < GNUNET_DATACACHE_get (h, &k, 1 + i, NULL, NULL)); | 90 | ASSERT (0 < GNUNET_DATACACHE_get (h, &k, 1 + i, NULL, NULL)); |
78 | } | 91 | } |
79 | k = n; | 92 | k = n; |
80 | } | 93 | } |
81 | FPRINTF (stderr, "%s", "\n"); | 94 | FPRINTF (stderr, "%s", "\n"); |
82 | memset (&k, 0, sizeof (struct GNUNET_HashCode)); | 95 | memset (&k, 0, sizeof (struct GNUNET_HashCode)); |
83 | for (i = 0; i < 10; i++) | 96 | for (unsigned int i = 0; i < 10; i++) |
84 | { | 97 | { |
85 | FPRINTF (stderr, "%s", "."); | 98 | FPRINTF (stderr, "%s", "."); |
86 | GNUNET_CRYPTO_hash (&k, sizeof (struct GNUNET_HashCode), &n); | 99 | GNUNET_CRYPTO_hash (&k, sizeof (struct GNUNET_HashCode), &n); |