diff --git a/ipc/hash_test.c b/ipc/hash_test.c
new file mode 100644
index 0000000..dec32c4
--- /dev/null
+++ b/ipc/hash_test.c
@@ -0,0 +1,117 @@
+/***************************************************************************
+ * Copyright 1995 Michael Veksler. mveksler@vnet.ibm.com
+ ***************************************************************************
+ * File:      hash_test.c
+ * Purpose :  test generic_hash correctness.
+ * NOTE:
+ *   This code covers only about 80% of generic_hash code.
+ *   There might be bugs in the remaining 20% - although most
+ *   of the functionality is tested with wine linckage.
+ *   For complete testing a little more work should be done.
+ ***************************************************************************
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <assert.h>
+#include "generic_hash.h"
+
+#define SIZE 200
+typedef struct { int a,b;} DATA ;
+DATA data[SIZE];
+int keys[SIZE];
+int peeks=0;
+
+HASH_CONTAINER *hash1;
+HASH_CONTAINER *hash2;		/* actual data is shared with hash1 */
+
+/* test insertion using keys[] and data[] inserting using hash1 and */
+/* hash2 periodically, test hash after every 2 insertions */
+void test_insert()
+{
+    int i,j;
+    HASH_VAL *item;
+    
+    printf("testing insertion \n");
+    for (i=0 ; i < SIZE-1 ; i+=2) {
+	assert(hash_add_item(hash1, keys[i], (HASH_VAL *)&data[i]));
+	assert(hash_add_item(hash2, keys[i+1], (HASH_VAL *)&data[i+1]));
+	for (j=0 ; j <= i+1 ; j++) {
+	    item= hash_locate_item(hash1, keys[j], (HASH_VAL *)&data[j]);
+	    if (item == NULL) {
+		printf("NULL item: i=%d,j=%d\n",i,j);
+		continue;
+	    }
+	    peeks++;
+	    if (memcmp(item,&data[j],sizeof(DATA))!=0) {
+		printf("i=%d,j=%d\n",i,j);
+		printf("saved=(%d,%d), orig=(%d,%d)\n",
+		       ((DATA*)item)->a, ((DATA*)item)->b,
+		       data[j].a, data[j].b);
+	    }
+	}
+    } 
+}
+
+/* test deletion using keys[] and data[] deleting using hash1 and */
+/* hash2 periodicly, test hash after every 2 deletions */
+void test_delete()
+{
+    int i,j;
+    HASH_VAL *item;
+
+    printf("testing deletion\n");
+    for (i=0 ; i < SIZE-1 ; i+=2) {
+	assert(hash_delete_item(hash2, keys[i], NULL));
+	assert(hash_delete_item(hash1, keys[i+1], NULL));
+	for (j=0 ; j < SIZE ; j++) {
+	    item= hash_locate_item(hash2, keys[j], (HASH_VAL *)&data[j]);
+	    if (item == NULL) {
+		if ( j > i+1) 
+		    printf("NULL item: i=%d,j=%d\n",i,j);
+		continue;
+	    }
+	    if (item != NULL && j <= i+1) {
+		printf("Non NULL item: i=%d,j=%d\n",i,j);
+		continue;
+	    }
+	    if (memcmp(item,&data[j],sizeof(DATA))!=0) {
+		printf("i=%d,j=%d\n",i,j);
+		printf("saved=(%d,%d), orig=(%d,%d)\n",
+		       ((DATA*)item)->a, ((DATA*)item)->b,
+		       data[j].a, data[j].b);
+	    }
+	}
+    } 
+
+}
+
+
+int main()
+{
+    int i;
+    
+    hash1= create_hash(sizeof(DATA), 1);
+    assert(hash1);
+    hash2= attach_remote_hash(hash1->shared, sizeof(DATA), HASH_MEM_ACCESS);
+    assert(hash2);
+
+    for (i=0 ; i< SIZE ; i++) {
+	data[i].a= rand();
+	data[i].b= rand();
+	keys[i]= rand();
+    }
+
+    test_insert();
+    detach_hash(hash1);
+    free(hash1);
+    hash1= attach_remote_hash(hash2->shared, sizeof(DATA), HASH_MEM_ACCESS);
+    
+    test_delete();
+    test_insert();
+
+    detach_hash(hash1);
+    destroy_hash(hash2);
+    printf("peeks=%d\n", peeks);
+    return 0;
+}
