コード例 #1
0
/**
 * Unit test framework entry point for this set of unit tests.
 *  
 */
void testSimpleNetwork_runTests() {
    unsigned char ipBytes[MAX_ADDR_LENGTH]; //can be set to INET6_ADDRSTRLEN;
    void *handle;
    int numBytes;
    char *data;
    char *hostname = "host.domain";
    char* request = "GET /midlets/midlet.jad HTTP/1.0\n\n";

    testGetHostByName(hostname, ipBytes);

    handle = testOpen(ipBytes, 80);
    printf("open handle = %d\n", (int)handle);

    testWrite(handle, request);

    numBytes = testAvailable(handle);
    printf("numBytes = %d\n", numBytes);

    if (numBytes > 0) {
        data = (char *) malloc((numBytes + 1)*sizeof(char));
        testRead(handle, data, numBytes);
        printf("\n Data from server :\n");
        printf("%s\n", data);
    }

    testClose(handle);
}
コード例 #2
0
ファイル: objstore.c プロジェクト: waterflier/objstore
int main(int argc,char** argv)
{
    printf("start\n");

 //   FILE* pf = fopen("G:\\BTCloud\\tumblr_nrh9kdHHcn1uatgt2.mp4","rb");
	//if (pf) 
	//{
	//	uint64_t buffernlen = 1024*1024*128;
	//	uint8_t * buffer = (uint8_t*)malloc(buffernlen);
	//	int ret = ReadFileContent(pf, buffer, &buffernlen);
	//	printf("read file content,ret=%d,len=%d\n", ret, buffernlen);
	//	fclose(pf);

	//	FILE* pf2 = fopen("d:\\tmp\\1.mp4", "wb");
	//	ret = WriteFileContent(pf2, buffer, buffernlen);
	//	printf("write file content,ret=%d,len=%d\n", ret, buffernlen);
	//}

 //   exit(0);

    ObjStoreContext* pContext = (ObjStoreContext*) malloc(sizeof(ObjStoreContext));
    InitObjStore(pContext,"/tmp/");
    testWrite(pContext,10,0x3f,40960000);
    testRead(pContext,10,0x3f,4096000);
    //testCheck(pContext,10,409600);

    return 0;
}
コード例 #3
0
ファイル: test-io.c プロジェクト: ic-hep/emi3
int main(int argn, char** argv)
{
  dmlite_manager* manager;
  dmlite_context* context;
  
  SECTION("Instantiation");
  
  /* Load the mock plug-in */
  manager = dmlite_manager_new();
  TEST_MANAGER_CALL(manager, dmlite_manager_load_plugin, "./plugin_mock.so", "plugin_mock");
  
  /* Instantiate */
  context = dmlite_context_new(manager);
  
  /* Set credentials (mock will ignore anyway) */
  dmlite_credentials creds;
  memset(&creds, 0, sizeof(creds));
  creds.client_name = "root";
  TEST_CONTEXT_CALL(context, dmlite_setcredentials, &creds);
  
  /* Do tests */
  testRead(context);
  testWrite(context);
  
  /* Clean-up */
  dmlite_context_free(context);
  dmlite_manager_free(manager);
  
  return TEST_FAILURES;
}
コード例 #4
0
ファイル: Main.cpp プロジェクト: amarawi/gotcloud
int main(int argc, char ** argv)
{
    if(argc == 1)
    {
        testReadSam();
#ifdef __ZLIB_AVAILABLE__
        testReadBam();
        testReadBam();
#endif
        testAddHeaderAndTagToFile("testFiles/testSam.sam",
                                  "results/addedTagToSam.bam");
        testAddHeaderAndTagToFile("testFiles/testSam.sam",
                                  "results/addedTagToSam.sam");
// Can't read bams without zlib
#ifdef __ZLIB_AVAILABLE__
        testAddHeaderAndTagToFile("testFiles/testBam.bam",
                                  "results/addedTagToBam.sam");
        testAddHeaderAndTagToFile("testFiles/testBam.bam",
                                  "results/addedTagToBam.bam");
#endif

        testValidateSortedRead();
      
        testWrite();

        testSamQNAME();
        testBamRID();
        testEmptyQual();
      
// Can't read bams without zlib
#ifdef __ZLIB_AVAILABLE__
        testBamIndex();
#endif

        testModifyVar();
        testModify();

        testSamFile();

        testSeqEquals();

        testFilter();

        testShiftIndels();

        testPileup();
        
        testPosList();

        testCigarHelper();
        testSamRecordPool();
        testSamCoordOutput();
        testSamRecordHelper();
    }
    else
    {
        modifyFirstBaseLong();
    }
}
コード例 #5
0
ファイル: test2.c プロジェクト: Ketanjuneja/Database-System
/* main function running all tests */
int
main (void)
{
  testName = "";
  
  initStorageManager();

  testWrite();
//  testSinglePageContent();

  return 0;
}
コード例 #6
0
int main() {
  int rv = 0;
  rv += testEmpty();
  rv += testAccess();
  rv += testWrite();
  rv += testFind();
  rv += testVoid();
  rv += testRFind();
  rv += testCompressWhitespace();
  if (0 == rv) {
    fprintf(stderr, "PASS: StringAPI tests\n");
  }
  return rv;
}
コード例 #7
0
ファイル: fieldml_test.cpp プロジェクト: FieldML/FieldML-API
int main( int argc, char **argv )
{
    if( argc > 1 )
    {
        testRead( argv[1] );
        testWrite( argv[1] );
    }
    testMisc();
    
    testCycles();
    
    testHdf5Read();
    
    testHdf5Write();
    
    return 0;
}
コード例 #8
0
void Datastore::test()
{
    printMessage(ENTRY_SIZE_MESSAGE);
    Serial.println(DATASTORE_LOG_ENTRY_SIZE);
    printMessage(MAX_ENTRIES_MESSAGE);
    Serial.println(DATASTORE_MAX_ENTRIES, DEC);
    printMessage(ERASING_MESSAGE);
    erase();
    printMessage(DONE_MESSAGE);
    printMessage(WRITING_MESSAGE);
    testWrite(1000);
    Serial.print("f1 ");
    testWrite(1000);
    Serial.print("f2 ");
    testWrite(2000);
    Serial.print("f3 ");
    printMessage(DONE_MESSAGE);
    printMessage(DATASTORE_SETUP_MESSAGE);
    setup();
    printMessage(DONE_MESSAGE);
    printMessage(NUM_FILES_MESSAGE);
    Serial.println(getNumberOfFiles(), DEC);
    printMessage(NUM_ENTRIES_MESSAGE);
    Serial.println(getNumberOfEntries(), DEC);
    printMessage(WRITING_MESSAGE);
    testWrite(1000);
    Serial.print("f1 ");
    testWrite(1000);
    Serial.print("f2 ");
    testWrite(2000);
    Serial.print("f3 ");
    printMessage(DONE_MESSAGE);
    printMessage(DATASTORE_SETUP_MESSAGE);
    setup();
    printMessage(DONE_MESSAGE);
    printMessage(NUM_FILES_MESSAGE);
    Serial.println(getNumberOfFiles(), DEC);
    printMessage(NUM_ENTRIES_MESSAGE);
    Serial.println(getNumberOfEntries(), DEC);

    printMessage(ERASING_MESSAGE);
    erase();
    printMessage(DONE_MESSAGE);

    printMessage(TEST_PASS_MESSAGE);

}
コード例 #9
0
static void testAPI(RTTEST hTest)
{
    testMappingsQuery(hTest);
    testMappingsQueryName(hTest);
    testMapFolder(hTest);
    testUnmapFolder(hTest);
    testCreate(hTest);
    testClose(hTest);
    testRead(hTest);
    testWrite(hTest);
    testLock(hTest);
    testFlush(hTest);
    testDirList(hTest);
    testReadLink(hTest);
    testFSInfo(hTest);
    testRemove(hTest);
    testRename(hTest);
    testSymlink(hTest);
    testMappingsAdd(hTest);
    testMappingsRemove(hTest);
    /* testSetStatusLed(hTest); */
}
コード例 #10
0
int main(void)
{
#ifdef USE_LIBUSB_1_0
    libusb_device_handle *usbhandle;
#else
    usb_dev_handle *usbhandle;
#endif

#if 0
    libusb_device **devs;
	int r;
	ssize_t cnt;

	r = libusb_init(NULL);
	if (r < 0)
		return r;

	cnt = libusb_get_device_list(NULL, &devs);
	if (cnt < 0)
		return (int) cnt;

	print_devs(devs);

	libusb_free_device_list(devs, 1);

    libusb_exit(NULL);
#endif

	if(!usbdevice_open(&usbhandle))
	{
	    testWrite(usbhandle);
        usbasp_initialize(usbhandle);
	}


	return 0;
}
コード例 #11
0
ファイル: mmap.cpp プロジェクト: longshadian/estl
int main()
{
    //testOpen();
    testWrite();
    return 0;
}
コード例 #12
0
ファイル: objstore.c プロジェクト: waterflier/objstore
int main(int argc, char** argv)
{
	printf("start\n");

	ObjStoreContext* pContext = (ObjStoreContext*)malloc(sizeof(ObjStoreContext));
	InitObjStore(pContext, "/tmp/objstore/");

	if (argc == 1)
	{
		//for debug
		testWrite(pContext, 10, 0x5f, 9097);
		testRead(pContext, 10, 0x5f, 9097);
		testCheck(pContext, 10, 9097);

		testWriteRange(pContext, 10, 0x6f, 4096, 4096);
		testReadRange(pContext, 10, 0x6f, 4096, 4096);
	}
	else
	{
		if (argc == 5)
		{

			int maxobjid = atoi(argv[2]);
			int mask = atoi(argv[3]);
			int datasize = atoi(argv[4]);

			if(strcmp(argv[1],"-w") == 0)
			{
				printf("start write...\n");
				testWrite(pContext, maxobjid, mask, datasize);
			}
			else if (strcmp(argv[1], "-r") == 0)
			{
				printf("start read...\n");
				testRead(pContext, maxobjid, mask, datasize);
			}

			else
			{
				usage();
				return 1;
			}
		}
		else if (argc == 4)
		{
			int maxobjid = atoi(argv[2]);
			int datasize = atoi(argv[3]);
			if (strcmp(argv[1], "-c") == 0)
			{
				printf("start check...\n");
				testCheck(pContext, maxobjid, datasize);
			}
			else
			{
				usage();
				return 1;
			}
		}
		else if (argc == 6)
		{
			int maxobjid = atoi(argv[2]);
			int mask = atoi(argv[3]);
			int startpos = atoi(argv[4]);
			int datasize = atoi(argv[5]);


			if (strcmp(argv[1], "-wp") == 0)
			{
				printf("start write range ...\n");
				testWriteRange(pContext, maxobjid, mask, startpos, datasize);
			}
			else if (strcmp(argv[1], "-rp") == 0)
			{
				printf("start read range ... \n");
				testReadRange(pContext, maxobjid, mask, startpos, datasize);
			}
			else if (strcmp(argv[1], "-cp") == 0)
			{
				printf("start check range ... \n");
				testCheckRange(pContext, maxobjid, mask,startpos, datasize);
			}
		}
		else
		{
			usage();
			return 1;
		}
	}


	system("pause");
	return 0;
}
コード例 #13
0
ファイル: main.cpp プロジェクト: Chingliu/winx
int main()
{
	testWrite();
	testRead();
	return 0;
}
コード例 #14
0
    void runTest ( int column_count, const char * columns [], const char *outfile, const char * schema_path )
    {
        GeneralWriter *gw;
        try
        {
            const char * column_names [ column_count ];

            for ( int i = 0; i < column_count ; ++ i )
                column_names [ i ] = columns [ i ];

            gw = testCreateGw ( outfile, schema_path, "softwarename", "2" );
            std :: cerr << "CreateGw Success" << std :: endl;
            std :: cerr << "---------------------------------" << std :: endl;
                        
            int table_id = testAddTable ( gw );
            std :: cerr << "addTable Success" << std :: endl;
            std :: cerr << "---------------------------------" << std :: endl;

            int stream_ids [ column_count ];
            testAddColumn ( gw, table_id, column_names, column_count, stream_ids ); 
            std :: cerr << "addColumn Success" << std :: endl;
            std :: cerr << "---------------------------------" << std :: endl;

            testDBAddDatabase ( gw, "member_name", "db_name", 1 );
            std :: cerr << "dbAddDatabase Success" << std :: endl;
            std :: cerr << "---------------------------------" << std :: endl;

            testDBAddTable ( gw, "member_name", "table_name", 1 );
            std :: cerr << "dbAddTable Success" << std :: endl;
            std :: cerr << "---------------------------------" << std :: endl;

            testWrite ( gw, table_id, stream_ids, column_count, column_names );
            std :: cerr << "write Success" << std :: endl;
            std :: cerr << "---------------------------------" << std :: endl;

            testAddDBMetadataNode ( gw, "db_metadata_node", "01a2b3c4d" );
            std :: cerr << "setDBMetadataNode Success" << std :: endl;
            std :: cerr << "---------------------------------" << std :: endl;
            testAddTblMetadataNode ( gw, "tbl_metadata_node", "01a2b3c4d" );
            std :: cerr << "setTblMetadataNode Success" << std :: endl;
            std :: cerr << "---------------------------------" << std :: endl;
            testAddColMetadataNode ( gw, "col_metadata_node", "01a2b3c4d" );
            std :: cerr << "setColMetadataNode Success" << std :: endl;
            std :: cerr << "---------------------------------" << std :: endl;

            testProgMsg ( gw, "name", 1, 54768, 64000 );
            std :: cerr << "setProgMsg Success" << std :: endl;
            std :: cerr << "---------------------------------" << std :: endl;

            testEndStream ( gw );
            std :: cerr << "endStream Success" << std :: endl;
            std :: cerr << "---------------------------------" << std :: endl;

        }
        catch ( ... )
        {
            delete gw;
            throw;
        }
        delete gw;
    }