Ejemplo n.º 1
0
static void test_add(void)
{
  int i, *num;
  /* I fill the array and for each entry I controll its arguments */
  for(i = 0; i < list_a->size; i++) {
    num = calloc(1, sizeof(int));
    assert(!(num == NULL));
    *num = i+1; 
    list_add(list_a, num);
    test_entry(list_a, i, num);

    assert(!(list_a->nentry != i+1));
  }
  assert(!(list_a->nentry != i));
  
  /* I add another entry to test the reallocation of the array */
  num = calloc(1, sizeof(int));
  assert(!(num == NULL));
  *num = 1234;
  list_add(list_a, num);
  
  /* I test the new entry */
  test_entry(list_a, initial_size, num);

  /* and the new size, nfds */
  assert(!(list_a->size != initial_size*2));
  assert(!(list_a->nentry != initial_size+1));

  /* I test the newly created empty entries */
  for(i = list_a->nentry; i < list_a->size; i++)
    assert(!(list_a->v[i] != NULL));

}
Ejemplo n.º 2
0
static void
test_fgetgrent (const char *filename)
{
  struct group *g;
  FILE *f;

  f = fopen (filename,"r");

  g = fgetgrent (f);
  test_entry ("one", 1, g);
  g = fgetgrent (f);
  test_entry ("two", 2, g);
  g = fgetgrent (f);
  test_entry ("three", 3, g);
  fclose (f);
}
Ejemplo n.º 3
0
int main (int, char *[])
{
  char line[80];
  test_entry();
  puts ("Ok, go... hit return to stop.");
  gets (line);
  return 0;
}
Ejemplo n.º 4
0
static void test_del(void)
{
  int *num;
  num = list_del(list_d, 3);
  test_entry(list_d, 3, NULL);
  assert(!(*num != 3));
  free(num);
  assert(!(list_d->nentry != initial_size - 1));


  num = list_del(list_d, 5);
  test_entry(list_d, 5, NULL);
  assert(!(*num != 5));
  free(num);
  assert(!(list_d->nentry != initial_size - 2));
  
  num = calloc(1, sizeof(int));
  list_add(list_d, num);
  test_entry(list_d, 3, num);
  assert(!(list_d->nentry != initial_size - 1));
  free(num);
  
}
Ejemplo n.º 5
0
layout_entry_t *
layout_get_entry(lua_State *L, int layout_ix, int key_ix)
{
	void *entry = NULL;

	luau_getref(L, layout_ix);
	luau_gettable(L, -1, key_ix);
	if (lua_isnil(L, -1))
		goto end;

	entry = test_entry(L, -1);

end:
	lua_pop(L, 2);
	return entry;
}
Ejemplo n.º 6
0
//================================================================================================
// 메인함수
//================================================================================================
int main(void)
{
	return test_entry();
//	return c_entry();
}
Ejemplo n.º 7
0
int main(void)
{                               
	const int flash_burn = 0;

	int testcpu;

	initboard();
	initsdram();
	com_init();
	
	sendtocom0("LH-1008 Satellite Navigation System\n\n\n");

	initmodules();

	//TestCPU
	testcpu = (0xabcddcba * 0x56899865 + 0xccdd) / 0xaabb;
	testcpu <<= 16;
	testcpu = ~testcpu;

	if (testcpu == 0x11DCFFFF) {

		sendtocom0("Satellite Navigation System Start\n\n");

	}

	//Test Flash
	if (flash_burn == 1) {

		Flash_Chip_Erase();
		printf("Flash Erase Complete\n");

		Flash_Writem(FLASH_BASE_ADDR, 0x000, 0x48);
		Flash_Writem(FLASH_BASE_ADDR+0x400, (Uint32*)0x400, 0x5b30);
		printf("Flash Write Complete\n");
	}

	test_entry();

/*
	printf("TEST SDRAMing... Write 0x00000000\t\n");

	for (i=0; i<0x1000000; i++)
		write16((0x80000000 + i*2), 0x0);

	for (i=0; i<0x1000000; i++) {

		tmptest = read16(0x80000000 + i*2);

		if (tmptest != 0) {

			printf("SDRAM Check failed...\t\n");
			printf("i=0x%x\r\n", i);
			printf("tmptest=0x%x\r\n", tmptest);
			printf("testram=0x%x\r\n", testram);
		}
	}

	printf("SDRAM Check 0x00000000 OK\t\n");

	printf("TEST SDRAMing... Write 0xFFFFFFFF\t\n");

	for (i=0; i<0x1000000; i++)
		write16((0x80000000 + i*2), 0xffff);

	for (i=0; i<0x1000000; i++) {

		tmptest = read16(0x80000000 + i*2);

		if (tmptest != 0xffff) {

			printf("SDRAM Check failed...\t\n");
			printf("i=0x%x\r\n", i);
			printf("tmptest=0x%x\r\n", tmptest);
			printf("testram=0x%x\r\n", testram);
		}
	}

	printf("SDRAM Check 0xFFFFFFFF OK\t\n");

	printf("TEST SDRAMing... Write 0xAAAAAAAA\t\n");

	for (i=0;i<0x1000000; i++)
		write16((0x80000000 + i*2), 0xaaaa);

	for (i=0; i<0x1000000; i++) {

		tmptest = read16(0x80000000 + i*2);

		if (tmptest != 0xaaaa) {

			printf("SDRAM Check failed...\t\n");
			printf("i=0x%x\r\n", i);
			printf("tmptest=0x%x\r\n", tmptest);
			printf("testram=0x%x\r\n", testram);

		}
	}

	printf("SDRAM Check 0xAAAAAAAA OK\t\n");

	printf("TEST SDRAMing... Write 0x55555555\t\n");

	for (i=0; i<0x1000000; i++)
		write16((0x80000000 + i*2), 0x5555);

	for (i=0; i<0x1000000; i++) {

		tmptest = read16(0x80000000 + i*2);

		if (tmptest != 0x5555) {

			printf("SDRAM Check failed...\t\n");
			printf("i=0x%x\r\n", i);
			printf("tmptest=0x%x\r\n", tmptest);
			printf("testram=0x%x\r\n", testram);

		}
	}

	printf("SDRAM Check 0x55555555 OK\t\n");

	printf("TEST SDRAMing...Write Accumulation \t\n");

	for (i=0, testram=TESTCOUNT; i<0x1000000; i++, testram--)
		write16((0x80000000 + i*2), testram);

	for (i=0, testram=TESTCOUNT; i<0x1000000; i++, testram--) {

		tmptest = read16(0x80000000 + i*2);

		if (tmptest != testram) {

			printf("SDRAM Check failed...\t\n");
			printf("i=0x%x\r\n", i);
			printf("tmptest=0x%x\r\n", tmptest);
			printf("testram=0x%x\r\n", testram);

		}
	}

	printf("SDRAM Test good\n");

	initsdram();
*/

}
Ejemplo n.º 8
0
      Test::Result test_psk_sql_db()
         {
         Test::Result result("PSK_DB SQL");

         const Botan::secure_vector<uint8_t> zeros(32);
         const Botan::secure_vector<uint8_t> not_zeros = Test::rng().random_vec(32);

         const std::string table_name = "bobby";
         std::shared_ptr<Botan::SQL_Database> sqldb = std::make_shared<Botan::Sqlite3_Database>(":memory:");

         Botan::Encrypted_PSK_Database_SQL db(zeros, sqldb, table_name);
         db.set_str("name", "value");

         test_entry(result, sqldb, table_name, "CUCJjJgWSa079ubutJQwlw==", "clYJSAf9CThuL96CP+rAfA==");
         result.test_eq("DB read", db.get_str("name"), "value");

         db.set_str("name", "value1");
         test_entry(result, sqldb, table_name, "CUCJjJgWSa079ubutJQwlw==", "7R8am3x/gLawOzMp5WwIJg==");
         result.test_eq("DB read", db.get_str("name"), "value1");

         db.set_str("name", "value");
         test_entry(result, sqldb, table_name, "CUCJjJgWSa079ubutJQwlw==", "clYJSAf9CThuL96CP+rAfA==");
         result.test_eq("DB read", db.get_str("name"), "value");

         db.set_str("name2", "value");
         test_entry(result, sqldb, table_name, "7CvsM7HDCZsV6VsFwWylNg==", "BqVQo4rdwOmf+ItCzEmjAg==");
         result.test_eq("DB read", db.get_str("name2"), "value");

         db.set_vec("name2", zeros);
         test_entry(result, sqldb, table_name, "7CvsM7HDCZsV6VsFwWylNg==", "x+I1bUF/fJYPOTvKwOihEPWGR1XGzVuyRdsw4n5gpBRzNR7LjH7vjw==");
         result.test_eq("DB read", db.get("name2"), zeros);

         // Test longer names
         db.set_str("leroy jeeeeeeeenkins", "chicken");
         test_entry(result, sqldb, table_name, "KyYo272vlSjClM2F0OZBMlRYjr33ZXv2jN1oY8OfCEs=", "tCl1qShSTsXi9tA5Kpo9vg==");
         result.test_eq("DB read", db.get_str("leroy jeeeeeeeenkins"), "chicken");

         /*
         * Test that we can have another database in the same table with distinct key
         * without any problems.
         */
         Botan::Encrypted_PSK_Database_SQL db2(not_zeros, sqldb, table_name);
         db2.set_str("name", "price&value");
         result.test_eq("DB read", db2.get_str("name"), "price&value");
         result.test_eq("DB2 size", db2.list_names().size(), 1);

         std::set<std::string> all_names = db.list_names();

         result.test_eq("Expected number of names", all_names.size(), 3);
         result.test_eq("Have expected name", all_names.count("name"), 1);
         result.test_eq("Have expected name", all_names.count("name2"), 1);
         result.test_eq("Have expected name", all_names.count("leroy jeeeeeeeenkins"), 1);

         db.remove("name2");

         all_names = db.list_names();

         result.test_eq("Expected number of names", all_names.size(), 2);
         result.test_eq("Have expected name", all_names.count("name"), 1);
         result.test_eq("Have expected name", all_names.count("leroy jeeeeeeeenkins"), 1);

         result.test_throws("exception if get called on non-existent PSK",
                            "Named PSK not located",
                            [&]() { db.get("name2"); });

         // test that redundant remove calls accepted
         db.remove("name2");


         return result;
         }
