aboutsummaryrefslogtreecommitdiff
path: root/src/datacache/test_datacache.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/datacache/test_datacache.c')
-rw-r--r--src/datacache/test_datacache.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/datacache/test_datacache.c b/src/datacache/test_datacache.c
index c818daaa8..1d8cd3295 100644
--- a/src/datacache/test_datacache.c
+++ b/src/datacache/test_datacache.c
@@ -39,10 +39,10 @@ static const char *plugin_name;
39 39
40static int 40static int
41checkIt (void *cls, struct GNUNET_TIME_Absolute exp, 41checkIt (void *cls, struct GNUNET_TIME_Absolute exp,
42 const GNUNET_HashCode * key, size_t size, const char *data, 42 const struct GNUNET_HashCode * key, size_t size, const char *data,
43 enum GNUNET_BLOCK_Type type) 43 enum GNUNET_BLOCK_Type type)
44{ 44{
45 if (size != sizeof (GNUNET_HashCode)) 45 if (size != sizeof (struct GNUNET_HashCode))
46 { 46 {
47 GNUNET_break (0); 47 GNUNET_break (0);
48 ok = 2; 48 ok = 2;
@@ -61,8 +61,8 @@ run (void *cls, char *const *args, const char *cfgfile,
61 const struct GNUNET_CONFIGURATION_Handle *cfg) 61 const struct GNUNET_CONFIGURATION_Handle *cfg)
62{ 62{
63 struct GNUNET_DATACACHE_Handle *h; 63 struct GNUNET_DATACACHE_Handle *h;
64 GNUNET_HashCode k; 64 struct GNUNET_HashCode k;
65 GNUNET_HashCode n; 65 struct GNUNET_HashCode n;
66 struct GNUNET_TIME_Absolute exp; 66 struct GNUNET_TIME_Absolute exp;
67 unsigned int i; 67 unsigned int i;
68 68
@@ -77,27 +77,27 @@ run (void *cls, char *const *args, const char *cfgfile,
77 } 77 }
78 exp = GNUNET_TIME_absolute_get (); 78 exp = GNUNET_TIME_absolute_get ();
79 exp.abs_value += 5 * 60 * 1000; 79 exp.abs_value += 5 * 60 * 1000;
80 memset (&k, 0, sizeof (GNUNET_HashCode)); 80 memset (&k, 0, sizeof (struct GNUNET_HashCode));
81 for (i = 0; i < 100; i++) 81 for (i = 0; i < 100; i++)
82 { 82 {
83 GNUNET_CRYPTO_hash (&k, sizeof (GNUNET_HashCode), &n); 83 GNUNET_CRYPTO_hash (&k, sizeof (struct GNUNET_HashCode), &n);
84 ASSERT (GNUNET_OK == 84 ASSERT (GNUNET_OK ==
85 GNUNET_DATACACHE_put (h, &k, sizeof (GNUNET_HashCode), 85 GNUNET_DATACACHE_put (h, &k, sizeof (struct GNUNET_HashCode),
86 (const char *) &n, 1 + i % 16, exp)); 86 (const char *) &n, 1 + i % 16, exp));
87 k = n; 87 k = n;
88 } 88 }
89 memset (&k, 0, sizeof (GNUNET_HashCode)); 89 memset (&k, 0, sizeof (struct GNUNET_HashCode));
90 for (i = 0; i < 100; i++) 90 for (i = 0; i < 100; i++)
91 { 91 {
92 GNUNET_CRYPTO_hash (&k, sizeof (GNUNET_HashCode), &n); 92 GNUNET_CRYPTO_hash (&k, sizeof (struct GNUNET_HashCode), &n);
93 ASSERT (1 == GNUNET_DATACACHE_get (h, &k, 1 + i % 16, &checkIt, &n)); 93 ASSERT (1 == GNUNET_DATACACHE_get (h, &k, 1 + i % 16, &checkIt, &n));
94 k = n; 94 k = n;
95 } 95 }
96 96
97 memset (&k, 42, sizeof (GNUNET_HashCode)); 97 memset (&k, 42, sizeof (struct GNUNET_HashCode));
98 GNUNET_CRYPTO_hash (&k, sizeof (GNUNET_HashCode), &n); 98 GNUNET_CRYPTO_hash (&k, sizeof (struct GNUNET_HashCode), &n);
99 ASSERT (GNUNET_OK == 99 ASSERT (GNUNET_OK ==
100 GNUNET_DATACACHE_put (h, &k, sizeof (GNUNET_HashCode), 100 GNUNET_DATACACHE_put (h, &k, sizeof (struct GNUNET_HashCode),
101 (const char *) &n, 792, 101 (const char *) &n, 792,
102 GNUNET_TIME_UNIT_FOREVER_ABS)); 102 GNUNET_TIME_UNIT_FOREVER_ABS));
103 ASSERT (0 != GNUNET_DATACACHE_get (h, &k, 792, &checkIt, &n)); 103 ASSERT (0 != GNUNET_DATACACHE_get (h, &k, 792, &checkIt, &n));