- Pretty-indenting code

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@674 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2006-06-29 08:44:30 +00:00
parent 7aecc910ba
commit 6b27a8461b
94 changed files with 3073 additions and 3066 deletions

View file

@ -51,245 +51,245 @@ using namespace std;
*/
class HistoryTester
{
public:
HistoryTester(SchedulableQueue sl)
: _history_length(-1), _internal_schedulable_queue(sl)
{}
public:
/** this method gets a sequence of operations as a parameter and performs them
* checking for anomalies.
* E stands for EnqueueSlice, R for randomize input, T for truncate the last insertion
*/
void
test(std::string commands_sequence)
HistoryTester(SchedulableQueue sl)
: _history_length(-1), _internal_schedulable_queue(sl)
{}
/** this method gets a sequence of operations as a parameter and performs them
* checking for anomalies.
* E stands for EnqueueSlice, R for randomize input, T for truncate the last insertion
*/
void
test(std::string commands_sequence)
{
// prints the test sequence
std::cout << commands_sequence << endl;
// executes the test sequence
for (unsigned int i = 0; i < commands_sequence.length() && i < 400; i++)
{
// prints the test sequence
std::cout << commands_sequence << endl;
// executes the test sequence
for (unsigned int i = 0; i < commands_sequence.length() && i < 400; i++)
{
switch(commands_sequence[i])
{
case 'E':
_insert(_internal_schedulable_queue);
break;
case 'R':
_randomize(_internal_schedulable_queue);
break;
case 'T':
_truncate();
break;
default:
break;
}
_standard_test();
}
return;
switch(commands_sequence[i])
{
case 'E':
_insert(_internal_schedulable_queue);
break;
case 'R':
_randomize(_internal_schedulable_queue);
break;
case 'T':
_truncate();
break;
default:
break;
}
_standard_test();
}
return;
}
private:
private:
int _history_length; // mirrors the correct length of the history
SchedulableQueue* _get_simulation_status_at[400]; // mirrors the correct content of the history
DynamicSchedulable* _get_scheduled_at[400]; // mirrors the correct content of the history
SchedulableQueue _internal_schedulable_queue;
int _history_length; // mirrors the correct length of the history
SchedulableQueue* _get_simulation_status_at[400]; // mirrors the correct content of the history
DynamicSchedulable* _get_scheduled_at[400]; // mirrors the correct content of the history
SchedulableQueue _internal_schedulable_queue;
// looks for anomalies
void
_standard_test()
// looks for anomalies
void
_standard_test()
{
// checks if the Singleton Pattern has been actually implemented
if (&History::get_instance() != &History::get_instance()) std::cout << "\nget_instance";
// checks if the History is long how it should be
if (History::get_instance().get_current_time() != _history_length) std::cout << "\nget_current_time: real: " << History::get_instance().get_current_time() << ", expected " << _history_length << endl;
// checks if the History contains the right stuff
int min = History::get_instance().get_current_time();
min = min < _history_length ? min : _history_length;
for (int i = 0; i < min + 1; i++)
{
// checks if the Singleton Pattern has been actually implemented
if (&History::get_instance() != &History::get_instance()) std::cout << "\nget_instance";
// checks if the History is long how it should be
if (History::get_instance().get_current_time() != _history_length) std::cout << "\nget_current_time: real: " << History::get_instance().get_current_time() <<", expected " << _history_length<<endl;
// checks if the History contains the right stuff
int min = History::get_instance().get_current_time();
min = min < _history_length ? min : _history_length;
for (int i = 0; i < min+1; i++)
{
// watch out here, it's if (NOT ...) operator != was not available.
if
(
!(
History::get_instance().get_simulation_status_at(i)->has_same_objects( *_get_simulation_status_at[i])
)
)
{
std::cout << "\nget_simulation_status_at";
}
if (History::get_instance().get_scheduled_at(i) != memory::smart_ptr<DynamicSchedulable>(NULL) && !(*(History::get_instance().get_scheduled_at(i)) == *(_get_scheduled_at[i])))
{
std::cout << "\nget_scheduled_at";
}
}
return;
// watch out here, it's if (NOT ...) operator != was not available.
if
(
!(
History::get_instance().get_simulation_status_at(i)->has_same_objects( *_get_simulation_status_at[i])
)
)
{
std::cout << "\nget_simulation_status_at";
}
if (History::get_instance().get_scheduled_at(i) != memory::smart_ptr<DynamicSchedulable>(NULL) && !(*(History::get_instance().get_scheduled_at(i)) == *(_get_scheduled_at[i])))
{
std::cout << "\nget_scheduled_at";
}
}
return;
}
// saves the given SchedulableQueue into the history, and saves a copy of it into an array
void _insert(sgpem::SchedulableQueue& status)
// saves the given SchedulableQueue into the history, and saves a copy of it into an array
void _insert(sgpem::SchedulableQueue& status)
{
History::get_instance().enqueue_slice(status);
_history_length = _history_length + 1;
_get_simulation_status_at[_history_length] = new SchedulableQueue(status);
if (History::get_instance().get_scheduled_at(_history_length) != memory::smart_ptr<DynamicSchedulable>(NULL))
_get_scheduled_at[_history_length] = new DynamicSchedulable(*(History::get_instance().get_scheduled_at(_history_length)));
else
_get_scheduled_at[_history_length] = NULL;
return;
}
// modifies the given SchedulableQueue object in an arbitrary way.
void _randomize(sgpem::SchedulableQueue& status)
{
status.swap(9, 10);
status.swap(1, 16);
status.swap(3, 19);
status.swap(2, 18);
status.swap(5, 16);
status.swap(4, 11);
status.swap(6, 12);
status.swap(7, 14);
status.swap(15, 13);
status.swap(0, 10);
status.swap(9, 4);
status.swap(4, 5);
status.swap(7, 1);
for (unsigned int i = 0; i < status.size(); i++)
{
History::get_instance().enqueue_slice(status);
_history_length = _history_length + 1;
_get_simulation_status_at[_history_length] = new SchedulableQueue(status);
if (History::get_instance().get_scheduled_at(_history_length) != memory::smart_ptr<DynamicSchedulable>(NULL))
_get_scheduled_at[_history_length] = new DynamicSchedulable(*(History::get_instance().get_scheduled_at(_history_length)));
else
_get_scheduled_at[_history_length] = NULL;
return;
status.get_item_at(i)->give_cpu_time(i % 2);
status.get_item_at(i)->set_last_scheduled(_history_length % 30);
status.get_item_at(i)->set_state(i % 2 ? DynamicSchedulable::state_running : DynamicSchedulable::state_ready);
}
return;
}
// modifies the given SchedulableQueue object in an arbitrary way.
void _randomize(sgpem::SchedulableQueue& status)
// truncates the history by one instant
void _truncate()
{
if (_history_length > -1)
{
status.swap(9, 10);
status.swap(1, 16);
status.swap(3, 19);
status.swap(2, 18);
status.swap(5, 16);
status.swap(4, 11);
status.swap(6, 12);
status.swap(7, 14);
status.swap(15, 13);
status.swap(0, 10);
status.swap(9, 4);
status.swap(4, 5);
status.swap(7, 1);
for (unsigned int i = 0; i < status.size(); i++)
{
status.get_item_at(i)->give_cpu_time(i%2);
status.get_item_at(i)->set_last_scheduled(_history_length%30);
status.get_item_at(i)->set_state(i%2 ? DynamicSchedulable::state_running : DynamicSchedulable::state_ready);
}
return;
}
// truncates the history by one instant
void _truncate()
{
if (_history_length > -1)
{
if (_get_simulation_status_at[_history_length] != NULL)
{
delete _get_simulation_status_at[_history_length];
_get_simulation_status_at[_history_length] = NULL;
}
if (_get_scheduled_at[_history_length] != NULL)
{
delete _get_scheduled_at[_history_length];
_get_scheduled_at[_history_length] = NULL;
}
_history_length = _history_length - 1;
History::get_instance().truncate_at(_history_length-1);
}
return;
if (_get_simulation_status_at[_history_length] != NULL)
{
delete _get_simulation_status_at[_history_length];
_get_simulation_status_at[_history_length] = NULL;
}
if (_get_scheduled_at[_history_length] != NULL)
{
delete _get_scheduled_at[_history_length];
_get_scheduled_at[_history_length] = NULL;
}
_history_length = _history_length - 1;
History::get_instance().truncate_at(_history_length - 1);
}
return;
}
};
int
main(int argc, char** argv)
main(int argc, char** argv)
{
using namespace sgpem;
using Glib::Module;
using namespace sgpem;
using Glib::Module;
std::string command("ERERERT"); // the sequence of commands to test
if(argc > 1)
command = argv[1];
// sets up the test data
StaticProcess p1("P1", 1,5,1);
StaticProcess p2("P2", 5,55,2);
StaticProcess p3("P3", 36,30,3);
StaticProcess p4("P4", 4,26,3);
StaticProcess p5("P5", 15,200,3);
StaticProcess p6("P6", 6,250,1);
StaticProcess p7("P7", 8,42,15);
StaticProcess p8("P8", 8,56,1);
StaticProcess p9("P9", 9,42,1);
StaticProcess p10("PA", 12,42,1);
StaticProcess p11("PB", 106,42,1);
StaticProcess p12("PC", 100,42,1);
StaticProcess p13("PD", 29,42,18);
StaticProcess p14("PE", 0,42,1);
StaticProcess p15("PF", 2,88,1);
StaticProcess p16("PG", 3666,9,1);
StaticProcess p17("PH", 5,72,10);
StaticProcess p18("PJ", 6,26,1);
StaticProcess p19("PK", 10,24,17);
StaticProcess p20("PK2", 11,34,67); // not used!
std::string command("ERERERT"); // the sequence of commands to test
if(argc > 1)
command = argv[1];
DynamicSchedulable ss1(p1);
DynamicSchedulable ss2(p2);
DynamicSchedulable ss3(p3);
DynamicSchedulable ss4(p4);
DynamicSchedulable ss5(p5);
DynamicSchedulable ss6(p6);
DynamicSchedulable ss7(p7);
DynamicSchedulable ss8(p8);
DynamicSchedulable ss9(p9);
DynamicSchedulable ss10(p10);
DynamicSchedulable ss11(p11);
DynamicSchedulable ss12(p12);
DynamicSchedulable ss13(p13);
DynamicSchedulable ss14(p14);
DynamicSchedulable ss15(p15);
DynamicSchedulable ss16(p16);
DynamicSchedulable ss17(p17);
DynamicSchedulable ss18(p18);
DynamicSchedulable ss19(p19); // not used!
// sets up the test data
StaticProcess p1("P1", 1, 5, 1);
StaticProcess p2("P2", 5, 55, 2);
StaticProcess p3("P3", 36, 30, 3);
StaticProcess p4("P4", 4, 26, 3);
StaticProcess p5("P5", 15, 200, 3);
StaticProcess p6("P6", 6, 250, 1);
StaticProcess p7("P7", 8, 42, 15);
StaticProcess p8("P8", 8, 56, 1);
StaticProcess p9("P9", 9, 42, 1);
StaticProcess p10("PA", 12, 42, 1);
StaticProcess p11("PB", 106, 42, 1);
StaticProcess p12("PC", 100, 42, 1);
StaticProcess p13("PD", 29, 42, 18);
StaticProcess p14("PE", 0, 42, 1);
StaticProcess p15("PF", 2, 88, 1);
StaticProcess p16("PG", 3666, 9, 1);
StaticProcess p17("PH", 5, 72, 10);
StaticProcess p18("PJ", 6, 26, 1);
StaticProcess p19("PK", 10, 24, 17);
StaticProcess p20("PK2", 11, 34, 67); // not used!
SchedulableQueue initial;
initial.add_at_bottom(ss1);
initial.add_at_bottom(ss2);
initial.add_at_bottom(ss3);
initial.add_at_bottom(ss4);
initial.add_at_bottom(ss5);
initial.add_at_bottom(ss6);
initial.add_at_bottom(ss7);
initial.add_at_bottom(ss8);
initial.add_at_bottom(ss9);
initial.add_at_bottom(ss10);
initial.add_at_bottom(ss11);
initial.add_at_bottom(ss12);
initial.add_at_bottom(ss13);
initial.add_at_bottom(ss14);
initial.add_at_bottom(ss15);
initial.add_at_bottom(ss16);
initial.add_at_bottom(ss17);
initial.add_at_bottom(ss18);
DynamicSchedulable ss1(p1);
DynamicSchedulable ss2(p2);
DynamicSchedulable ss3(p3);
DynamicSchedulable ss4(p4);
DynamicSchedulable ss5(p5);
DynamicSchedulable ss6(p6);
DynamicSchedulable ss7(p7);
DynamicSchedulable ss8(p8);
DynamicSchedulable ss9(p9);
DynamicSchedulable ss10(p10);
DynamicSchedulable ss11(p11);
DynamicSchedulable ss12(p12);
DynamicSchedulable ss13(p13);
DynamicSchedulable ss14(p14);
DynamicSchedulable ss15(p15);
DynamicSchedulable ss16(p16);
DynamicSchedulable ss17(p17);
DynamicSchedulable ss18(p18);
DynamicSchedulable ss19(p19); // not used!
HistoryTester HT(initial);
//HT.test("EEEEREREEEERERRREEEEEEEETERRERERTTT");
HT.test("E");
HT.test("EE");
HT.test("EERE");
HT.test("EEEREE");
HT.test("EEEREE");
HT.test("EEER");
HT.test("EEEERER");
HT.test("EEER");
HT.test("EREE");
HT.test("EEEERERT");
HT.test("EEEERERTEEEERERT");
HT.test("EEEERERTEEETRERERT");
HT.test("EEEERERTEEEERRRERT");
HT.test("EEEEEEERERTERERT");
HT.test("EEEEREREEEERERRREEEEEEEETERRERERTTT");
//HT.test(command);
SchedulableQueue initial;
initial.add_at_bottom(ss1);
initial.add_at_bottom(ss2);
initial.add_at_bottom(ss3);
initial.add_at_bottom(ss4);
initial.add_at_bottom(ss5);
initial.add_at_bottom(ss6);
initial.add_at_bottom(ss7);
initial.add_at_bottom(ss8);
initial.add_at_bottom(ss9);
initial.add_at_bottom(ss10);
initial.add_at_bottom(ss11);
initial.add_at_bottom(ss12);
initial.add_at_bottom(ss13);
initial.add_at_bottom(ss14);
initial.add_at_bottom(ss15);
initial.add_at_bottom(ss16);
initial.add_at_bottom(ss17);
initial.add_at_bottom(ss18);
cout << std::endl << "\nend of test!\n";
exit(0);
HistoryTester HT(initial);
//HT.test("EEEEREREEEERERRREEEEEEEETERRERERTTT");
HT.test("E");
HT.test("EE");
HT.test("EERE");
HT.test("EEEREE");
HT.test("EEEREE");
HT.test("EEER");
HT.test("EEEERER");
HT.test("EEER");
HT.test("EREE");
HT.test("EEEERERT");
HT.test("EEEERERTEEEERERT");
HT.test("EEEERERTEEETRERERT");
HT.test("EEEERERTEEEERRRERT");
HT.test("EEEEEEERERTERERT");
HT.test("EEEEREREEEERERRREEEEEEEETERRERERTTT");
//HT.test(command);
cout << std::endl << "\nend of test!\n";
exit(0);
}

