void
TestMultifunctionNode() {
    typedef tbb::flow::multifunction_node<int, tbb::flow::tuple<int, int>, P> multinode_type;
    REMARK("Testing multifunction_node");
    test_reversal<P,multinode_type> my_test;
    REMARK(":");
    tbb::flow::graph g;
    multinode_type mf(g, tbb::flow::serial, mf_body<multinode_type>(serial_fn_state0));
    tbb::flow::queue_node<int> qin(g);
    tbb::flow::queue_node<int> qodd_out(g);
    tbb::flow::queue_node<int> qeven_out(g);
    tbb::flow::make_edge(qin,mf);
    tbb::flow::make_edge(tbb::flow::output_port<0>(mf), qeven_out);
    tbb::flow::make_edge(tbb::flow::output_port<1>(mf), qodd_out);
    g.wait_for_all();
    for( int ii = 0; ii <
#if TBB_PREVIEW_FLOW_GRAPH_FEATURES
            2
#else
            1
#endif
            ; ++ii) {
        serial_fn_state0 = 0;
        if(ii == 0) REMARK(" reset preds"); else REMARK(" 2nd");
        qin.try_put(0);
        // wait for node to be active
        BACKOFF_WAIT(serial_fn_state0 == 0, "timed out waiting for first put");
        qin.try_put(1);
        BACKOFF_WAIT((!my_test(mf)), "Timed out waiting");
        ASSERT(my_test(mf), "fail second put test");
        g.my_root_task->cancel_group_execution();
        // release node
        serial_fn_state0 = 2;
        g.wait_for_all();
        ASSERT(my_test(mf), "fail cancel group test");
#if TBB_PREVIEW_FLOW_GRAPH_FEATURES
        if( ii == 1) {
            REMARK(" rf_extract");
            g.reset(tbb::flow::rf_extract);
            ASSERT(tbb::flow::output_port<0>(mf).my_successors.empty(), "output_port<0> not reset (rf_extract)");
            ASSERT(tbb::flow::output_port<1>(mf).my_successors.empty(), "output_port<1> not reset (rf_extract)");
        }
        else
#endif
        {
            g.reset();
        }
        ASSERT(mf.my_predecessors.empty(), "edge didn't reset");
        ASSERT((ii == 0 && !qin.my_successors.empty()) || (ii == 1 && qin.my_successors.empty()), "edge didn't reset");
    }
    REMARK(" done\n");
}
示例#2
0
int main() {

    my_test();


	return 0;
}
int main(int argc, char **argv)
{
  ros::init(argc, argv, "cds_control_node");
  ros::NodeHandle nh("~");
  CdsCartesianTestNode my_test(nh);
  my_test.run();
  return 0;
}
示例#4
0
TEST_P(classifier_test, save_load) {
  jubatus::util::math::random::mtrand rand(0);
  const size_t example_size = 1000;

  vector<pair<string, datum> > data;
  make_random_data(rand, data, example_size);
  for (size_t i = 0; i < example_size; i++) {
    classifier_->train(data[i]);
  }

  std::string save_data;

  save_model(classifier_->get_mixable_holder(), save_data);
  classifier_->clear();
  load_model(classifier_->get_mixable_holder(), save_data);

  my_test();
}
示例#5
0
文件: main.c 项目: pedgarcia/a2graph
int main(void)
{
    int i,j;
    
    gr_clearkey();
    printf("Press any key to start...");
    while(gr_khit()==0);

    gr_setmode(MODE_LORES_TEXT_PAGE_1);
    gr_fill(PAGE_1, BLACK);

    while(gr_khit()==0);
    
    my_test();
    j=0;
    for(i=0;i<48;i++) {
        gr_hlin(39,0,i,j,PAGE_1);
        j++;
        if (j==16) j=0;
    }

    j=0;
    for(i=0;i<40;i++) {
        gr_vlin(47,0,i,j,PAGE_1);
        j++;
        if (j==16) j=0;
    }
    gr_clearkey();
    while(gr_khit()==0);

    for (i=33;i>0;i--) {
        gr_sprite(i, 10, 6, 6, PAGE_1, sprite);
    }
    
    gr_clearkey();
    while(gr_khit()==0);
    for (i=0;i<16;i++) {
        gr_fill(0, i);
    }
    
    return 0;
}
示例#6
0
int main(void){
    my_test();
    int errcheck = 0;
    int *ERR = &errcheck;
    section_t *fourteen = section_new(ERR);
    if(error_output(ERR))
       return 0;
    section_auditory_add(fourteen, 67, 25, ERR);
    if(error_output(ERR))
       return 0;
    int plc = section_total_places(fourteen, ERR);
    if(error_output(ERR))
       return 0;
    printf("\nPlaces: %d", plc);
    auditory_occupy(fourteen, 67,  "Hadyniak", ERR);
    if(error_output(ERR))
       return 0;
    char *name = auditory_isoccupied(fourteen, 67, ERR);
    if(error_output(ERR))
       return 0;
    printf("Auditory 67-14 is occupied by %s", name);
    return 0;
}
示例#7
0
int kmain(unsigned int magic,multibootInfo *mb)
{
	construct(); //construct the global objects	
	char ans;
	cout<<"Nano OS is booting\n";
	String::strcpy(boot_dev,(const char *)mb->bootDevice);		
	memend=mb->memoryUpper*1024+0x100000; //memory end upper memory in bytes +1MB
	// well now show the world we have managed our Memory ;)
		
	multiboot *m_boot;
	m_boot=multiboot::Instance();
	m_boot->set_multiboot_info(mb);
	m_boot->set_multiboot_hdr();
	cout<<"===============================\n";
	cout<<"Available Memory : "<<(unsigned int)m_boot->get_mem_avail()/1024<<"\n";
	cout<<"     Used Memory : "<<(unsigned int)m_boot->get_mem_used()/1024<<"\n";
	cout<<"===============================\n";	
		
	cout.flags(hex|showbase);
	cout<<"Kernel start "<<(unsigned int)m_boot->get_k_start()<<" Kernel end "<<(unsigned int)m_boot->get_k_end() \
		<<" kernel length ="<<(unsigned int)m_boot->get_k_length()<<"\n";
	
	cout.flags(dec);
	kend = m_boot->get_k_end();	

	// Before we do any thing we should initialize our Heap based memory allocator( Thanks to Chris Giese )
	init_heap();

	// Setup our Descriptor tables GDT and IDT
	cout<<"Setting up GDT ";
	GDT::setup();
	cout.SetColour(RED,BLACK,0);
	cout<<"done\n";
	cout.SetColour(WHITE,BLACK,0);
	cout<<"setting up IDT ";
	IDT::setup();
	cout.SetColour(RED,BLACK,0);
	cout<<"done\n";
	cout.SetColour(WHITE,BLACK,0);

	// After our IDT is loaded We should install our interrupt
	cout<<"setting up IRQ subsystem ";
	IRQ::setup();
	cout.SetColour(RED,BLACK,0);
	cout<<"done\n";
	cout.SetColour(WHITE,BLACK,0);

	// Now, as our IRQ subsystem is set we should install keyboard sothat, our system will be interractive.
	cout<<"installing key board \n";
	kbd::setup();
	cout.SetColour(RED,BLACK,0);
	cout<<"done\n";
	cout.SetColour(WHITE,BLACK,0);
	
	
	// The operating system and the digital computers are worthless if there is no timer
	// so install and initialize the timer
	cout<<"installing timer interrupt ";
	TIMER *my_timer =  TIMER::Instance();	
	my_timer->setup();
	cout.SetColour(RED,BLACK,0);
	cout<<"done\n";
	cout.SetColour(WHITE,BLACK,0);
	cout<<"my_timer at "<<(unsigned int)my_timer<<"\n";	
	cout<<"Mboot at "<<(unsigned int)m_boot<<"\n";

	// So all the basic systems are in place now 
	// We should initialize the PCI subsystem
	cout<<"Scanning PCI...\n";
	pci_bus *sys_pci_bus=pci_bus::Instance();
	sys_pci_bus->scan();
	sys_pci_bus->list_dev();
	cout.SetColour(RED,BLACK,0);
	cout<<"done\n";
	cout.SetColour(WHITE,BLACK,0);
	// now we can start our interrupt system
	cout<<"\n\n"<<"Enabling Interrupts   ";
	enable();
	cout.SetColour(RED,BLACK,0);
	cout<<"done\n";
	cout.SetColour(WHITE,BLACK,0);
	// now check if we have any PCI IDE
	cout<<"Initilizing storage susbsystem(PCI-IDE)    ";
	init_disks();
	cout.SetColour(RED,BLACK,0);
	cout<<"done\n";	
	cout.SetColour(WHITE,BLACK,0);
	
	cout<<"Initializing Net device...";
	detect_netdev();
	cout.SetColour(RED,BLACK,0);
	cout<<"done\n";
	cout.SetColour(WHITE,BLACK,0);
	
	
	//cout<<"\nDone\n";
	//here let us try our Network ethernet device setup
	
	//sys_nic0->send_arp_request();
	//cout<<"net init complete\n";
	//cout<<"sending\n";
		//for(int i=0;i<10;i++)
		//	test_req_arp();	
	// show which IRQs are installed not necessary but it comes handy while debugging the ISRs.
	//cout<<"\n"<<"Dumping IRQ routines \n";
	//IRQ::dump_irq_routines();
	// Our tasks are thread implemented in kernel and it depends on timer interrupt
	// so now we can start the tasking subsystem
	//cout<<"Initializing tasking ";
	//init_tasks();
	// bellow this we should not see anything.. why? because in the tasks we started 2 threads 
	// one idle thread and other is our Shell	
	//cout<<"done\n";

	init_syscall();
	my_test();
	for(;;);
	cout<<"\nReached End of kernel\n shoud not happen \n\nGOODBYE\n";
	disable();
	halt();	
	
	return 0;	
}
示例#8
0
TEST_P(classifier_test, my_test) {
  my_test();
}