Ejemplo n.º 1
0
Archivo: test1.c Proyecto: jkkm/latrace
int main(void)
{
	static const struct st3 a = {1, 2, 3, 4, 5, 6};

	l1(100);
	l2(100, 200);
	l3(100, 200, 300);
	l4(100, 200, 300, 400);
	l5(100, 200, 300, 400, 500);
	l6(100, 200, 300, 400, 500, 600);
	l7(100, 200, 300, 400, 500, 600, 700);
	l8(100, 200, 300, 400, 500, 600, 700, 800);

	d1();
	d2(43);
	d3(100, 200);
	d4(a);
	d5('a', 43, a);
	d6('a', 1);

	c1(44);
	c2(100, 'a', 3.4);
	c3(200, 2.777, 'q');
	c4(200, 1);
	c5(1.1, 2.2);
	c6(1.23, 45.6);
	c7('z', 0x200);

	a1('a');
	a2(10);
	a3(20);
	a4(102030405060LL);

	b1('a', 20);
	b2(30, 'b');
	b3(10, 20, 30, 40, 50, 60);

	s1(sx);
	s1p(&sx);
	s2(sy);
	s3(sz);
	s4(sq);
	s5(sa);
	s6(sb);

	r1();
	r3();
	r4();

	q1(200, sx);
	q2(300, 't', sx);
	q3(400, 410, sy);
	q4(500, 510, sq);
	q5(600, 610, 'z', 'q', sq);

	real1("fresh air");
	real2();

	return 0;
}
Ejemplo n.º 2
0
    void ordering()
    {
        Category c1 (AUDIO);
        Category c2 (VIDEO);
        Category c3 (EFFECT);
        Category c4 (CODEC);
        Category c5 (STRUCT);
        Category c6 (META);

        CHECK (0 > c1.compare(c2));
        CHECK (0 > c2.compare(c3));
        CHECK (0 > c3.compare(c4));
        CHECK (0 > c4.compare(c5));
        CHECK (0 > c5.compare(c6));

        CHECK (0 ==c1.compare(c1));
        CHECK (0 > c1.compare(c6));

        Category c21 (VIDEO,"bin1");
        Category c22 (VIDEO,"bin2");
        Category c23 (VIDEO,"bin2/sub");

        CHECK (0 > c1.compare(c21));
        CHECK (0 > c2.compare(c21));
        CHECK (0 < c22.compare(c21));
        CHECK (0 < c23.compare(c22));
        CHECK (0 < c23.compare(c21));
        CHECK ( 0==c22.compare(c22));


        CHECK ( c2 == c2 );
        CHECK ( c2 != c22 );
        CHECK ( c2 != c3 );
    }
