sgpemv2/src/testsuite/test-parse_command.cc
elvez 8062dd95da - Completed renaming of class SchedulableList to SchedulableQueue
git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@603 3ecf2c5c-341e-0410-92b4-d18e462d057c
2006-06-03 15:19:13 +00:00

117 lines
3.2 KiB
C++

// src/testsuite/test-parse_command.cc - Copyright 2005, 2006, University
// of Padova, dept. of Pure and Applied
// Mathematics
//
// This file is part of SGPEMv2.
//
// This is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// SGPEMv2 is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// 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
* classTextSimulation class and the StandardIO class. */
#include "standard_io.hh"
#include "text_simulation.hh"
#include "templates/smartp.hh"
#include <cassert>
#include <string>
#include "config.h"
#include "gettext.h"
#include "glibmm/ustring.h"
#include <vector>
#include <iostream>
#include "backend/process.hh"
#include "backend/slice.hh"
#include "backend/observed_subject.hh"
#include "backend/schedulable_queue.hh"
#include "backend/schedulable_status.hh"
namespace sgpem
{
/* 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::SchedulableStatus> 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;
};
TestHistory* TestHistory::_instance = 0;
History&
TestHistory::get_instance()
{
if(!_instance)
_instance = new TestHistory();
return *_instance;
}
}//~ namespace sgpem
int
main(int, char**) {
using namespace sgpem;
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);
}