Page MenuHomePhabricator

Answer to Jack's question (13 Dec)
ActivePublic

Authored by jcmcdonald on Dec 13 2022, 5:06 AM.
#ifndef GOLDILOCKS_SHELL_HPP
#define GOLDILOCKS_SHELL_HPP
 
#include <iostream>
#include "iosqueak/blueshell.hpp"
#include "goldilocks/test.hpp"
 
using _register = std::function<int(std::deque<std::string>&)>;
class Goldilocks_Shell: public Blueshell{
 
private:
/* information about the a specific test */
int about(std::deque<std::string>& tests);
 
/* Runs a benchmark on [test], using its registered
* comparative, with (number) repetitions. */
int benchmark(Test&, int);
 
/* Runs a comparative benchmark between [test1] and
* [test2] with (number) repetitions. This is seldom
* used, as its prone to apples-and-oranges comparisons,
* unlike benchmark, but it can be useful at times. */
int compare(Test&, Test&, int);
 
public:
// All member functions must be declared in the header first, at least as a prototype (no body).
void start_shell();
void test();
};
 
#endif // GOLDILOCKS_SHELL_HPP
 
 
 
//In the cpp file
#include "../include/goldilocks/goldilocks_shell.hpp"
 
// Then we declare the actual implementations here.
void Goldilocks_Shell::start_shell(){
Blueshell::initial_shell();
std::cout<<"Running start_shell\n";
}
 
void Goldilocks_Shell::test(){std::cout<<"Testing\n";}
 
int Goldilocks_Shell::about(std::deque<std::string>& options){
std::cout<< "About is running\n"<<options.size();
return 0;
}
 

Event Timeline

jcmcdonald changed the title of this paste from untitled to Answer to Jack's question (13 Dec).
jcmcdonald updated the paste's language from autodetect to cpp.