Ejemplo n.º 3
0
int main(int argc, char* argv[])
{
  boost::thread thrd(&hello);
  
	count c1(1);
	count c2(2);
	count c3(3);
	count c4(4);
	c1.serial();
	c2.serial();
	c3.serial();
	c4.serial();
	/*
  boost::thread thrd1(count(1));
  boost::thread thrd2(count(2));
  boost::thread thrd3(count(3));
  boost::thread thrd4(count(4));
  
 
  thrd1.join();
  thrd2.join();
  thrd3.join();
  thrd4.join();

  */
  thrd.join();
  return 0;
}
Ejemplo n.º 4
0
int main(int argc, const char * argv[]) {
    complex c1(2, 3) ;
    cout << c1 << endl;
    complex c2(27,-200);
    cout << c2 << endl;
    complex c3(-20,4);
    cout << c3 << endl;
    complex c4(-18,-99);
    cout << c4 << endl;
    cout << "c2 is: " << c2;
    cout << "now set c2 to (2, 3)" << endl;
    c2.setxy(2,3) ;
    cout << c2 << endl ;
    if (c1 == c2) {
        cout << "c1 is equal to c2" << endl ;
    } else {
        cout << "c1 is NOT equal to c2" << endl ;
    }
    if (c1 != c3) {
        cout << "c1 is NOT equal to c3" << endl ;
    } else {
        cout << "c1 is equal to c3" << endl ;
    }
    complex *c5 = new complex(-200,-800) ;
    cout << *c5 << endl ;
    delete c5 ;
    c1 = c2 = c3 = c4;
    cout << c3 << endl;
    return 0 ;
}
Ejemplo n.º 5
0
TEST_F(TestXfLower, TestAnonConsts)
{
    UtLog log(stderr);
    SloOutputFile out(stdout, &log);
    XfLowerImpl lower(&log);

    IRNumConst c1(1.0f);
    int index = lower.TestLowerConstant(&c1);
    SloShader* shader = lower.GetShader();
    const SloSymbol& sym = shader->mSymbols[index];
    sym.Write(&out);

    IRStringConst c2("hello");
    index = lower.TestLowerConstant(&c2);
    const SloSymbol& sym2 = shader->mSymbols[index];
    sym2.Write(&out);

    IRTypes types;
    const IRArrayType* ty3 = types.GetArrayType(types.GetFloatTy(), 3);
    const float elements3[] = { 1.0f, 2.0f, 3.0f };
    IRNumArrayConst c3(elements3, ty3);
    index = lower.TestLowerConstant(&c3);
    const SloSymbol& sym3 = shader->mSymbols[index];
    sym3.Write(&out);

    const IRArrayType* ty4 = types.GetArrayType(types.GetStringTy(), 3);
    std::vector<std::string> elements4;
    elements4.push_back("one");
    elements4.push_back("two");
    elements4.push_back("three");
    IRStringArrayConst c4(&elements4[0], ty4);
    index = lower.TestLowerConstant(&c4);
    const SloSymbol& sym4 = shader->mSymbols[index];
    sym4.Write(&out);
}
Ejemplo n.º 6
0
/*void Game::board_unit(){
    cout <<"\nTest Case 1: Default Constructor" << endl;
    cout << "=================================\n";
    b1 = new Board();
    cout << *b1;

    cout <<"\nTest Case 2: startTurn() function" << endl;
    cout << "=================================\n";
    b1->startTurn(p1);

    cout <<"\n\nTest Case 3: move() and stop() function" << endl;
    cout << "==========================================\n";

    for (int k = 0; k<4; ++k)
    {
        cout <<"\nMoving in column 2:" << endl;
        if (!b1->move(2))
            cout << "Illegal Move" << endl;
        else
            cout << *b1;
    }

    for (int j = 0; j < 2; ++j){
        cout <<"\nMoving in column 12:" << endl;
        if (!b1->move(12))
            cout << "Illegal Move" << endl;
        else
            cout << *b1;
    }

    cout <<"\nMoving in column 5:" << endl;
    if (!b1->move(5))
        cout << "Illegal Move" << endl;
    else
        cout << *b1;

    cout <<"\nMoving in column 7:" << endl;
    if (!b1->move(7))
        cout << "Illegal Move" << endl;
    else
        cout << *b1;

    cout << "\nStopping Turn";
    b1->stop();
    cout << '\n' <<*b1;

    cout << "\n Test Case 4: move() and bust() function" << endl;
    cout << "==========================================\n";
    b1->startTurn(p1);
    cout << '\n'<< *b1;

    cout <<"\nMoving in column 5:" << endl;
    if(!b1->move(5))
        cout << "Illegal Move" << endl;
    else
        cout << *b1;

    cout <<"\nSorry! Bust Occured" << endl;
    b1->bust();
    cout << *b1;



}*/
void Game::CListUnitTest(){
    Color c1('o');
    Color c2('y');
    Color c3('g');
    Color c4('b');
    Player *p1 = new Player("Arf" ,c1);
    Player *p2 = new Player("Meow", c2);
    Player *p3 = new Player("Moo", c3);
    Player *p4 = new Player("Oink", c4);

    cout << "Test Case 1: Empty List\n";
    cout << "=====================================================\n";
    cout << playerlist;

    cout << "\nTest Case 2: Insert Function\n";
    cout << "=====================================================\n";
    playerlist.insert(p1);
    playerlist.insert(p2);
    playerlist.insert(p3);
    playerlist.insert(p4);
    cout << "Name\t" << "Color\t" << "Score\t"<< "Scoreboard" << endl;
    cout << "------------------------------------" << endl;
    cout << playerlist;

    cout << "\nTest Case 3: Next, Remove, and get_count functions\n";
    cout << "=====================================================\n";
    playerlist.next();
    playerlist.remove();
    cout << "Name\t" << "Color\t" << "Score\t"<< "Scoreboard" << endl;
    cout << "------------------------------------" << endl;
    cout << playerlist;
    cout << "Player count = " << playerlist.get_count() << endl;

    cout << "\nTest Case 4: Full Circle plus one, then first()\n";
    cout << "=====================================================\n";
    for (int j = 0; j < 4; ++j){
    cout << "calling next()....";
    cout << *playerlist.next();
    }
    cout << "calling first()...." << *playerlist.first();

    cout << "\nTest Case 5: Remove all, try first()/next(), then add players again.\n";
    cout << "=====================================================\n";
    cout << "Removing all players........" << endl;
    playerlist.remove();
    playerlist.remove();
    playerlist.remove();
    cout << playerlist;
    cout << "Trying to call next().....\n";
    playerlist.next();
    cout << "Adding all players back again.....\n";

    playerlist.insert(new Player("Arf", c1));
    playerlist.insert(new Player("Meow", c2));
    playerlist.insert(new Player("Moo", c3));
    playerlist.insert(new Player("Oink", c4));
    //playerlist.insert(p3);
    //playerlist.insert(p4);
    cout << playerlist;
}
Ejemplo n.º 7
0
void tst_QGeoCircle::comparison()
{
    QGeoCircle c1(QGeoCoordinate(1,1), qreal(50.0));
    QGeoCircle c2(QGeoCoordinate(1,1), qreal(50.0));
    QGeoCircle c3(QGeoCoordinate(1,1), qreal(35.0));
    QGeoCircle c4(QGeoCoordinate(1,2), qreal(50.0));

    QVERIFY(c1 == c2);
    QVERIFY(!(c1 != c2));

    QVERIFY(!(c1 == c3));
    QVERIFY(c1 != c3);

    QVERIFY(!(c1 == c4));
    QVERIFY(c1 != c4);

    QVERIFY(!(c2 == c3));
    QVERIFY(c2 != c3);

    QGeoRectangle b1(QGeoCoordinate(20,20),QGeoCoordinate(10,30));
    QVERIFY(!(c1 == b1));
    QVERIFY(c1 != b1);

    QGeoShape *c2Ptr = &c2;
    QVERIFY(c1 == *c2Ptr);
    QVERIFY(!(c1 != *c2Ptr));

    QGeoShape *c3Ptr = &c3;
    QVERIFY(!(c1 == *c3Ptr));
    QVERIFY(c1 != *c3Ptr);
}
Ejemplo n.º 8
0
void CategoryTest::TestIdentityOperators()
{
	Category c1, c2("a"), c3("a"), c4(InvalidCategory);

	CPPUNIT_ASSERT(c1 == c1 && c1 != c2 && c1 != c4);
	CPPUNIT_ASSERT(c2 == c3);
	CPPUNIT_ASSERT(c4 != c1 && c4 != c2 && c4 != c3 && c4 == c4);
}
Ejemplo n.º 9
0
static void  TestCounter()
{
#if !defined (ACE_WIN32)
   long l = LONG_MAX, nl = LONG_MIN;  // limits.h
   unsigned long ul = ULONG_MAX, def = 0;
   int i = INT_MAX, ni = INT_MIN;
   unsigned int ui = UINT_MAX;
   unsigned short us = 10;
   short si = static_cast<short> (65535);

   // constructors
   Counter32 c1;
   ACE_ASSERT(c1 == def);
   Counter32 c2(l);
   ACE_ASSERT(c2 == static_cast<unsigned long> (l));
   Counter32 c3(nl);
   ACE_ASSERT(c3 == static_cast<unsigned long> (nl));
   Counter32 c4(ul);
   ACE_ASSERT(c4 == ul);
   Counter32 c5(i);
   ACE_ASSERT(c5 == static_cast<unsigned long> (i));
   Counter32 c6(ni);
   ACE_ASSERT(c6 == static_cast<unsigned long> (ni));
   Counter32 c7(ui);
   ACE_ASSERT(c7 == ui);
   Counter32 *c8 = new Counter32(c5);
   ACE_ASSERT(c8 != 0);
   delete c8;

  ACE_DEBUG ((LM_DEBUG, "(%P|%t) c1(\"\") [%u]\n",
    (unsigned long)c1));
  ACE_DEBUG ((LM_DEBUG, "(%P|%t) c2(\"%u\") [%u]\n",
    l, (unsigned long)c2));
  ACE_DEBUG ((LM_DEBUG, "(%P|%t) c3(\"%u\") [%u]\n",
    nl, (unsigned long)c3));
  ACE_DEBUG ((LM_DEBUG, "(%P|%t) c4(\"%u\") [%u]\n",
    ul, (unsigned long)c4));
  ACE_DEBUG ((LM_DEBUG, "(%P|%t) c5(\"%u\") [%u]\n",
    i, (unsigned long)c5));
  ACE_DEBUG ((LM_DEBUG, "(%P|%t) c6(\"%u\") [%u]\n",
    ni, (unsigned long)c6));
  ACE_DEBUG ((LM_DEBUG, "(%P|%t) c7(\"%u\") [%u]\n",
    ui, (unsigned long)c7));

  // assignent
  c1 = c2;  // obj
  ACE_ASSERT(c1 == c2);
  c1 = c1; // self
  ACE_ASSERT(c1 == c1);
  c1 = def; // unsigned long
  ACE_ASSERT(c1 == def);
  c1 = us; // unsigned short
  ACE_ASSERT(c1 == static_cast<unsigned long> (us));
  c1 = si; // unsigned short
  ACE_ASSERT(c1 == static_cast<unsigned long> (si));
#endif /*ACE_WIN32*/
}
Ejemplo n.º 10
0
int
main (void)
{
  x r;

  s<x, &x::test1> c4 (r);
  s<x, &x::test2> c5 (r);

  return 0;
}
Ejemplo n.º 11
0
int main()
{
	Ciclo c4(3, 11, 3);
	c4.Adicionar(12);
	std::cout << std::endl << "Atual: " << c4.GetAtual();

	c4.Adicionar(32);
	std::cout << std::endl << "Atual: " << c4.GetAtual();

	return 0;
}
Ejemplo n.º 12
0
void tst_QGeoBoundingCircle::comparison()
{
    QGeoBoundingCircle c1(QGeoCoordinate(1,1), qreal(50.0));
    QGeoBoundingCircle c2(QGeoCoordinate(1,1), qreal(50.0));
    QGeoBoundingCircle c3(QGeoCoordinate(1,1), qreal(35.0));
    QGeoBoundingCircle c4(QGeoCoordinate(1,2), qreal(50.0));

    QVERIFY(c1 == c2);
    QVERIFY(c1 != c3);
    QVERIFY(c1 != c4);
    QVERIFY(c2 != c3);
}
Ejemplo n.º 13
0
void testHand() {

	Hand h1;
	Card c1(1); // Normal 1
	Card c2(2);// Normal 2
	Card c3(3);// Normal 3
	Card c4(4);// Normal 4
	Card c11(11);// Normal 11
	Card c12(12);// Normal 12
	Card sb(13, SKIP_BO); // Skipbo

	h1.add(c1);
	assert(h1.getTopNum() == c1.getNumber()); //Checks if card was added

	h1.add(c3);
	h1.add(c2);
	h1.order(); 

	assert(h1.getTopNum() == c3.getNumber()); // C3 should be at the top after it gets ordered

	h1.add(sb);
	h1.add(c12);
	h1.add(c11);
	h1.order(); 

	assert(h1.getTopNum() == sb.getNumber()); // Skipbos always at the top

	h1.add(c4);
	assert(h1.getTopNum() == c4.getNumber()); // Added new card, out of order
	h1.order();
	assert(h1.getTopNum() == sb.getNumber()); // Skipbos always at the top

	// Testing the remove function:
	assert(h1.remove(c4) == c4);
	assert(h1.remove(sb) == sb);
	assert(h1.remove(c11) == c11);

	// Adding a new card out of order
	h1.add(c3);
	h1.order();
	// Removing all cards and checking if hand is fully ordered:
	assert(h1.getTopNum() == c12.getNumber());
	assert(h1.remove(c12) == c12);
	assert(h1.getTopNum() == c3.getNumber());
	assert(h1.remove(c3) == c3);
	assert(h1.getTopNum() == c3.getNumber()); // C3 remains at end because two c3 cards were added
	assert(h1.remove(c3) == c3);
	assert(h1.getTopNum() == c2.getNumber());
	assert(h1.remove(c2) == c2);
	assert(h1.getTopNum() == c1.getNumber());
	
	
}
Ejemplo n.º 14
0
hMatrix Jacobian_hMatrix(double *theta, double *alpha, double *a, double *d) {
	hMatrix T01(4,4), T02(4,4), T03(4,4), T04(4,4), T05(4,4), T06(4,4), T07(4,4);	
	T01 = T_hMatrix(&theta[0], &alpha[0], &a[0], &d[0], 1);
	T02 = T_hMatrix(&theta[0], &alpha[0], &a[0], &d[0], 2);
	T03 = T_hMatrix(&theta[0], &alpha[0], &a[0], &d[0], 3);
	T04 = T_hMatrix(&theta[0], &alpha[0], &a[0], &d[0], 4);
	T05 = T_hMatrix(&theta[0], &alpha[0], &a[0], &d[0], 5);
	T06 = T_hMatrix(&theta[0], &alpha[0], &a[0], &d[0], 6);
	T07 = T_hMatrix(&theta[0], &alpha[0], &a[0], &d[0], 7);

	double k[3] = {0,0,1};
	double z1[3] = { T01.element(0,2),T01.element(1,2), T01.element(2,2)};
	double z2[3] = { T02.element(0,2),T02.element(1,2), T02.element(2,2)};
	double z3[3] = { T03.element(0,2),T03.element(1,2), T03.element(2,2)};
	double z4[3] = { T04.element(0,2),T04.element(1,2), T04.element(2,2)};
	double z5[3] = { T05.element(0,2),T05.element(1,2), T05.element(2,2)};
	double z6[3] = { T06.element(0,2),T06.element(1,2), T06.element(2,2)};

	double o1[3] = {T01.element(0,3), T01.element(1,3), T01.element(2,3)};
	double o2[3] = {T02.element(0,3), T02.element(1,3), T02.element(2,3)};
	double o3[3] = {T03.element(0,3), T03.element(1,3), T03.element(2,3)};
	double o4[3] = {T04.element(0,3), T04.element(1,3), T04.element(2,3)};
	double o5[3] = {T05.element(0,3), T05.element(1,3), T05.element(2,3)};
	double o6[3] = {T06.element(0,3), T06.element(1,3), T06.element(2,3)};
	double o7[3] = {T07.element(0,3), T07.element(1,3), T07.element(2,3)};
 
	double O1[3] ={o7[0],o7[1],o7[2]};
	double O2[3] ={o7[0]-o1[0],o7[1]-o1[1],o7[2]-o1[2]};
	double O3[3] ={o7[0]-o2[0],o7[1]-o2[1],o7[2]-o2[2]};
	double O4[3] ={o7[0]-o3[0],o7[1]-o3[1],o7[2]-o3[2]};
	double O5[3] ={o7[0]-o4[0],o7[1]-o4[1],o7[2]-o4[2]};
	double O6[3] ={o7[0]-o5[0],o7[1]-o5[1],o7[2]-o5[2]};
	double O7[3] ={o7[0]-o6[0],o7[1]-o6[1],o7[2]-o6[2]};
	
	hMatrix c1(1,3),c2(1,3),c3(1,3),c4(1,3),c5(1,3),c6(1,3),c7(1,3);
	c1 =  cross(&k[0],&O1[0]);
	c2 =  cross(&z1[0],&O2[0]);
	c3 =  cross(&z2[0],&O3[0]);
	c4 =  cross(&z3[0],&O4[0]);
	c5 =  cross(&z4[0],&O5[0]);
	c6 =  cross(&z5[0],&O6[0]);
	c7 =  cross(&z6[0],&O7[0]);

	double J[42] = { c1.element(0,0), c2.element(0,0), c3.element(0,0), c4.element(0,0), c5.element(0,0), c6.element(0,0), c7.element(0,0),
					c1.element(0,1), c2.element(0,1), c3.element(0,1), c4.element(0,1), c5.element(0,1), c6.element(0,1), c7.element(0,1),
					c1.element(0,2), c2.element(0,2), c3.element(0,2), c4.element(0,2), c5.element(0,2), c6.element(0,2), c7.element(0,2),
					k[0],z1[0],z2[0],z3[0],z4[0],z5[0],z6[0],
					k[1],z1[1],z2[1],z3[1],z4[1],z5[1],z6[1],
					k[2],z1[2],z2[2],z3[2],z4[2],z5[2],z6[2]};
	hMatrix Jacobian(6,7);
	Jacobian.SET(6,7,&J[0]);
	return Jacobian;
}
Ejemplo n.º 15
0
/* ******************************************************************************************** */
int main (int argc, char** argv) {

	// Compute the transformation
	T1.block<3,3>(0,0) = Eigen::AngleAxis<double>(M_PI, Eigen::Vector3d(0,0,1)).matrix();
	T2.block<3,3>(0,0) = Eigen::AngleAxis<double>(M_PI, Eigen::Vector3d(0,0,1)).matrix() * 
		Eigen::AngleAxis<double>(M_PI_2, Eigen::Vector3d(0,1,0)).matrix();
	T2.block<3,1>(0,3) = Eigen::Vector3d(2.05, 0.4, 2.55);
	T3.block<3,3>(0,0) = Eigen::AngleAxis<double>(M_PI, Eigen::Vector3d(0,0,1)).matrix() * 
		Eigen::AngleAxis<double>(M_PI, Eigen::Vector3d(0,1,0)).matrix();
	T3.block<3,1>(0,3) = Eigen::Vector3d(0.0, 0.0, 0.0);
	T4.block<3,3>(0,0) = Eigen::AngleAxis<double>(M_PI, Eigen::Vector3d(0,0,1)).matrix() * 
		Eigen::AngleAxis<double>(3*M_PI_2, Eigen::Vector3d(0,1,0)).matrix();
	T4.block<3,1>(0,3) = Eigen::Vector3d(0.0, 0.0, 0.0);

  Cloud::Ptr c1 (new Cloud);
  Cloud::Ptr c2 (new Cloud);
  Cloud::Ptr c3 (new Cloud);
  Cloud::Ptr c4 (new Cloud);
	assert(pcl::io::loadPCDFile<pcl::PointXYZRGBA> (argv[1], *c1) != -1);

	double distLimit = 6.5;

	

  boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer = rgbVis(Cloud::Ptr(new Cloud));

  while (!viewer->wasStopped ()) {

		Cloud::Ptr point_cloud_ptr (new Cloud);

		// First cloud
		for (int h=0; h < c1->height; h++) {
			for (int w=0; w < c1->width; w++) {
				pcl::PointXYZRGBA point = c1->at(w, h);
				if(point.x != point.x) continue;
				if(point.z > atof(argv[2])) continue;
				if(fabs(point.x) > atof(argv[3])) continue;
				Eigen::Vector4d p (point.x, point.y, point.z, 1);
				Eigen::Vector4d Tp = T1 * p;
				point.x = Tp(0); point.y = Tp(1); point.z = Tp(2);
				point_cloud_ptr->push_back(point);
			}
		}

		viewer->removePointCloud("sample cloud");
		pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGBA> rgb(point_cloud_ptr);
		viewer->addPointCloud<pcl::PointXYZRGBA> (point_cloud_ptr, rgb, "sample cloud");
		viewer->setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 4, "sample cloud");
    viewer->spinOnce (100);
    boost::this_thread::sleep (boost::posix_time::microseconds (10000));
  }
}
Ejemplo n.º 16
0
int main ()
{
  complex c1 (1, 0);
  complex c2 (2, 0);
  complex c3 (2, 3);
  complex c4 (2, 1);

  complex m1 = max (c1, c2);
  complex m2 = max (c3, c4);
  m1.print ();
  m2.print ();
  return 0;
}
Ejemplo n.º 17
0
int main(int argc, char *argv[]) {
	char const *testData = "ACGTTGCACATG";
	for (unsigned int i = 0; i < ::strlen(testData); ++i) {
		ChromosomeBase<2> c2(::strdup(testData), i);
		ChromosomeBase<4> c4(::strdup(testData), i);
		ChromosomeBase<8> c8(::strdup(testData), i);
		for (unsigned int j = 0; j < i; ++j) {
			assert(c2[j] == testData[j]);
			assert(c4[j] == testData[j]);
			assert(c8[j] == testData[j]);
		}
	}
}
Ejemplo n.º 18
0
    void createCategory()
    {
        Category c1 (AUDIO);
        Category c2 (VIDEO,"bin1");
        Category c3 (VIDEO,"bin1/subbin");
        Category c4 (EFFECT,"some_kind");

        _Fmt fmt ("Category: %s");

        cout << fmt % c1 << "\n";
        cout << fmt % c2 << "\n";
        cout << fmt % c3 << "\n";
        cout << fmt % c4 << "\n";
    }
