Skip to content

Instantly share code, notes, and snippets.

@samwightt
Created March 20, 2019 18:38
Show Gist options
  • Save samwightt/3e13fb16be6b9cc41d0d360be9709a23 to your computer and use it in GitHub Desktop.
Save samwightt/3e13fb16be6b9cc41d0d360be9709a23 to your computer and use it in GitHub Desktop.
A test file for project 3.
#include <iostream>
using namespace std;
#include "dList.cpp"
int main(){
const int size = 10;
float avgTime[size] = { 93, 99, 96, 97, 95,100, 94, 98, 92, 98};
float fuelEfficiency[size] = {194,201,196,156,193,100,194,198,200,140};
dList dl = dList(avgTime,fuelEfficiency,size);
cout << "First Output"<<endl;
dl.out('a');
// 92, 93, 95, 97, 98, 100
//200, 194, 193, 156, 140, 100
for (int i = 0; i < 500000; i++) {
dl.insert((float)(100.0 + (0.0001 * i)), (float)(50.0 - (0.0001 * i)));
cout << "Current run number: " << i << endl;
}
for (int i = 500009; i > 499985; i--) {
dl.increase_time(i, 0.7);
}
cout << endl << "End of list (last 10 elements):" << endl;
dl.out(10, 'd');
cout << endl;
cout << "Start of list (first 15 elements)";
dl.out(15, 'a');
return 0;
}
/*
Output should be:
(Large set of numbers (the current i value) so you can get a general idea of how fast your insert function is running.) (goes from 0 to 499999).
After this:
End of list (last 10 elements):
Time 150.7 Fuel 0.0001
Time 150.7 Fuel 0.0002
Time 150.7 Fuel 0.0003
Time 150.7 Fuel 0.0004
Time 150.699 Fuel 0.0005
Time 150.699 Fuel 0.0006
Time 150.699 Fuel 0.0007
Time 150.699 Fuel 0.0008
Time 150.699 Fuel 0.0009
Time 150.699 Fuel 0.001
Start of list (first 15 elements)Time 92 Fuel 200
Time 93 Fuel 194
Time 95 Fuel 193
Time 97 Fuel 156
Time 98 Fuel 140
Time 100 Fuel 50
Time 100 Fuel 49.9999
Time 100 Fuel 49.9998
Time 100 Fuel 49.9997
Time 100 Fuel 49.9996
Time 100.001 Fuel 49.9995
Time 100.001 Fuel 49.9994
Time 100.001 Fuel 49.9993
Time 100.001 Fuel 49.9992
Time 100.001 Fuel 49.9991
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment