Exemplo n.º 1
0
TEST(test_encode_decode, test_list_of_objects) {
    test_list(std::vector<krpc::services::TestService::TestClass>(), "");
    {
        std::vector<krpc::services::TestService::TestClass> l;
        l.push_back(krpc::services::TestService::TestClass(nullptr, 1));
        l.push_back(krpc::services::TestService::TestClass(nullptr, 2));
        l.push_back(krpc::services::TestService::TestClass(nullptr, 3));
        test_list(l, "0a01010a01020a0103");
    }
}
Exemplo n.º 2
0
void mw::XMLParserTestFixture::testLoadList() {
	CPPUNIT_ASSERT(testVar->getValue().getFloat() == 0.0);		
	
	const char *xml_text =
	"<?xml version=\"1.0\"?>"
	"<monkeyml version=\"1.1\">"
	"<variable_assignments>"
	"<variable_assignment variable=\"testVar\">"
	"<list>"
	"<list_element>"
	"<value type=\"integer\">4</value>"
	"</list_element>"
	"<list_element>"
	"<value type=\"integer\">6</value>"
	"</list_element>"
	"</list>"
	"</variable_assignment>"
	"</variable_assignments>"
	"</monkeyml>";
	writeToFile(xml_text);
	
	mw::VariableLoad::loadExperimentwideVariables(temp_xml_file_path);
	
	mw::Data test_list(M_LIST, 2);
	test_list.setElement(0, mw::Data(4L));
	test_list.setElement(1, mw::Data(6L));
	
	CPPUNIT_ASSERT(testVar->getValue() == test_list);			
}
Exemplo n.º 3
0
void kmain(multiboot_info_t* mbt, unsigned int magic)
{
    if (magic != MULTIBOOT_BOOTLOADER_MAGIC)
        return;

    graphics_init();

    /* Core modules */
    gdt_init();
    idt_init();
    irq_init();
    isr_init();
    
    /* Kernel heap */
    heap_init();
    
    /* Drivers */
    timer_init();
    tasking_init();
    keyboard_init();
    
    /* Let the games begin */
    set_interrupts(ENABLED);
    
    kprintf("Running kernel tests...\n\n");
    test_kmalloc_kfree();
    test_list();
    test_tasking();
    kprintf("\nDone with kernel tests.\n");
    
    for (;;);
}
Exemplo n.º 4
0
int main(int argc, char **argv)
{
    int suite = -1, tcase = -1;

    setenv("NTFSV_TRACE_PATHNAME", "/hostfs/repl-opensaf/saflog/ntfa.log", 1);

    srandom(getpid());

    if (argc > 1)
    {
        suite = atoi(argv[1]);
    }

    if (argc > 2)
    {
        tcase = atoi(argv[2]);
    }

    if (suite == 0)
    {
        test_list();
        return 0;
    }

    test_run(suite, tcase);

    return 0;
}
Exemplo n.º 5
0
    TEST_F( ValueList_TEST
          , ListIsCappedToLimit__OldValuesPoppedFromFront )
    {
        EXPECT_CALL( mock_module__
                   , getValue() )
            .Times( 101 )
            .WillOnce( ::testing::Return( 200.0f ) )
            .WillRepeatedly( ::testing::Return( 100.0f ) );

        for( int i = 0;
             i < 100;
             ++i )
        {
            signal__->emit();
        }
        std::list< variant > test_list( value_list__.getValueList() );
        EXPECT_EQ( 100
                 , test_list.size() );
        EXPECT_EQ( 200.0f
                 , test_list.front() );

        signal__->emit();
        test_list = value_list__.getValueList();
        EXPECT_EQ( 100
                 , test_list.size() );
        EXPECT_EQ( 100.0f
                 , test_list.front() );
    }