Ejemplo n.º 19
0
void check_equal()
{
  bool are_equal;

  Polycurve_conic_traits_2 traits;
  Polycurve_conic_traits_2::Equal_2 equal = traits.equal_2_object();
  Polycurve_conic_traits_2::Construct_x_monotone_curve_2
    construct_x_monotone_curve_2 = traits.construct_x_monotone_curve_2_object();

  //create some curves
  Conic_point_2 ps1(Rational(1,4), 4);
  Conic_point_2 pt1(2, Rational(1,2));
  Conic_curve_2 c1(0, 0, 1, 0, 0, -1, CGAL::COUNTERCLOCKWISE, ps1, pt1);

  Conic_point_2 ps2(Rational(1,4), 4);
  Conic_point_2 pt2(2, Rational(1,2));
  Conic_curve_2 c2(0, 0, 1, 0, 0, -1, CGAL::COUNTERCLOCKWISE, ps2, pt2);

  Rat_point_2 ps3(Rational(1,4), 4);
  Rat_point_2 pmid3(Rational(3,2), 2);
  Rat_point_2 pt3(2, Rational(1,3));
  Conic_curve_2 c3(ps3, pmid3, pt3);

  Rat_point_2 ps4(1, 5);
  Rat_point_2 pmid4(Rational(3,2), 3);
  Rat_point_2 pt4(3, Rational(1,3));
  Conic_curve_2 c4(ps4, pmid4, pt4);

  // //make x_monotone
  Polycurve_conic_traits_2::X_monotone_curve_2 xmc1 =
    construct_x_monotone_curve_2(c1);
  Polycurve_conic_traits_2::X_monotone_curve_2 xmc2 =
    construct_x_monotone_curve_2(c2);
  Polycurve_conic_traits_2::X_monotone_curve_2 xmc3 =
    construct_x_monotone_curve_2(c3);
  Polycurve_conic_traits_2::X_monotone_curve_2 xmc4 =
    construct_x_monotone_curve_2(c4);

  are_equal = equal(xmc1, xmc2);
  std::cout << "Two equal conic arcs are computed as:  "
            << ((are_equal) ? "equal" : "Not equal") << std::endl;

  are_equal = equal(xmc3, xmc2);
  std::cout << "Two un-equal conic arcs are computed as:  "
            << ((are_equal) ? "equal" : "Not equal") << std::endl;

  are_equal = equal(xmc3, xmc4);
  std::cout << "Two un-equal conic arcs are computed as:  "
            << ((are_equal) ? "equal" : "Not equal") << std::endl;
 }
