-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestDSL.cpp
More file actions
30 lines (24 loc) · 911 Bytes
/
TestDSL.cpp
File metadata and controls
30 lines (24 loc) · 911 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
#include <iostream.h>
#include "DSL.h"
// Test program
int main( )
{
const int ITEM_NOT_FOUND = 99999999;
DSL<int> t( ITEM_NOT_FOUND );
int NUMS = 3900;
const int GAP = 37;
int i;
cout << "Checking... (no more output means success)" << endl;
for( i = GAP; i != 0; i = ( i + GAP ) % NUMS )
t.insert( i );
if( NUMS < 40 )
t.printList( );
if( t.findMin( ) != 1 || t.findMax( ) != NUMS - 1 )
cout << "FindMin or FindMax error!" << endl;
for( i = 1; i < NUMS; i++ )
if( t.find( i ) != i )
cout << "Find error1!" << endl;
if( t.find( 0 ) != ITEM_NOT_FOUND )
cout << "ITEM_NOT_FOUND failed!" << endl;
return 0;
}