// Written by retoor@molodetz.nl
|
|
|
|
// This code demonstrates the creation and testing of a hashtable with random keys and ensures the correct retrieval of values.
|
|
|
|
// Importing rhashtable.h, rtest.h, and rstring.h
|
|
|
|
// The content is licensed under MIT License.
|
|
|
|
#include "rhashtable.h"
|
|
#include "rtest.h"
|
|
#include "rstring.h"
|
|
|
|
int main() {
|
|
for (int i = 0; i < 1000; i++) {
|
|
char *key = rgenerate_key();
|
|
rset(key, "test");
|
|
rasserts(strcmp(rget(key), "test") == 0);
|
|
}
|
|
} |