Ejemplo n.º 20
0
void TestStelSphericalGeometry::initTestCase()
{
	// Testing code for new polygon code
	QVector<QVector<Vec3d> > contours;
	QVector<Vec3d> c1(4);
	StelUtils::spheToRect(-0.5, -0.5, c1[3]);
	StelUtils::spheToRect(0.5, -0.5, c1[2]);
	StelUtils::spheToRect(0.5, 0.5, c1[1]);
	StelUtils::spheToRect(-0.5, 0.5, c1[0]);
	contours.append(c1);
	QVector<Vec3d> c2(4);
	StelUtils::spheToRect(-0.2, 0.2, c2[3]);
	StelUtils::spheToRect(0.2, 0.2, c2[2]);
	StelUtils::spheToRect(0.2, -0.2, c2[1]);
	StelUtils::spheToRect(-0.2, -0.2, c2[0]);
	contours.append(c2);

	holySquare.setContours(contours);
	bigSquare.setContour(c1);
	bigSquareConvex.setContour(c1);
	QVector<Vec3d> c2inv(4);
	c2inv[0]=c2[3]; c2inv[1]=c2[2]; c2inv[2]=c2[1]; c2inv[3]=c2[0];
	smallSquare.setContour(c2inv);
	smallSquareConvex.setContour(c2inv);

	QVector<Vec3d> triCont;
	triCont << Vec3d(1,0,0) << Vec3d(0,0,1) << Vec3d(0,1,0);
	triangle.setContour(triCont);


	QVector<Vec3d> c4(4);
	StelUtils::spheToRect(M_PI-0.5, -0.5, c4[3]);
	StelUtils::spheToRect(M_PI+0.5, -0.5, c4[2]);
	StelUtils::spheToRect(M_PI+0.5, 0.5, c4[1]);
	StelUtils::spheToRect(M_PI-0.5, 0.5, c4[0]);
	opositeSquare.setContour(c4);

	QVector<Vec3d> cpole(4);
	StelUtils::spheToRect(0.1,M_PI/2.-0.1, cpole[3]);
	StelUtils::spheToRect(0.1+M_PI/2., M_PI/2.-0.1, cpole[2]);
	StelUtils::spheToRect(0.1+M_PI, M_PI/2.-0.1, cpole[1]);
	StelUtils::spheToRect(0.1+M_PI+M_PI/2.,M_PI/2.-0.1, cpole[0]);
	northPoleSquare.setContour(cpole);

	StelUtils::spheToRect(0.1,-M_PI/2.+0.1, cpole[0]);
	StelUtils::spheToRect(0.1+M_PI/2., -M_PI/2.+0.1, cpole[1]);
	StelUtils::spheToRect(0.1+M_PI, -M_PI/2.+0.1, cpole[2]);
	StelUtils::spheToRect(0.1+M_PI+M_PI/2.,-M_PI/2.+0.1, cpole[3]);
	southPoleSquare.setContour(cpole);
}
Ejemplo n.º 21
0
TEST_F(HashTableTest, TestMapRehashWithObjects)
{
    capu::HashTable<SomeClass, capu::uint32_t> table(2);
    SomeClass c1(1);
    SomeClass c2(2);
    SomeClass c3(3);
    SomeClass c4(4);

    table.put(c1, 1);
    table.put(c2, 2);
    table.put(c3, 3);
    table.put(c4, 4); // rehashing

    SomeClass cTest(3); // same i value as c3 -> 3 must get returned
    EXPECT_EQ(3u, table.at(cTest));
}
Ejemplo n.º 22
0
int main(void){
	std::cout << "HI" << std::endl;
	Complex c1(1,2), c2(3,1), c3(4,2), c4(2,2);
	std::vector<Complex> coeff;
	coeff.push_back(c1); coeff.push_back(c2); coeff.push_back(c3);
	ComplexPoly poly(coeff, 2);
	Complex res = poly.evaluate(c4);
	std::cout << res << std::endl;
	
	Complex c5(2,3), c6(3,4), c7(8,2);
	Complex data[3] = {c5,c6,c7};
	ComplexPoly cp(data, 2);
	Complex result = cp.evaluate(c4);
	std::cout << result << std::endl;
	std::cout << cp << std::endl;
	return 0;
}
Ejemplo n.º 23
0
int main( int argc, char *argv[] )
 {
  // Here is how to initialize color from constant lavander
  ::color::rgb<::color::type::split422_t>   c1( ::color::constant::lavender_type{} );
  ::color::rgb<::color::type::split655_t >  c2( ::color::constant::lavender_type{} );
  ::color::rgb<std::uint8_t>                c3( ::color::constant::lavender_type{} );
  ::color::rgb<std::uint64_t>               c4( ::color::constant::lavender_type{} );
  ::color::rgb<float>                       c5( ::color::constant::lavender_type{} );

  std::cout << c1[0] << ", " << c1[1] << ", " << c1[2] << std::endl;
  std::cout << c2[0] << ", " << c2[1] << ", " << c2[2] << std::endl;
  std::cout << c3[0] << ", " << c3[1] << ", " << c3[2] << std::endl;
  std::cout << c4[0] << ", " << c4[1] << ", " << c4[2] << std::endl;
  std::cout << c5[0] << ", " << c5[1] << ", " << c5[2] << std::endl;

  return EXIT_SUCCESS;
 }
Ejemplo n.º 24
0
    void containmentQuery()
    {
        Category c1 (VIDEO);
        Category c2 (VIDEO,"bin1");
        Category c3 (VIDEO,"bin1/subbin");
        Category c4 (EFFECT,"some_kind");

        CHECK ( c1.hasKind(VIDEO) );
        CHECK (!c1.hasKind(AUDIO) );
        CHECK ( c2.isWithin(c1) );
        CHECK ( c3.isWithin(c2) );
        CHECK ( c3.isWithin(c1) );
        CHECK (!c1.isWithin(c2) );
        CHECK (!c2.isWithin(c3) );
        CHECK (!c1.isWithin(c3) );
        CHECK (!c3.isWithin(c4) );
        CHECK (!c4.isWithin(c3) );
    }
Ejemplo n.º 25
0
int main( int argc, char *argv[] )
 {
  ::color::rgb<::color::type::split422_t>   c1( { 7, 6 , 3} );
  ::color::rgb<::color::type::split655_t >  c2( { 6, 12 , 19} );
  ::color::rgb<std::uint8_t>                c3( { 64, 127 , 192 } );
  ::color::rgb<std::uint64_t>               c4( { 64000, 1270 , 1920 } );
  ::color::rgb<float>                       c5( { 0.5, 0.6, 0.7} );
  ::color::rgb<double>                      c6( { 0.5, 0.6, 0.7} );

  std::cout << c1[0] << ", " << c1[1] << ", " << c1[2] << std::endl;
  std::cout << c2[0] << ", " << c2[1] << ", " << c2[2] << std::endl;
  std::cout << c3[0] << ", " << c3[1] << ", " << c3[2] << std::endl;
  std::cout << c4[0] << ", " << c4[1] << ", " << c4[2] << std::endl;
  std::cout << c5[0] << ", " << c5[1] << ", " << c5[2] << std::endl;
  std::cout << c6[0] << ", " << c6[1] << ", " << c6[2] << std::endl;

  return EXIT_SUCCESS;
 }