Exemplo n.º 6
0
Arquivo: test_main.c Projeto: liva/nci
int main(int argc, char **argv) {
  test_list();
  test_ast();
  test_ir();
  printf("test passed!\n");
  return 0;
}
Exemplo n.º 7
0
int main(int argc, char **argv) 
{
    int suite = ALL_SUITES, tcase = ALL_TESTS;

    srandom(getpid());
    clm_init();	

    if (argc > 1)
    {
        suite = atoi(argv[1]);
    }

    if (argc > 2)
    {
        tcase = atoi(argv[2]);
    }

    if (suite == 0)
    {
        test_list();
        return 0;
    }

    return test_run(suite, tcase);
}  
Exemplo n.º 8
0
TEST(test_encode_decode, test_list) {
    test_list(std::vector<pb::uint32>(), "");
    {
        std::vector<pb::uint32> l;
        l.push_back(1);
        test_list(l, "0a0101");
    }
    {
        std::vector<pb::uint32> l;
        l.push_back(1);
        l.push_back(2);
        l.push_back(3);
        l.push_back(4);
        test_list(l, "0a01010a01020a01030a0104");
    }
}
Exemplo n.º 9
0
void mw::XMLParserTestFixture::testLoadDictionaryInList() {
	CPPUNIT_ASSERT(testVar->getValue().getFloat() == 0.0);		
	
	const char *xml_text =
	"<?xml version=\"1.0\"?>"
	"<monkeyml version=\"1.1\">"
	"  <variable_assignments>"
	"    <variable_assignment variable=\"testVar\">"
	"      <list>"
	"       <list_element>"
	"         <value>"
	"           <dictionary>"
	"             <dictionary_element>"
	"               <value type=\"integer\">11</value>"
	"               <key>one</key>"
	"             </dictionary_element>"
	"             <dictionary_element>"
	"               <value type=\"integer\">12</value>"
	"               <key>two</key>"
	"             </dictionary_element>"
	"           </dictionary>"
	"         </value>"
	"       </list_element>"
	"       <list_element>"
	"         <value>"
	"           <dictionary>"
	"             <dictionary_element>"
	"               <key>one</key>"
	"               <value type=\"integer\">21</value>"
	"             </dictionary_element>"
	"             <dictionary_element>"
	"               <key>two</key>"
	"               <value type=\"integer\">22</value>"
	"             </dictionary_element>"
	"           </dictionary>"
	"         </value>"
	"       </list_element>"
	"      </list>"
	"    </variable_assignment>"
	"  </variable_assignments>"
	"</monkeyml>";
	
	writeToFile(xml_text);
	
	mw::VariableLoad::loadExperimentwideVariables(temp_xml_file_path);
	
	mw::Data subdict1(M_DICTIONARY, 2);
	subdict1.addElement("one", mw::Data(11L));
	subdict1.addElement("two", mw::Data(12L));
	
	mw::Data subdict2(M_DICTIONARY, 2);
	subdict2.addElement("one", mw::Data(21L));
	subdict2.addElement("two", mw::Data(22L));
	
	mw::Data test_list(M_LIST, 2);
	test_list.setElement(0, subdict1);
	test_list.setElement(1, subdict2);
	
	CPPUNIT_ASSERT(testVar->getValue() == test_list);			
}
Exemplo n.º 10
0
int main(int argc, char* argv[]) {
    if (argc < 2) {
        test_slist();
        test_list();
        return 0;
    }

    switch(argv[1][0]) {
    case 's': std::cout << "slist_t:   "; test_slist(); break;
    case 'l': std::cout << "std::list: "; test_list();  break;
    default:
        std::cout << "Use 's' for testsing slist performance "
                     "and 'l' for testsing std::list performance.";
    }

    return 0;
}
Exemplo n.º 11
0
int main(int argc, char **argv)
{
    test_str();
    test_vec();
    test_matrix();
    test_stats(); 
    test_list();
}
Exemplo n.º 12
0
TEST(LinkedListExcercisesTestSuite, RemoveDuplicates_02)
{
    int test_data[4] = { 2,2,2,2 };
    LinkedList<int> test_list(test_data, 4);
    int expected_data[1] = { 2 };
    LinkedList<int> expected_list(expected_data, 1);
    LinkedListExercises::RemoveDuplicates(test_list);
    EXPECT_TRUE(LinkedListExercises::CompareLists(expected_list, test_list));
}
Exemplo n.º 13
0
int main(int argc, char **argv) {
    test_string();
    test_list();
    test_map();
    test_map_stack();
    test_dict();
    printf("Passed\n");
    return 0;
}
Exemplo n.º 14
0
int aim_main(int argc, char* argv[])
{
    test_bucket();
    test_basic();
    test_all();
    test_list();
    test_find();
    return 0;
}
Exemplo n.º 15
0
bool unit_test()
{
    bool test_result = true; // true == passed

    CHECK(test_vector(), "Unit test test_vector failed\n");
    CHECK(test_list(), "Unit test test_list failed\n");
    
    return test_result;
}
Exemplo n.º 16
0
void run_tests() {
	test_entry_expansion();
	test_table_expansion();
	test_automaton_eval();
	test_list();
	test_bs_build();
	test_stack();
	test_queue();
}
Exemplo n.º 17
0
int main(int argc, char* argv[])
{
    test_list();

    test_q();

    test_stack();

    return 0;
}
Exemplo n.º 18
0
int
main( void )
{
    int i;

    if( ( i = test_list( ) ) )
        return i;

    return 0;
}
Exemplo n.º 19
0
static int test_open(const char *name) {
    int fd;
    Msg m;
    m.ret = FM_ERR;
    m.req_pid = (int) current;
    m.buf = current;
    m.dev_id = (int) name;
    fd = open_file(&m);
    test_list(NULL);
    return fd;
}
Exemplo n.º 20
0
int main()
{
  switch(nondet_int())
  {
  case 0: test_vector(); break;
  case 1: test_list(); break;
  case 2: test_set(); break;
  
  default:;
  }
}
Exemplo n.º 21
0
int main(int argc, char *argv[])
{
	test_list();
	test_dlist();
	test_stack();
	test_evaluate();
	
	puts("##########################################");	
	puts("all tests have been completed!!");
	puts("##########################################");

	return 0;
}
Exemplo n.º 22
0
static int set_fd_msg(int fd, int (*f)(Msg *)) {
    Msg m;
    m.ret = FM_ERR;
    m.buf = current;
    m.dev_id = fd;
    int res = f(&m);
    test_list(NULL);
    if (m.ret == SUCC) {
        return res;
    }
    assert(res == INVALID_FD_I);
    return m.ret;
}
Exemplo n.º 23
0
static int test_dup2(int old_fd, int new_fd) {
    int dup_fd;
    Msg m;
    m.ret = FM_ERR;
    m.i[2] = (int) current;
    m.i[0] = (int) old_fd;
    m.i[1] = (int) new_fd;
    dup_fd = dup2_file(&m);
    assert(m.ret == SUCC);
    test_list(NULL);

    return dup_fd;
}
Exemplo n.º 24
0
int main(int argc, char* argv[])
{
	test_basic();
	test_iteration();
	test_find();
	test_erase();
	test_list();
	test_unordered();
	int a = sizeof(obj);
	int b = sizeof(boost::optional<obj&>);
	int xx = 0;
	return boost::report_errors();
}
Exemplo n.º 25
0
int list_test(std::vector<std::string> args)
{
    size_t argc = args.size();
    for (size_t i = 0; i < argc; ++i)
    {
        if (i == 0) continue;
        std::cout << "Param[" << i << "] : " << args[i] << std::endl;
    }

    test_list();

    return 0;
}
Exemplo n.º 26
0
bool test_all()
{
	printf("Test Stack: %s\n",  test_stack()?"PASS":"******");
	printf("Test Queue: %s\n",  test_queue()?"PASS":"******");
	printf("Test List:  %s\n",  test_list()?"PASS":"******");
	printf("Test MinHeap: %s\n",test_minheap()?"PASS":"******");
	printf("Test MaxHeap: %s\n",test_maxheap()?"PASS":"******");
	printf("Test RedBlack: %s\n", /*test_redblack()*/false?"PASS":"******");
	printf("Test BST: %s\n", test_bst()?"PASS":"******");
	printf("Test HashTable: %s\n",test_hashtable()?"PASS":"******");
	printf("Test Tuple: %s\n",test_tuple()?"PASS":"******");
	if(DEBUG)functional_tests();
	return 1;
}
Exemplo n.º 27
0
int main()
{
  #ifdef NDEBUG
    printf("Must compile without NDEBUG=1\n");
    exit(-1);
  #endif

  test_buffer();
  test_list();
  test_linked_list();

  printf("  Tests Finished. Zero Errors\n");
  return 0;
}
Exemplo n.º 28
0
Arquivo: main.cpp Projeto: irov/pybind
void main()
{
	pybind::initialize( false, false, true );

	bool gc_exist;
	PyObject * gc = pybind::module_import( "gc", gc_exist );

	pybind::call_method( gc, "disable", "()" );

	PyObject * module = pybind::module_init( "Test" );

	pybind::set_currentmodule( module );

	Helper * helper = new Helper;

	pybind::class_<Bar>( "Bar" )
		.def( "foo", &Bar::foo )
		.def( "min", &Bar::min )
		.def_property( "data", &Bar::getData, &Bar::setData )
		.def_proxy_static( "helper_for_script_function", helper, &Helper::helper_for_script_function )
		;

	pybind::class_<Vec2>( "Vec2" )
		.def_constructor( pybind::init<float, float>() )
		.def_member( "x", &Vec2::x )
		.def_member( "y", &Vec2::y )
		;

	Bar * b = new Bar;

	PyObject * py_b = pybind::ptr( b );

	PyObject * g = nullptr;

	bool exist;
	PyObject * m = pybind::module_import( "Test1", exist );

	test_function_decl();
	
	for( uint32_t i = 0; i != 100000; ++i )
	{
		test_dict( i );
		test_list( i );
		test_tuple( i );
		test_function( m, i );
	}

	printf( "done" );
}
Exemplo n.º 29
0
int main() {
	nano_init();

	printf("Tommy check program.\n");

	test_list();
	test_array();
	test_arrayblk();
	test_hashtable();
	test_hashdyn();
	test_hashlin();

	printf("OK\n");

	return EXIT_SUCCESS;
}
Exemplo n.º 30
0
/* =========== RemoveDuplicates ================*/
TEST(LinkedListExcercisesTestSuite, RemoveDuplicates_01)
{
    int test_data[5] = { 2, 4, 2, 7, 8 };
    LinkedList<int> test_list(test_data, 5);
    int expected_data[4] = { 2, 4, 7, 8 };
    LinkedList<int> expected_list(expected_data, 4);
    LinkedListExercises::PrintList(test_list, "test_list before");
    LinkedListExercises::RemoveDuplicates(test_list);
    LinkedListExercises::PrintList(test_list, "test_list after");
    LinkedListExercises::PrintList(expected_list, "expected_list");
    EXPECT_TRUE(LinkedListExercises::CompareLists(expected_list, test_list));

    //test empty list:
    LinkedList<int> empty_list;
    LinkedListExercises::RemoveDuplicates(empty_list);
}