Skip to content

Instantly share code, notes, and snippets.

@samwightt
Last active March 4, 2019 19:36
Show Gist options
  • Save samwightt/c163b4fda4f050dcdea4c3abb8d4422a to your computer and use it in GitHub Desktop.
Save samwightt/c163b4fda4f050dcdea4c3abb8d4422a to your computer and use it in GitHub Desktop.
Test file for project 2
#include <iostream>
using namespace std;
#include "dList.cpp"
int main(void) {
cout << "Test one:" << endl << endl;
float times[1] = {100};
float fuel[1] = {100};
dList dl = dList(times, fuel, 1);
int j = 0;
for (int i = 0; i < 50; i++) j = dl.insert((float)100 - (float)(0.1 * i), ((float)100 - (float)(0.1 * i)));
cout << "The last element number was " << j << "." << endl << endl;
cout << "Should only output the smallest element: " << endl;
dl.out(1, 'd');
cout << endl;
cout << "Should output all elements in ascending order: " << endl;
dl.out();
cout << endl << endl << "Test Two: " << endl << endl;
float times2[3] = {1, 2, 3};
float fuel2[3] = {1, 2, 3};
dList dl2 = dList(times2, fuel2, 3);
for (int i = 100; i <= 200; i++) dl2.insert((float)i, float(i));
cout << "Should output first 5 elements in ascending order: (1 should be the smallest number, 2 or 3 should not exist)." << endl;
dl2.out(5, 'a');
cout << endl;
dl2.insert(0.1, 100);
cout << "Should output six elements in reverse order:" << endl;
dl2.out('d');
}
/*
Test one:
The last element number was 50.
Should only output the smallest element:
Time 95.1 Fuel 95.1
Should output all elements in ascending order:
Time 95.1 Fuel 95.1
Test Two:
Should output first 5 elements in ascending order: (1 should be the smallest number, 2 or 3 should not exist).
Time 1 Fuel 1
Should output six elements in reverse order:
Time 1 Fuel 1
Time 0.1 Fuel 104
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment