示例#1
0
TEST(Vasm, XlsIntXmm) {
  EXPECT_EQ(test_const(uint32_t(1234)), 1234);
  EXPECT_EQ(test_const(uint32_t(0)), 0);
  // 32-bit constants are unsigned. make sure not sign-extended
  EXPECT_EQ(test_const(uint32_t(0xffffffff)), 0xffffffffl);
  EXPECT_EQ(test_const(uint32_t(0x80000000)), 0x80000000l);
}
示例#2
0
TEST(Vasm, XlsByteXmm) {
  EXPECT_EQ(test_const(false), 0);
  EXPECT_EQ(test_const(true), 1);
  // DataType is actually mapped to uint64_t constants, for some reason,
  // but if that changes we still want to test them as bytes here.
  EXPECT_EQ(test_const(KindOfUninit), 0);
  EXPECT_EQ(test_const(KindOfArray), KindOfArray);
}
示例#3
0
int
main()
{
  test_const(1.0f);
  test_const(1.0);
  test_const(1.0l);
  test_const(1.0q);
  test_const(mpfr::mpreal(1, 256));
}
示例#4
0
void file_t()
{
	int fd = open("/tmp/file_test_a", O_WRONLY | O_CREAT);
	char a[] = "data";
	write(fd, a, sizeof(a));
	close(fd);

	//
	char *source, *dest;
	source = "this is string";
	dest = (char *)malloc(sizeof(char)*6);
	copy_string(source, dest, 5);
	printf("\n<-------------copy string function----------------->\n");
	printf("source string is : %s, \ndest string copied is : %s", source, dest);

	// 
	char buffer[10];
	fd = open("/tmp/file_test_a", O_RDONLY);
	read(fd, buffer, 3);
	close(fd);
	printf("\n%s\n", buffer);

	//
	test_const();

	test_enum();

	test_snprintf();

	test_if_likely();

	test_define();
}
示例#5
0
int main()
{
  test_const();
  test();
  test_pure();
  return 0;
}
示例#6
0
文件: t01.c 项目: JianpingZeng/minice
int main()
{
  int a[6], i;
  for (i = 0; i< 6; i++)
    a[i]=i;
  test_const(a);
}
示例#7
0
int main(int argc, char *argv[])
{
  ULONG res = 0;

  MathIeeeSingTransBase = (BaseType *)OpenLibrary("mathieeesingtrans.library", 34);
  if(MathIeeeSingTransBase) {
    PutStr("ok!\n");

    test_const();

    test_acos();
    test_asin();
    test_atan();
    test_cos();
    test_cosh();
    test_exp();
    test_fieee();
    test_log();
    test_log10();
    test_pow();
    test_sin();
    test_sincos();
    test_sinh();
    test_sqrt();
    test_tan();
    test_tanh();
    test_tieee();

    CloseLibrary((struct Library *)MathIeeeSingTransBase);
  } else {
    PutStr("No mathieeesingtrans.library!\n");
    res = 1;
  }
  return res;
}
示例#8
0
int main()
{
    test_map m;
    summary_map<std::string, int, int,
		std::less<std::string>, int_aggregator> custom_map;

    test_mutable(m);
    test_const(m);
    test_cpp11(m);

    return 0;
}
示例#9
0
int
main()
    {
    basic_test();
    exception_safety_test();
    test_empty();
    test_basic_throw_catch();
    test_catch_add_info();
    test_add_tuple();
    test_lifetime();
    test_const();
    return boost::report_errors();
    }
示例#10
0
int main()
{
	adam_init();

	test_move();
	test_return();
	test_const();
	test_monitor();
	test_packed(); 
	test_sparse();
	test_arrayops();
	test_instanceops();
	test_invoke();

	adam_finalize();
	
	return 0;
}
示例#11
0
int main(){
	std::deque<double> test;
	std::deque<double>::iterator i,j;
	unsigned int k;

	std::cout << "deque test start" << std::endl;

	TestFramework::init();

	i = test.begin();

	std::cout << "\nTest of push_back():\n";
	std::cout << "The following two lines should be identical.\n";

	test.push_back(12);
	test.push_back(13);
	test.push_back(14);

	std::cout << "12 13 14 " << std::endl;

	for(i = test.begin(); i !=test.end(); ++i){
		std::cout << *i << " ";
	}
	std::cout << std::endl;

	std::cout << "\nTest of subscripting:\n";
	std::cout << "The following two lines should be identical\n";
	std::cout << "12 13 14 " << std::endl;
	for(k = 0; k < test.size(); ++k){
		std::cout << test[k] << " ";
	}
	std::cout << std::endl;

	std::cout << "Pushing many elements to the front:" << std::endl;
	for(k = 1; k < 24; ++k){
		std::cout << "Pushing in: " << k;
		test.push_front(static_cast<double>(k));
		std::cout << " " << test.front() << std::endl;
	}

	std::cout << "Complete list of elements:\n";
	std::cout << "The following two lines should be identical\n";
	std::cout << "23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 12 13 14 \n";
	for(k = 0; k < test.size(); ++k){
		std::cout << test[k] << " ";
	}
	std::cout << std::endl;


	std::cout << "\n Testing push_back():" << std::endl;
	std::cout << "The following two lines should be identical\n";
	std::cout << "23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 12 13 14 2.5\n";
	test.push_back(2.5);
	for(k = 0; k < test.size(); ++k){
		std::cout << test[k] << " ";
	}
	std::cout << std::endl;

	std::cout << "\nTesting pop_front:" << std::endl;
	std::cout << "The following two lines should be identical\n";
	std::cout << "22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 12 13 14 2.5\n";
	test.pop_front();
	for(i = test.begin(); i !=test.end(); ++i){
		std::cout << *i << " ";
	}
	std::cout << std::endl;
	

	std::cout << "\nTesting pop_back:" << std::endl;
	std::cout << "The following two lines should be identical\n";
	std::cout << "22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 12 13 14 \n";
	test.pop_back();
	for(i = test.begin(); i !=test.end(); ++i){
		std::cout << *i << " ";
	}
	std::cout << std::endl;


	std::cout << "\nCopy constructor:" << std::endl;
	std::cout << "The following two lines should be identical\n";
	std::cout << "22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 12 13 14 \n";
	std::deque<double> test2(test);
	i = test2.begin();
	while(i !=test2.end()){
		std::cout << *i << " ";
		++i;
	}
	std::cout << std::endl;


	std::cout << "\nAssignement:" << std::endl;
	std::cout << "The following two lines should be identical\n";
	std::cout << "22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 12 13 14 \n";
	test2.clear();
	test2 = test;
	for(i = test2.begin(); i !=test2.end(); ++i){
		std::cout << *i << " ";
	}
	std::cout << std::endl;

	std::cout << "\nInsert near beginning:" << std::endl;
	std::cout << "The following two lines should be identical\n";
	std::cout << "22 21 25 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 12 13 14 \n";
	i = test.begin();
	++i;
	i++;
	test.insert(i, 25);
	for(i = test.begin(); i !=test.end(); ++i){
		std::cout << *i << " ";
	}
	std::cout << std::endl;

	std::cout << "\nInsert near end:" << std::endl;
	std::cout << "The following two lines should be identical\n";
	std::cout << "22 21 25 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 12 27 13 14 \n";
	i=test.end();
	--i;
	i--;
	test.insert(i, 27);
	for(i = test.begin(); i !=test.end(); ++i){
		std::cout << *i << " ";
	}
	std::cout << std::endl;

	std::cout << "\nErase near begining:" << std::endl;
	std::cout << "The following two lines should be identical\n";
	std::cout << "22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 12 27 13 14 \n";
	i = test.begin();
	++i;
	i++;
	test.erase(i);
	for(i = test.begin(); i !=test.end(); ++i){
		std::cout << *i << " ";
	}
	std::cout << std::endl;

	std::cout << "\nErase near end:" << std::endl;
	std::cout << "The following two lines should be identical\n";
	std::cout << "22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 12 13 14 \n";
	i = test.end();
	i--;
	--i;
	i--;
	i = test.erase(i);
	for(j = test.begin(); j !=test.end(); ++j){
		std::cout << *j << " ";
	}
	std::cout << std::endl;
	std::cout << "Returned iterator points to: " << *i << " - should be 13" << std::endl;

	test.clear();
	test.push_back(12);
	test.push_back(13);
	test.push_back(14);
	test.push_back(7);
	test.push_back(25);
	test.push_back(0);
	test_const(test);
	
	TestFramework::AssertReturns<bool>(canSwapUnary, true);
	TestFramework::AssertReturns<bool>(canSwapBinary, true);

	TestFramework::results();

	return 0;
}
示例#12
0
template<class F> void test( F f )
{
    f();
    test_const( f );
}
示例#13
0
static int make_brun_line
(
unsigned char *image_line,
unsigned char *brun_line
)
{
    int i, ipos, n, packets;
    int len, help;
    int inext;

    for (i=0; i < fli_width; i++)
        val[i]=image_line[i];

    i=0;
    while (i < fli_width)
      {
	len = test_const(i);
	if (len > 1)
	  {
	    for (n=0; n < len; n++)
	      {
		modus[i] = MCONST;
		bingo[i] = len;
		i++;
	      }
	  }
	else
	  {
	    modus[i] = MLOAD;
	    bingo[i] = 1;
	    i++;
	  }
      }

    i=0;
    while (i < fli_width)
      {
	if (modus[i] == MCONST)
	  {
	    i += bingo[i];
	  }
	else
	  {
	    len = test_mload(i);
	    for (n=0; n < len; n++)
	      {
		bingo[i] = len;
		i++;
	      }
	  }
      }

    i=bingo[0];
    while (i < fli_width)
      {
	inext = i + bingo[i];
	if ((((modus[i] == MCONST) && (bingo[i] <= 2)) || (modus[i] == MLOAD))
	    && (modus[i-1] == MLOAD)) merge_packets(i);
	i = inext;
      }

    i=fli_width - bingo[fli_width - 1];
    while (i > 0)
      {
	inext = i - bingo[i-1];
	if ((((modus[i-1] == MCONST) && (bingo[i-1] <= 2))
	     || (modus[i-1] == MLOAD)) && (modus[i] == MLOAD))
	  merge_packets(i);
	i = inext;
      }

    while (test_packets() > 255)
      {reduce_packets();}

    ipos=1;

    packets=0;
    i=0;
    while (i < fli_width)
    {
        len=bingo[i];
	/* fprintf(stdout," %d  %d\n",i,len); */

        if (modus[i] == MCONST)
        {
	  add_bytes(brun_line, &ipos, len, IOM_UBYTE);
	  add_bytes(brun_line, &ipos, val[i], IOM_UBYTE);
	  i += len;
        }
        else
        {
	  add_bytes(brun_line, &ipos, -len, IOM_UBYTE);
	  for (n=0; n < len; n++)
	    {
	      add_bytes(brun_line, &ipos, val[i++], IOM_UBYTE);
            }
	}
	packets++;
    }
    /* fprintf(stdout," packets: %d    ipos: %d\n\n",packets,ipos); */

    help=0;
    add_bytes(brun_line, &help, packets, IOM_UBYTE);

    return(ipos);
}