-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest1.cpp
More file actions
44 lines (36 loc) · 924 Bytes
/
test1.cpp
File metadata and controls
44 lines (36 loc) · 924 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <iostream>
#include <string>
#include "HashTable.h"
using namespace std;
bool test1() {
HashTable T1(117), T2;
HashNode N;
N.assign(123456789,21008);
if (N.getKey() != 123456789 || N.getValue() != 21008) {
cout << "Hash Node values are not stored correctly";
return false;
}
T1.insert(100,17);
T1.insert(10,19);
T1.insert(1000,12);
if (T1.getValue(100) != 17 || T1.getValue(1000)!=12 || T1.getValue(10) != 19) {
cout << "Values are not stored correctly." << endl;
return false;
}
T2.insert(2000000,39);
T2.insert(20000,42);
T2.insert(2,76);
if (T2.getValue(2000000) != 39 || T2.getValue(2)!=76 || T2.getValue(20000) != 42) {
cout << "Values are not stored correctly." << endl;
return false;
}
return true;
}
int main() {
if (!test1()) {
cout << "Test 1 failed." << endl;
return 1;
}
cout << "Test 1 succeeded." << endl;
return 0;
}