View file

@ -18,7 +18,7 @@
// along with SGPEMv2; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
/* This executable tests for workingness of the parseCommand method in the
/* This executable tests for workingness of the parseCommand method in the
* classTextSimulation class and the StandardIO class. */
#include "standard_io.hh"
@ -46,72 +46,73 @@
namespace sgpem
{
/* History stub: every public method does nothing except printing
in std::cout the signature and the parameters. */
/* History stub: every public method does nothing except printing
in std::cout the signature and the parameters. */
class TestHistory : public History
{
public:
memory::smart_ptr<sgpem::DynamicSchedulable> get_scheduled_at(int time)
{
std::cout << "get_scheduled_at" << time;
return History::get_scheduled_at(time);
}
memory::smart_ptr<sgpem::SchedulableQueue> get_simulation_status_at(int time) const
{
std::cout << "get_simulation_status_at" << time;
return History::get_simulation_status_at(time);
}
int get_current_time() const
{
std::cout << "getCurrentTime";
return History::get_current_time();
}
void enqueue_slice(const sgpem::SchedulableQueue& status)
{
std::cout << "enqueue_slice";
History::enqueue_slice(status);
}
void truncate_at(int instant)
{
std::cout << "TruncateAt" << instant;
History::truncate_at(instant);
}
// The following method is not used by the user interface
static History& get_instance();
memory::smart_ptr<sgpem::DynamicSchedulable> get_scheduled_at(int time)
{
std::cout << "get_scheduled_at" << time;
return History::get_scheduled_at(time);
}
memory::smart_ptr<sgpem::SchedulableQueue> get_simulation_status_at(int time) const
{
std::cout << "get_simulation_status_at" << time;
return History::get_simulation_status_at(time);
}
int get_current_time() const
{
std::cout << "getCurrentTime";
return History::get_current_time();
}
void enqueue_slice(const sgpem::SchedulableQueue& status)
{
std::cout << "enqueue_slice";
History::enqueue_slice(status);
}
void truncate_at(int instant)
{
std::cout << "TruncateAt" << instant;
History::truncate_at(instant);
}
// The following method is not used by the user interface
static History& get_instance();
private:
static TestHistory* _instance;
static TestHistory* _instance;
};
TestHistory* TestHistory::_instance = 0;
TestHistory* TestHistory::_instance = 0;
History&
TestHistory::get_instance()
{
if(!_instance)
_instance = new TestHistory();
return *_instance;
}
History&
TestHistory::get_instance()
{
if(!_instance)
_instance = new TestHistory();
return *_instance;
}
}//~ namespace sgpem
int
main(int, char**) {
using namespace sgpem;
main(int, char**)
{
using namespace sgpem;
Scheduler::get_instance(); // Forces initialization of scheduler.
// Cross fingers (depends if PythonPolicyManager
// static object has been initialized before?).
Scheduler::get_instance(); // Forces initialization of scheduler.
// Cross fingers (depends if PythonPolicyManager
// static object has been initialized before?).
//initialize history
TestHistory::get_instance();
//textual IO
memory::smart_ptr<IOManager> io(new StandardIO());
text_sim.add_io_device(io);
text_sim.update();
text_sim.run();
exit(0);
//initialize history
TestHistory::get_instance();
//textual IO
memory::smart_ptr<IOManager> io(new StandardIO());
text_sim.add_io_device(io);
text_sim.update();
text_sim.run();
exit(0);
}

View file

@ -46,165 +46,162 @@
namespace sgpem
{
/** An hard-coded Priority Round Robin policy
* It's actually called PRRPolicy, altough my personal taste would have suggested
* naming it
* Prioriy-Reliant Roughly-Realized Recently-Reimplemented Round-Robin Policy,
* i.e. PRRRRRRR-Policy.
* it adds a new constructor taking the quantum size (time slice)*/
/** An hard-coded Priority Round Robin policy
* It's actually called PRRPolicy, altough my personal taste would have suggested
* naming it
* Prioriy-Reliant Roughly-Realized Recently-Reimplemented Round-Robin Policy,
* i.e. PRRRRRRR-Policy.
* it adds a new constructor taking the quantum size (time slice)*/
class PRRPolicy : public Policy
class PRRPolicy : public Policy
{
public:
Policy()
{
public:
_instance = this;
}
Policy()
{
_instance = this;
}
Policy(int quantum) : _quantum(quantum)
{
_instance = this;
}
static Policy& get_instance()
{
if(!_instance) _instance = new Policy(3); // quantum size
return *_instance;
}
virtual ~Policy()
{
}
virtual void configure()
{
}
virtual void sort_queue() const throw(UserInterruptException)
{ // here a lot of fun, exactly O(n^2) fun!
SchedulableQueue sl = History.get_instance().get_simulation_status_at(get_current_time());
for (int i = 0; i < sl.size(); i++)
{
for (int j = 0; j < sl.size()-1; j++)
{
if (sl.get_item_at(j).get_schedulable().get_priority() < sl.get_item_at(j+1).get_schedulable().get_priority())
{
sl.swap(j, j+1);
}
}
}
}
int get_id() const
{
return 42;
}
virtual Glib::ustring get_description()
{
return "42";
}
virtual bool is_pre_emptive() const throw(UserInterruptException)
{
return 1;
}
virtual int get_time_slice() const throw(UserInterruptException)
{
return _quantum;
}
PolicyParameters& get_parameters()
{
return _parameters;
}
protected:
PolicyParameters _parameters;
int _id;
int _quantum;
private:
static Policy* _instance;
};
Policy*
PRRPolicy::_instance = NULL;
// A PolicyManager stub
class PolicyManager
Policy(int quantum) : _quantum(quantum)
{
public:
_instance = this;
}
PolicyManager();
virtual ~PolicyManager();
virtual Policy& get_policy()
{
return PRRPolicy.get_instance();
}
virtual void init()
{
}
static PolicyManager& get_registered_manager();
private:
static PolicyManager* _registered;
};
PolicyManager*
PolicyManager::_registered = NULL;
PolicyManager::PolicyManager()
static Policy& get_instance()
{
_registered = this;
if(!_instance) _instance = new Policy(3); // quantum size
return *_instance;
}
virtual ~Policy()
{}
virtual void configure()
{}
virtual void sort_queue() const throw(UserInterruptException)
{ // here a lot of fun, exactly O(n^2) fun!
SchedulableQueue sl = History.get_instance().get_simulation_status_at(get_current_time());
for (int i = 0; i < sl.size(); i++)
{
for (int j = 0; j < sl.size() - 1; j++)
{
if (sl.get_item_at(j).get_schedulable().get_priority() < sl.get_item_at(j + 1).get_schedulable().get_priority())
{
sl.swap(j, j + 1);
}
}
}
}
int get_id() const
{
return 42;
}
virtual Glib::ustring get_description()
{
return "42";
}
virtual bool is_pre_emptive() const throw(UserInterruptException)
{
return 1;
}
virtual int get_time_slice() const throw(UserInterruptException)
{
return _quantum;
}
PolicyParameters& get_parameters()
{
return _parameters;
}
PolicyManager::~PolicyManager()
{
if(_registered == this) _registered = NULL;
}
protected:
PolicyManager&
PolicyManager::get_registered_manager()
{
return *_registered;
}
PolicyParameters _parameters;
int _id;
int _quantum;
private:
// a History stub, should only save the last state included. but...
class History : public ObservedSubject
{
public:
memory::smart_ptr<sgpem::DynamicSchedulable> get_scheduled_at(int time) const {}
memory::smart_ptr<sgpem::SchedulableQueue> get_simulation_status_at(int time) const;
int get_current_time() const {return _total_time_elapsed;}
void enqueue_slice(const sgpem::SchedulableQueue& status);
void truncate_at(int instant) {}
static History& get_instance();
private:
History(int); //private constructor. The parameter is discarded
static History _instance;
int _total_time_elapsed;
std::vector<sgpem::Slice> _slices;
static Policy* _instance;
};
History&
History::get_instance()
{
if(!_instance) _instance = new Policy(3); // quantum size
return *_instance;
}
Policy*
PRRPolicy::_instance = NULL;
// A PolicyManager stub
class PolicyManager
{
public:
PolicyManager();
virtual ~PolicyManager();
virtual Policy& get_policy()
{
return PRRPolicy.get_instance();
}
virtual void init()
{}
static PolicyManager& get_registered_manager();
private:
static PolicyManager* _registered;
};
PolicyManager*
PolicyManager::_registered = NULL;
PolicyManager::PolicyManager()
{
_registered = this;
}
PolicyManager::~PolicyManager()
{
if(_registered == this) _registered = NULL;
}
PolicyManager&
PolicyManager::get_registered_manager()
{
return *_registered;
}
// a History stub, should only save the last state included. but...
class History : public ObservedSubject
{
public:
memory::smart_ptr<sgpem::DynamicSchedulable> get_scheduled_at(int time) const {}
memory::smart_ptr<sgpem::SchedulableQueue> get_simulation_status_at(int time) const;
int get_current_time() const {return _total_time_elapsed;}
void enqueue_slice(const sgpem::SchedulableQueue& status);
void truncate_at(int instant) {}
static History& get_instance();
private:
History(int); //private constructor. The parameter is discarded
static History _instance;
int _total_time_elapsed;
std::vector<sgpem::Slice> _slices;
};
History&
History::get_instance()
{
if(!_instance) _instance = new Policy(3); // quantum size
return *_instance;
}
@ -217,85 +214,85 @@ namespace sgpem
class StepForwardTester
{
}
// from here and further until the bottom, all to throw away I suppose
int
main(int argc, char** argv) {
main(int argc, char** argv)
{
using namespace sgpem;
using Glib::Module;
using namespace sgpem;
using Glib::Module;
std::string command(ERERERT); // the sequence of commands to test
std::string command(ERERERT); // the sequence of commands to test
// sets up the test data
StaticProcess p1("P1", 1,5,1);
StaticProcess p2("P2", 5,55,2);
StaticProcess p3("P3", 36,30,3);
StaticProcess p4("P4", 4,26,3);
StaticProcess p5("P5", 15,200,3);
StaticProcess p6("P6", 6,250,1);
StaticProcess p7("P7", 8,42,15);
StaticProcess p8("P8", 8,56,1);
StaticProcess p9("P9", 9,42,1);
StaticProcess p10("PA", 12,42,1);
StaticProcess p11("PB", 106,42,1);
StaticProcess p12("PC", 100,42,1);
StaticProcess p13("PD", 29,42,18);
StaticProcess p14("PE", 0,42,1);
StaticProcess p15("PF", 2,88,1);
StaticProcess p16("PG", 3666,9,1);
StaticProcess p17("PH", 5,72,10);
StaticProcess p18("PJ", 6,26,1);
StaticProcess p19("PK", 10,24,17);
StaticProcess p20("PK2", 11,34,67); // not used!
// sets up the test data
StaticProcess p1("P1", 1, 5, 1);
StaticProcess p2("P2", 5, 55, 2);
StaticProcess p3("P3", 36, 30, 3);
StaticProcess p4("P4", 4, 26, 3);
StaticProcess p5("P5", 15, 200, 3);
StaticProcess p6("P6", 6, 250, 1);
StaticProcess p7("P7", 8, 42, 15);
StaticProcess p8("P8", 8, 56, 1);
StaticProcess p9("P9", 9, 42, 1);
StaticProcess p10("PA", 12, 42, 1);
StaticProcess p11("PB", 106, 42, 1);
StaticProcess p12("PC", 100, 42, 1);
StaticProcess p13("PD", 29, 42, 18);
StaticProcess p14("PE", 0, 42, 1);
StaticProcess p15("PF", 2, 88, 1);
StaticProcess p16("PG", 3666, 9, 1);
StaticProcess p17("PH", 5, 72, 10);
StaticProcess p18("PJ", 6, 26, 1);
StaticProcess p19("PK", 10, 24, 17);
StaticProcess p20("PK2", 11, 34, 67); // not used!
DynamicSchedulable ss1(p1);
DynamicSchedulable ss2(p2);
DynamicSchedulable ss3(p3);
DynamicSchedulable ss4(p4);
DynamicSchedulable ss5(p5);
DynamicSchedulable ss6(p6);
DynamicSchedulable ss7(p7);
DynamicSchedulable ss8(p8);
DynamicSchedulable ss9(p9);
DynamicSchedulable ss10(p10);
DynamicSchedulable ss11(p11);
DynamicSchedulable ss12(p12);
DynamicSchedulable ss13(p13);
DynamicSchedulable ss14(p14);
DynamicSchedulable ss15(p15);
DynamicSchedulable ss16(p16);
DynamicSchedulable ss17(p17);
DynamicSchedulable ss18(p18);
DynamicSchedulable ss19(p19); // not used!
DynamicSchedulable ss1(p1);
DynamicSchedulable ss2(p2);
DynamicSchedulable ss3(p3);
DynamicSchedulable ss4(p4);
DynamicSchedulable ss5(p5);
DynamicSchedulable ss6(p6);
DynamicSchedulable ss7(p7);
DynamicSchedulable ss8(p8);
DynamicSchedulable ss9(p9);
DynamicSchedulable ss10(p10);
DynamicSchedulable ss11(p11);
DynamicSchedulable ss12(p12);
DynamicSchedulable ss13(p13);
DynamicSchedulable ss14(p14);
DynamicSchedulable ss15(p15);
DynamicSchedulable ss16(p16);
DynamicSchedulable ss17(p17);
DynamicSchedulable ss18(p18);
DynamicSchedulable ss19(p19); // not used!
SchedulableQueue initial;
initial.add_at_bottom(ss1);
initial.add_at_bottom(ss2);
initial.add_at_bottom(ss3);
initial.add_at_bottom(ss4);
initial.add_at_bottom(ss5);
initial.add_at_bottom(ss6);
initial.add_at_bottom(ss7);
initial.add_at_bottom(ss8);
initial.add_at_bottom(ss9);
initial.add_at_bottom(ss10);
initial.add_at_bottom(ss11);
initial.add_at_bottom(ss12);
initial.add_at_bottom(ss13);
initial.add_at_bottom(ss14);
initial.add_at_bottom(ss15);
initial.add_at_bottom(ss16);
initial.add_at_bottom(ss17);
initial.add_at_bottom(ss18);
SchedulableQueue initial;
initial.add_at_bottom(ss1);
initial.add_at_bottom(ss2);
initial.add_at_bottom(ss3);
initial.add_at_bottom(ss4);
initial.add_at_bottom(ss5);
initial.add_at_bottom(ss6);
initial.add_at_bottom(ss7);
initial.add_at_bottom(ss8);
initial.add_at_bottom(ss9);
initial.add_at_bottom(ss10);
initial.add_at_bottom(ss11);
initial.add_at_bottom(ss12);
initial.add_at_bottom(ss13);
initial.add_at_bottom(ss14);
initial.add_at_bottom(ss15);
initial.add_at_bottom(ss16);
initial.add_at_bottom(ss17);
initial.add_at_bottom(ss18);
HistoryTester HT(initial);
HT.test("ERERERERTTTETRERERETETTTTTTTTTTTTTT");
HistoryTester HT(initial);
HT.test("ERERERERTTTETRERERETETTTTTTTTTTTTTT");
exit(0);
exit(0);
}