Ejemplo n.º 9
0
void desktop_test()
{
    g_message("desktop test start...");

    test_entry();//test ok 
    // ps:
    //1. g_file_trash() has bug when trash times and speed too fast
    //2. dentry_clipborad_paste() has bug when speed too fast ,becuase the X cannot follow it
    //3. find and fix a serious bug : symblic_link copy to desktop will kill the desktop actually
    //4. some bug not fix: 
    //a. void _do_dereference_symlink_copy(GFile* src, GFile* dest)    
    //      if (!g_file_copy(src, dest, G_FILE_COPY_NONE, NULL, NULL, NULL, &error))
    //      ----------------------here we should unity the standard ops for symbolic_link ---------------------
    //      already fix the standard ops for symbolic_link
    //b. traverse_directory
    //      g_warning ("traverse_directory 1: %s", error->message);


    // test_fileops_delete();//test ok
    
    // test_fileops_trash();//test ok
    
    // test_fileops_clipboard();//test over 
    // when the clipboard paste too fast, the desktop still will dead. because the clipboard too fast to X cannot follow ,as g_file_trash bug
    
    // test_fileops_error_reporting();//hsanot tested

    // test_fileops_error_dialog();//hasnot tested
    
    // test_mime_actions();////hasnot tested   because it used in dentry_launch()


    // test_thumbnails();//test over
    // 
    // but there is a bug ,but cannot be reviewed ,and it is hard to be shown :
    // after test programe run 100% over,there perhaps be a error to kill ./desktop -d but without any messageout
    // when I run test in gdb ,still no useful messageout
    // when I run test in valgrind to track the memory-out,it messageout:
// ==9299==    by 0x7A95AC0: _cairo_compositor_paint (cairo-compositor.c:65)
// ==9299==    by 0x7AD9640: _cairo_surface_paint (cairo-surface.c:2022)
// ==9299==    by 0x7A9D18B: _cairo_gstate_paint (cairo-gstate.c:1067)
// ==9299==    by 0x7A97DC8: _cairo_default_context_paint_with_alpha (cairo-default-context.c:969)
// ==9299==    by 0x7A90726: cairo_paint_with_alpha (cairo.c:2026)
// ==9299== 
// ==9299== LEAK SUMMARY:
// ==9299==    definitely lost: 6,288 bytes in 11 blocks
// ==9299==    indirectly lost: 16,790 bytes in 674 blocks
// ==9299==      possibly lost: 1,821,394 bytes in 16,770 blocks
// ==9299==    still reachable: 2,152,849 bytes in 18,993 blocks
// ==9299==         suppressed: 0 bytes in 0 blocks
// ==9299== Reachable blocks (those to which a pointer was found) are not shown.
// ==9299== To see them, rerun with: --leak-check=full --show-reachable=yes
// ==9299== 
// ==9299== For counts of detected and suppressed errors, rerun with: -v
// ==9299== ERROR SUMMARY: 1655 errors from 1655 contexts (suppressed: 3 from 3)
// 已杀死

    //there still isnot any useful DEBUG message
    //and I g_message in somewhere (begin function ,end function ,begin if and so on ),but ,there still isnot DEBUG message useful

    /* test inotify successful.*/
    // test_inotify_item();

    // test_dbus();

    // test_background(); 

    // test_background_util();

    /* test_desktop(); */

    // test_utils(); 

    //test_other();
    //
    // test_lib_utils();
    // test_pixbuf();
    /*test_xdg_misc();*/
    
    
    
    g_message("desktop tests All passed!!!");
}