Ejemplo n.º 26
0
int main( int argc, char *argv[] )
 {
  ::color::cmy<std::uint8_t>     c1( { 64, 127 , 192 } );
  ::color::cmy<std::uint16_t>    c2( { 280, 350 , 1000 } );
  ::color::cmy<std::uint32_t>    c3( { 640, 127 , 192 } );
  ::color::cmy<std::uint64_t>    c4( { 64000, 1270 , 1920 } );
  ::color::cmy<float>            c5( { 0.5, 0.6, 0.7} );
  ::color::cmy<double>           c6( { 0.5, 0.6, 0.7} );

  std::cout << c1[0] << ", " << c1[1] << ", " << c1[2] << std::endl;
  std::cout << c2[0] << ", " << c2[1] << ", " << c2[2] << std::endl;
  std::cout << c3[0] << ", " << c3[1] << ", " << c3[2] << std::endl;
  std::cout << c4[0] << ", " << c4[1] << ", " << c4[2] << std::endl;
  std::cout << c5[0] << ", " << c5[1] << ", " << c5[2] << std::endl;
  std::cout << c6[0] << ", " << c6[1] << ", " << c6[2] << std::endl;

  return EXIT_SUCCESS;
 }
Ejemplo n.º 27
0
/**
* \fn main
* \brief fonction main permettant de creer les chaines et de tester les fonctions
*
*/
int main (int agc, char* argv[]){
	printf("Debut de la fonction main\n");

	// Creation de tableaux de caractères

	char test[] = "test test";
	char test2[] = "test";
	char test3[] = "ananas";
	char test4[] = "hello world";
	char c = 's';

	// creation de chaines de caractères avec les différents constructeurs
	Chaine c1;
	Chaine c2(test);
	Chaine c3(c2);
	Chaine c4(test2);
	Chaine c5(test3);
	Chaine c6(test4);

	// test des fonctions de chaine.cpp
	c1.afficherChaine(); // empty chaine
	c2.afficherChaine(); // "test test"
	c3.afficherChaine(); // test test"
	cout << (c1 == c3) <<endl;  // false
	cout << (c2 == c3) <<endl;  // true 
	cout << (c4 == c3) <<endl;  // false
	cout << (c4 > c5) <<endl;   // true
	cout << (c4 < c5) <<endl;   // false
	cout << (c5 < c4) <<endl;   // true

	(c4+c5).afficherChaine(); // "testananas"
	(c2 += c5).afficherChaine(); // c2 : "test testananas"
	c2.afficherChaine(); // "test testananas"

	cout << "Indexe du caractere s dans la chaine ";
	c5.afficherChaine();  // "ananas"
	cout << " : " ;
	cout << c5.index_char(c) <<endl; // the first occurence of s is at the position 6

	c6.sous_chaine(6,10).afficherChaine(); // "word"

	printf("fin du main\n");

}
Ejemplo n.º 28
0
SE_Spatial* SE_ElementManager::createSpatial()
{
    if(!mRoot)
        return NULL;
    SE_Spatial* spatial = mRoot->createSpatial(NULL);
    spatial->setLocalTranslate(SE_Vector3f(0, 0, 0));
    spatial->setLocalScale(SE_Vector3f(1, 1, 1));
    SE_Vector4f c1(1, 0, 0, 0);
    SE_Vector4f c2(0, -1, 0, 0);
    SE_Vector4f c3(0, 0, 1, 0);
    SE_Vector4f c4(-mRoot->getWidth() / 2, mRoot->getHeight() / 2, 0, 1);
    SE_Matrix4f localM;
    localM.setColumn(0, c1);
    localM.setColumn(1, c2);
    localM.setColumn(2, c3);
    localM.setColumn(3, c4);
    spatial->setPostMatrix(localM);
    return spatial;
}
Ejemplo n.º 29
0
void renderPolygons(void) {
	// set clearing color 
	glClearColor(0.0, 0.0, 0.0, 0.0);
	glClear(GL_COLOR_BUFFER_BIT);

	// first polygon - triangle - yellow
	Point c1(100,50,0);
	Color fc1(1.0, 1.0, 0.0, 0.0);
	Polygon tri(40, c1, 3, 1, GL_LINE_LOOP, fc1);
	tri.draw();

	// square - hollow - light blue(cyan)
	Point c2(100,150,0);
	Color fc2(0.0, 1.0, 1.0, 0.0);
	Polygon squ(40, c2, 4, 8, GL_LINE_LOOP, fc2);
	squ.draw();

	// pentagon - hollow - gray
	Point c3(100,250,0);
	Color fc3(0.5, 0.5, 0.5, 0.0);
	Polygon pent(40, c3, 5, 3, GL_LINE_LOOP, fc3);
	pent.draw();

	//hexagon - not hollow - red
	Point c4(200,50,0);
	Color fc4(1.0, 0.0, 0.0, 0.0);
	Polygon hex(40, c4, 6, 3, GL_POLYGON, fc4);
	hex.draw();

	// nonagon - hollow - green
	Point c5(200,150,0);
	Color fc5(0.0, 1.0, 0.0, 0.0);
	Polygon nin(40, c5, 9, 5, GL_LINE_LOOP, fc5);
	nin.draw();

	// tridecagon - hollow - purple
	Point c6(300,300,0);
	Color fc6(1.0, 0.0, 1.0, 0.0);
	Polygon thri(90, c6, 13, 3, GL_LINE_LOOP, fc6);
	thri.draw();

	glutSwapBuffers();
}
Ejemplo n.º 30
0
int main( int argc, char *argv[] )
 {
  color::gray<bool>           c0( { true } );
  color::gray<std::uint8_t>   c1( { 120 } );
  color::gray<std::uint16_t>  c2( { 6 } );
  color::gray<std::uint32_t>  c3( { 64000} );
  color::gray<std::uint64_t>  c4( { 6400000u } );
  color::gray<float>          c5( { 0.5 }  );
  color::gray<double>         c6( { 0.5 }  );
  color::gray<long double>    c7( { 0.5 }  );

  std::cout << c1[0] << std::endl;
  std::cout << c2[0] << std::endl;
  std::cout << c3[0] << std::endl;
  std::cout << c4[0] << std::endl;
  std::cout << c5[0] << std::endl;
  std::cout << c6[0] << std::endl;

  return EXIT_SUCCESS;
 }