void run_test_usermeta(const std::string& file_name) {
  // 
  DOT_TITLE("run_test_user_meta",file_name.c_str());
  DOT_CLEAR();
  //
  affx::File5_File* file5=new affx::File5_File();
  file5->open(file_name,affx::FILE5_REPLACE);
  //
  file5->addHeader("key","val");
  file5->addHeader("foo","bar");
  file5->addHeader("abc","def");
  //
  for (int i=0;i<file5->getHeaderCount();i++) {
    std::string key;
    std::string val;
    file5->getHeaderByIdx(i,&key,&val);
    printf("#%%%s=%s\n",key.c_str(),val.c_str());
  }

  //
  file5->close();
  delete file5;
  //
  DOT_PRINT();
  DOT_OK();
}
void run_test_usermeta_big(const std::string& file_name) {
  // 
  DOT_TITLE("run_test_usermeta_big",file_name.c_str());
  DOT_CLEAR();
  //
  affx::File5_File* file5=new affx::File5_File();
  file5->open(file_name,affx::FILE5_REPLACE);
  //
  for (int i=0;i<1000;i++) {
    char key_buf[32];
    sprintf(key_buf,"key%05d",i);
    char val_buf[32];
    sprintf(val_buf,"val%05d",i);
    file5->addHeader(key_buf,val_buf);
  }
  //
  for (int i=0;i<file5->getHeaderCount();i++) {
    std::string key;
    std::string val;
    file5->getHeaderByIdx(i,&key,&val);
    if ((i%100)==0) {
      printf("%4d : #%%%s=%s\n",i,key.c_str(),val.c_str());
    }
  }
  //
  file5->close();
  delete file5;
  //
  DOT_PRINT();
  DOT_OK();
}
void run_test_benchmark_write(const std::string& file_name,int benchmark_cnt)
{
  printf("FILE5_CHUNKSIZE        = %5d\n", FILE5_CHUNKSIZE);
  printf("FILE5_DEFAULT_COMPRESS = %5d\n", FILE5_DEFAULT_COMPRESS);
  //
  DOT_TITLE("run_test_benchmark_write",file_name.c_str());
  DOT_CLEAR();


  affx::File5_File* file5=new affx::File5_File();
  file5->open(file_name,affx::FILE5_REPLACE);
  affx::File5_Tsv* tsv5=file5->openTsv("benchmark",affx::FILE5_REPLACE);
  
  for (int cidx=0;cidx<BENCHMARK_COL_CNT;cidx++) {
    char buf[100];
    sprintf(buf,"col-%04d",cidx);
    tsv5->defineColumn(0,cidx,buf,affx::FILE5_DTYPE_DOUBLE);
  }

  //
  int cnt=0;
  while (cnt<benchmark_cnt) {
    for (int cidx=0;cidx<BENCHMARK_COL_CNT;cidx++) {
      tsv5->set_d(0,cidx,(cnt++)+0.123456);
    }
    tsv5->writeLevel(0);
  }
  
  //
  tsv5->close();
  delete tsv5;
  file5->close();
  delete file5;
}
void run_test_file(const std::string& file_name) {
  int should_be_zero;

  //
  DOT_TITLE("run_test_file",file_name.c_str());
  DOT_CLEAR();

  //
  affx::File5_File* file5=new affx::File5_File();

  // should be ok
  DOT_PRINT();
  unlink(file_name.c_str());
  file5->open(file_name,affx::FILE5_CREATE);
  file5->close();

  // should fail as file is there.
  DOT_PRINT();
  should_be_zero=0;
  try {
    file5->open(file_name,affx::FILE5_OPEN);
    should_be_zero=0; // error!
  }
  catch (...) {
    // ignore
  }
  FILE5_ASSERT(should_be_zero==0);
  //
  file5->close();
  
  // should be ok
  DOT_PRINT();
  file5->open(file_name,affx::FILE5_OPEN);
  file5->close();

  //
  DOT_PRINT();
  file5->open(file_name,affx::FILE5_OPEN_RO);
  //
  file5->close();
  // it should be safe to call close twice...
  file5->flush();
  file5->close();
  // ...or more!
  file5->close();

  // should be ok.
  /*
  DOT_PRINT();
  unlink(file_name.c_str());
  file5->open(file_name,affx::FILE5_OPEN);
  file5->close();
  */
  //
  delete file5;

  //
  DOT_OK();
}
示例#5
0
void dot_all_tog (){
	
	int i;

	
	if (! check_dot_all){
		DOT_SET(0, 0x7F); DOT_SET(1, 0x7F); DOT_SET(2, 0x7F); DOT_SET(3, 0x7F); DOT_SET(4, 0x7F);
		
		for (i=0 ; i <35; i++)
			gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dot_handle[i]), TRUE);
		
	   	check_dot1 = check_dot2 = check_dot3 = check_dot4 = check_dot5 = \
	   	check_dot6 = check_dot7 = check_dot8 = check_dot9 = check_dot10 = \
           	check_dot11 = check_dot12 = check_dot13 = check_dot14 = check_dot15 = \
	   	check_dot16 = check_dot17 = check_dot18 = check_dot19 = check_dot20 = \
	        check_dot21 = check_dot22 = check_dot23 = check_dot24 = check_dot25 = \
	   	check_dot26 = check_dot27 = check_dot28 = check_dot29 = check_dot30 = \
           	check_dot31 = check_dot32 = check_dot33 = check_dot34 = check_dot35 = 1;	

		check_dot_all =1;
	}
	else {	DOT_CLEAR(0, 0x7F); DOT_CLEAR(1, 0x7F); DOT_CLEAR(2, 0x7F); \
		DOT_CLEAR(3, 0x7F); DOT_CLEAR(4, 0x7F);
		
		for (i=0 ; i <35; i++)
			gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dot_handle[i]), FALSE);
		
		check_dot1 = check_dot2 = check_dot3 = check_dot4 = check_dot5 = \
	   	check_dot6 = check_dot7 = check_dot8 = check_dot9 = check_dot10 = \
           	check_dot11 = check_dot12 = check_dot13 = check_dot14 = check_dot15 = \
	   	check_dot16 = check_dot17 = check_dot18 = check_dot19 = check_dot20 = \
           	check_dot21 = check_dot22 = check_dot23 = check_dot24 = check_dot25 = \
	   	check_dot26 = check_dot27 = check_dot28 = check_dot29 = check_dot30 = \
           	check_dot31 = check_dot32 = check_dot33 = check_dot34 = check_dot35 = 0;	
		
		check_dot_all =0;
	}

}
void run_test_vector_1(const std::string& file_name) {
  //
  DOT_TITLE("run_test_matrix",file_name.c_str());
  DOT_CLEAR();

  run_test_vector_1_w(file_name+"-int",   affx::FILE5_DTYPE_INT);
  run_test_vector_1_r(file_name+"-int",   affx::FILE5_DTYPE_INT);
  //
  run_test_vector_1_w(file_name+"-short", affx::FILE5_DTYPE_SHORT);
  run_test_vector_1_r(file_name+"-short", affx::FILE5_DTYPE_SHORT);
  //
  run_test_vector_1_w(file_name+"-char",  affx::FILE5_DTYPE_CHAR);
  run_test_vector_1_r(file_name+"-char",  affx::FILE5_DTYPE_CHAR);
}
void run_test_tsv_write(const std::string& file_name)
{
  DOT_TITLE("run_test_tsv_write",file_name.c_str());
  DOT_CLEAR();
  
  affx::File5_File* file5=new affx::File5_File();
  file5->open(file_name,affx::FILE5_REPLACE);

  affx::File5_Tsv* tsv5=file5->openTsv("tsv",affx::FILE5_REPLACE);
  
  std::string col_name="test-column";
  tsv5->defineColumn(0,0,col_name,affx::FILE5_DTYPE_INT);

  // check the types
  FILE5_ASSERT(tsv5->getColumnDtype(0,0)==affx::FILE5_DTYPE_INT);
  FILE5_ASSERT(tsv5->getColumnDtype(0,10)==affx::FILE5_DTYPE_UNKNOWN);
  //
  FILE5_ASSERT(tsv5->getColumnDtype(0,"test-column")==affx::FILE5_DTYPE_INT);
  FILE5_ASSERT(tsv5->getColumnDtype(0,"noSuchColumn")==affx::FILE5_DTYPE_UNKNOWN);

  for (int i=0;i<10;i++) {
    // good cases
    if (tsv5->set_i(0,0,i)!=affx::FILE5_OK) {
      FILE5_ASSERT(0);
    }
    tsv5->writeLevel(0);
    if (tsv5->set_i(0,col_name,i)!=affx::FILE5_OK) {
      FILE5_ASSERT(0);
    }
    tsv5->writeLevel(0);

    // bad cases
    if (tsv5->set_i(0,-1,i)==affx::FILE5_OK) {
      FILE5_ASSERT(0);
    }
    if (tsv5->set_i(0,"bad_col",i)==affx::FILE5_OK) {
      FILE5_ASSERT(0);
    }
    if (tsv5->set_i(9,col_name,i)==affx::FILE5_OK) {
      FILE5_ASSERT(0);
    }
  }
  //
  tsv5->close();
  delete tsv5;
  file5->close();
  delete file5;
}
void run_test_tsv_delete(const std::string& file_name)
{
  DOT_TITLE("run_test_tsv_delete",file_name.c_str());
  DOT_CLEAR();
  
  affx::File5_File* file5=new affx::File5_File();
  file5->open(file_name,affx::FILE5_REPLACE);

  // make two tables
  run_test_tsv_delete_mk(file5,"tsv-1");
  run_test_tsv_delete_mk(file5,"tsv-deleteme");
  run_test_tsv_delete_mk(file5,"tsv-2");

  //
  file5->deleteTsv("tsv-deleteme");
  file5->deleteTsv("tsv-doesnotexists");

  //
  file5->close();
  delete file5;
}
void run_test_vec_strlen_1(const std::string& file_base,int strlen)
{
  //
  char buf[100];

  //
  sprintf(buf,"%s-%03d",file_base.c_str(),strlen);
  std::string file_name=buf;
  printf("  file=%s\n",file_name.c_str());
  //
  DOT_CLEAR();


  affx::File5_File* file5=new affx::File5_File();
  file5->open(file_name,affx::FILE5_REPLACE);
  affx::File5_Tsv* tsv5=file5->openTsv("tsv",affx::FILE5_REPLACE);

  tsv5->defineColumn(0,0,"string",affx::FILE5_DTYPE_STRING,strlen);  
  int val=0;
  for (int i=0;i<100000;i++) {
    // psudo-random
    // val=val*23*val+val+10;
    // sequental
    val++;
    sprintf(buf,"%u%u",val,val);
    // fix the length at 10.
    buf[11]=0;
    tsv5->set_string(0,0,buf);
    tsv5->writeLevel(0);
  }
  
  //
  tsv5->close();
  delete tsv5;
  file5->close();
  delete file5;
}
示例#10
0
void dot34_tog(){
        if (! check_dot34)
                { DOT_SET(3, 0x01);     check_dot34 = 1; }
        else    { DOT_CLEAR(3, 0x01);   check_dot34 = 0; }
}
示例#11
0
void dot32_tog(){
        if (! check_dot32)
                { DOT_SET(1, 0x01);     check_dot32 = 1; }
        else    { DOT_CLEAR(1, 0x01);   check_dot32 = 0; }
}
示例#12
0
void dot30_tog(){
        if (! check_dot30)
                { DOT_SET(4, 0x02);     check_dot30 = 1; }
        else    { DOT_CLEAR(4, 0x02);   check_dot30 = 0; }
}
示例#13
0
void dot28_tog(){
        if (! check_dot28)
                { DOT_SET(2, 0x02);     check_dot28 = 1; }
        else    { DOT_CLEAR(2, 0x02);   check_dot28 = 0; }
}
示例#14
0
/*************************   ROW6   ************************/
void dot26_tog(){
        if (! check_dot26)
                { DOT_SET(0, 0x02);     check_dot26 = 1; }
        else    { DOT_CLEAR(0, 0x02);   check_dot26 = 0; }
}
示例#15
0
void dot24_tog(){
        if (! check_dot24)
                { DOT_SET(3, 0x04);     check_dot24 = 1; }
        else    { DOT_CLEAR(3, 0x04);   check_dot24 = 0; }
}
示例#16
0
void dot22_tog(){
        if (! check_dot22)
                { DOT_SET(1, 0x04);     check_dot22 = 1; }
        else    { DOT_CLEAR(1, 0x04);   check_dot22 = 0; }
}
示例#17
0
void dot23_tog(){
        if (! check_dot23)
                { DOT_SET(2, 0x04);     check_dot23 = 1; }
        else    { DOT_CLEAR(2, 0x04);   check_dot23 = 0; }
}
示例#18
0
void dot15_tog(){
        if (! check_dot15)
                { DOT_SET(4, 0x10);     check_dot15 = 1; }
        else    { DOT_CLEAR(4, 0x10);   check_dot15 = 0; }
}
示例#19
0
void dot25_tog(){
        if (! check_dot25)
                { DOT_SET(4, 0x04);     check_dot25 = 1; }
        else    { DOT_CLEAR(4, 0x04);   check_dot25 = 0; }
}
示例#20
0
/*************************   ROW4   ************************/
void dot16_tog(){
        if (! check_dot16)
                { DOT_SET(0, 0x08);     check_dot16 = 1; }
        else    { DOT_CLEAR(0, 0x08);   check_dot16 = 0; }
}
示例#21
0
void dot27_tog(){
        if (! check_dot27)
                { DOT_SET(1, 0x02);     check_dot27 = 1; }
        else    { DOT_CLEAR(1, 0x02);   check_dot27 = 0; }
}
示例#22
0
void dot17_tog(){
        if (! check_dot17)
                { DOT_SET(1, 0x08);     check_dot17 = 1; }
        else    { DOT_CLEAR(1, 0x08);   check_dot17 = 0; }
}
示例#23
0
void dot29_tog(){
        if (! check_dot29)
                { DOT_SET(3, 0x02);     check_dot29 = 1; }
        else    { DOT_CLEAR(3, 0x02);   check_dot29 = 0; }
}
示例#24
0
void dot18_tog(){
        if (! check_dot18)
                { DOT_SET(2, 0x08);     check_dot18 = 1; }
        else    { DOT_CLEAR(2, 0x08);   check_dot18 = 0; }
}
示例#25
0
/*************************   ROW7  ************************/
void dot31_tog(){
        if (! check_dot31)
                { DOT_SET(0, 0x01);     check_dot31 = 1; }
        else    { DOT_CLEAR(0, 0x01);   check_dot31 = 0; }
}
示例#26
0
void dot19_tog(){
        if (! check_dot19)
                { DOT_SET(3, 0x08);     check_dot19 = 1; }
        else    { DOT_CLEAR(3, 0x08);   check_dot19 = 0; }
}
示例#27
0
void dot33_tog(){
        if (! check_dot33)
                { DOT_SET(2, 0x01);     check_dot33 = 1; }
        else    { DOT_CLEAR(2, 0x01);   check_dot33 = 0; }
}
示例#28
0
void dot20_tog(){
        if (! check_dot20)
                { DOT_SET(4, 0x08);     check_dot20 = 1; }
        else    { DOT_CLEAR(4, 0x08);   check_dot20 = 0; }
}
示例#29
0
void dot35_tog(){
        if (! check_dot35)
                { DOT_SET(4, 0x01);     check_dot35 = 1; }
        else    { DOT_CLEAR(4, 0x01);   check_dot35 = 0; }
}
示例#30
0
/*************************   ROW5   ************************/
void dot21_tog(){
        if (! check_dot21)
                { DOT_SET(0, 0x04);     check_dot21 = 1; }
        else    { DOT_CLEAR(0, 0x04);   check_dot21 = 0; }
}