예제 #1
0
void search()
{
    joint_bound = 0, joint_cost = INFINITE;
    while (agents.size() * joint_bound < joint_cost && Clock::now() < timeout) // watch for overflow
    {
        joint_bound = INFINITE;
        for (Agent& agent : agents)
        if (!agent.open.empty())
        {
            //get a State to expand
            State s = agent.remove();
            num_expands++;
            if (s.pos == agent.startPos)
            {
                for (Agent& a : agents)
                    a.foundIt = a.found.cbegin();
                agent.found.push_back(s);
                agent.foundIt = agent.found.cend();
                --agent.foundIt;
                Clock::time_point t0 = Clock::now();
                testAll(0);
                Clock::time_point t1 = Clock::now();
                test_duration += chrono::duration<double, chrono::seconds::period>(t1-t0).count();
            }
            //cout << "expanding " << s << endl;
            agent.expand(s);
            if (!agent.open.empty())
            {
                agent.fmin = max(agent.fmin, agent.open.cbegin()->first);
                joint_bound = min(joint_bound, agent.fmin);
            }
        }
    }
}
예제 #2
0
int main() {
    testAll();

    PetRepo *repo = createRepo();
    PetController* ctr = createController(repo);
    addSamplePets(ctr);
    startUI(ctr);
    return 0;
}
예제 #3
0
void testAll(int pos)
{
    if (Clock::now() >= timeout)
        return;
    if (pos == agents.size())
    {
        vector<State> starts;
        for (Agent& agent : agents)
            starts.push_back(*agent.foundIt);
        testSolution(starts, false);
        return;
    }
    if (agents[pos].foundIt == agents[pos].found.cend())
        return;
    testAll(pos+1);
    ++agents[pos].foundIt;
    testAll(pos);
    --agents[pos].foundIt;
}
예제 #4
0
int main()
{
    try {
        testAll();

        plot();
    }
    catch (const std::exception &e) {
        std::cout << "Caught OPM exception: " << e.what() << "\n";
    }

    return 0;
}
예제 #5
0
파일: data.c 프로젝트: jaingaurav/rstm
int
main ()
{
    puts("Test 1:");
    testAll(10, 20, 10, 10);

    puts("Test 2:");
    testBasic(20, 80, 10, 20);

    puts("Done");

    return 0;
}
예제 #6
0
int main(int argc, char **argv)
{
    Dune::MPIHelper::instance(argc, argv);

    try {
        testAll();
        plot();
    }
    catch (const std::exception &e) {
        std::cout << "Caught OPM exception: " << e.what() << "\n";
    }

    return 0;
}
예제 #7
0
int main()
{
  // Set up the library and paths
  PHYSFS_init("blah");
  PHYSFS_addToSearchPath("test.zip", 1);
  PHYSFS_addToSearchPath("./", 1);

  // Create our interface
  PhysVFS vfs;

  // Run the test
  testAll(vfs);

  return 0;
}
예제 #8
0
int main(int argc, char **argv)
{
  nsresult res;

  res = init();
  if (NS_FAILED(res)) return -1;

  if (argc <= 1) {
    printf("*** Unicode Converters Test ***\n");
    res = testAll();
    printf("\n***---------  Done  --------***\n");
  } else {
    res = testFromArgs(argc, argv);
  }

  done();

  if (NS_FAILED(res)) return -1;
  else return 0;
}
예제 #9
0
int main (int argc, char** argv) {
  testAll();
}
예제 #10
0
void TestStatistics::run()
{
  testAll();
}
예제 #11
0
int main() {
 
  struct gameState state;
  int kingdomCards[10] = {adventurer, council_room, feast, gardens, mine, 
                          remodel, smithy, village, baron, great_hall};
  int randomSeed = 1000;   // example unittest
  int player;
  int countsBefore[PLAYERS+1][PILES];
  int countsAfter[PLAYERS+1][PILES];

  memset(&state, '\0', sizeof(struct gameState)); // clear game state

  printf("****************************************************************\n");
  printf("***                      ADVENTURER                          ***\n");
  printf("****************************************************************\n");
  initializeGame(PLAYERS, kingdomCards, randomSeed, &state);
  player = state.whoseTurn;
  cardCounts(&state, countsBefore);
  adventurerEffect(player, &state);
  cardCounts(&state, countsAfter);
  otherPlayerCounts(player, countsBefore, countsAfter);
  
  
  initializeGame(PLAYERS, kingdomCards, randomSeed, &state);
  player = state.whoseTurn;
  testFirst(&state, player, copper); 
  
  initializeGame(PLAYERS, kingdomCards, randomSeed, &state);
  player = state.whoseTurn;
  testMiddle(&state, player, copper); 

  initializeGame(PLAYERS, kingdomCards, randomSeed, &state);
  player = state.whoseTurn;
  testLast(&state, player, copper); 

  initializeGame(PLAYERS, kingdomCards, randomSeed, &state);
  player = state.whoseTurn;
  testAll(&state, player, copper); 

  initializeGame(PLAYERS, kingdomCards, randomSeed, &state);
  player = state.whoseTurn;
  testFirst(&state, player, silver); 

  initializeGame(PLAYERS, kingdomCards, randomSeed, &state);
  player = state.whoseTurn;
  testMiddle(&state, player, silver); 

  initializeGame(PLAYERS, kingdomCards, randomSeed, &state);
  player = state.whoseTurn;
  testLast(&state, player, silver); 

  initializeGame(PLAYERS, kingdomCards, randomSeed, &state);
  player = state.whoseTurn;
  testAll(&state, player, silver); 

  initializeGame(PLAYERS, kingdomCards, randomSeed, &state);
  player = state.whoseTurn;
  testFirst(&state, player, gold); 

  initializeGame(PLAYERS, kingdomCards, randomSeed, &state);
  player = state.whoseTurn;
  testMiddle(&state, player, gold); 

  initializeGame(PLAYERS, kingdomCards, randomSeed, &state);
  player = state.whoseTurn;
  testLast(&state, player, gold); 

  initializeGame(PLAYERS, kingdomCards, randomSeed, &state);
  player = state.whoseTurn;
  testAll(&state, player, gold); 

  initializeGame(PLAYERS, kingdomCards, randomSeed, &state);
  player = state.whoseTurn;
  testNone(&state, player);

  initializeGame(PLAYERS, kingdomCards, randomSeed, &state);
  player = state.whoseTurn;
  testEmptyDeck(&state, player);

  return 0;
}
예제 #12
0
Main::Main()
{
    setIcon( (const char**)logo_xpm );
#ifdef FIXED_LAYOUT
    QHBox* horizontal = new QHBox(this);
#else
    QSplitter* horizontal = new QSplitter(this);
#endif

    lv = new QListView(horizontal);
    lv->setSorting(-1);
    lv->setRootIsDecorated(TRUE);
    lv->addColumn("ID");

    info = new Info(horizontal);
    info->setBackgroundMode(PaletteBase);
    info->setMargin(10);
    info->setFrameStyle(QFrame::WinPanel|QFrame::Sunken);
    info->setAlignment(AlignTop);

    connect(info, SIGNAL(idClicked(const QString&)),
	    this, SLOT(selectId(const QString&)));

#ifdef FIXED_LAYOUT
    horizontal->setStretchFactor(info,2);
#endif

    connect(lv, SIGNAL(pressed(QListViewItem*)),
	    this, SLOT(updateAvailability(QListViewItem*)));
    connect(lv, SIGNAL(selectionChanged(QListViewItem*)),
	    this, SLOT(showInfo(QListViewItem*)));

    setCentralWidget(horizontal);

    QToolBar* tb = new QToolBar( this, "browser controls" );
    tb->setLabel( "Browser Controls" );
    (void)new QToolButton( QPixmap(back_xpm), "Back", QString::null,
                           info, SLOT(back()), tb, "back" );
    (void)new QToolButton( QPixmap(forward_xpm), "Forward", QString::null,
                           info, SLOT(forward()), tb, "forward" );

    QPopupMenu* file = new QPopupMenu( menuBar() );
    file->insertItem( "&Open",  this, SLOT(open()), CTRL+Key_O );
    file->insertItem( "&Save", this, SLOT(save()), CTRL+Key_S );
    file->insertSeparator();
    file->insertItem( "&Test all", this, SLOT(testAll()), CTRL+Key_T );
    file->insertSeparator();
    file->insertItem( "E&xit",  qApp, SLOT(quit()), CTRL+Key_Q );

    menuBar()->insertItem( "&File",file );

    menuBar()->insertSeparator();

    QPopupMenu *help = new QPopupMenu( menuBar() );
    help->insertItem( "&About", this, SLOT(about()) );
    help->insertItem( "About &Qt", this, SLOT(aboutQt()) );

    menuBar()->insertItem( "&Help", help );

    statusBar()->message( "Ready" );
}
예제 #13
0
void testBoth(const std::string &sr0)
{
  testAll("no-upgrade", false, sr0);
  testAll("upgrade", true, sr0);
}
예제 #14
0
파일: testrandom.C 프로젝트: davidlt/root
void testrandom()
{
   testRandom3();
   testAll();
}
예제 #15
0
파일: main.c 프로젝트: daweskie/DODSAAP
int main ()
{
    testAll();
	return 0;
}
예제 #16
0
int main(){
	//test_createReadToFileOne();
	testAll();
}
예제 #17
0
int main(int argc, char** argv) {
  testAll();
  return 0;
}
예제 #18
0
int main()
{testAll();
showMenu();
    return 0;
}