Exemple #1
0
    void object::test<2>()
    {
		geos::geom::Triangle abc(a, b, c);
		
		ensure_equals( abc.p0, a );
		ensure_equals( abc.p1, b );
		ensure_equals( abc.p2, c );
    }
Exemple #2
0
void Plane::set(const Vector3& point, const Vector3& normal) {
  Vector3 abc(normal);
  abc.normalize();
  a = abc.x;
  b = abc.y;
  c = abc.z;
  d = -abc.dot(point);
}
void foo()
{
	abc(  1,   2,   3);
	abc( 10,  20,  30);
	abc(100, 200, 300);
	cab(3, 2, 1, 0);
	brat(     "foo", 2000, 3000);
	brat("question",    2,  -42);
	brat(       "a",  -22,    1);
	while (1)
	{
		brat(     "foo", 2000, 3000);
		brat("question",    2,  -42);
		brat(       "a",  -22,    1);
	}
	brat("foo", 2000, 3000);
	brat(  "a",  -22,    1);
}
Exemple #4
0
    void object::test<3>()
    {
		geos::geom::Triangle abc(a, b, c);
		geos::geom::Triangle copy(abc);

		ensure_equals( copy.p0, a );
		ensure_equals( copy.p1, b );
		ensure_equals( copy.p2, c );
	}
TEST_F( FieldsTest, FieldsMethodInCtor ) {
  Fields abc( fields
              ( "a", ActiveRecord::integer )
              ( "b", ActiveRecord::text )
              ( "c", ActiveRecord::floating_point )
              ( "d", ActiveRecord::date ) );

  ASSERT_EQ( 4, abc.size() );
}
Exemple #6
0
void main()
{
char c;
  do
  {
  abc();
  c=getche();
  if(c=='n'||c=='N') break;
  }while(c=='y'||c=='Y');
}
Exemple #7
0
int main()
{
    printf("%d\n ",a);
    abc();
    z();
    printf("\n value of a in main is: %d",a);
    getch();   
     
    
}
Exemple #8
0
void abc_test() {
    concat<char> str;
    abc(&str);
    char curr = 'a';
    while (str.ready()) {
        assert(str.get() == curr++);
    }
    assert(str.empty());
    assert(str.depleted());
    assert(str.closed());
}
Exemple #9
0
int main(int argc, char* argv[]) {
    FUNC x = &print_int;  //here the '&' is optional
    FUNC y = print_int;
    x(1);
    y(10);
    (*x)(100);      //here the '*' is optional
    (*y)(1000);
    int (*abc)(int);
    abc = print_int;
    abc(123);
    return 0;
}
Exemple #10
0
void fight(struct pokemon enemy, struct pokemon player){
  stop = time(NULL);
  if(stop-start > 10){
    printf("Times up\n");
    exit(1);
  }
  printf("\n%s [%s] vs %s [%s]\n", enemy.name, enemy.element, player.name, player.element);

 int win = 0;

 if(!(strcmp(player.element, "Fire")) && !(strcmp(enemy.element, "Grass"))){
  abc();
 } else if(!(strcmp(player.element, "Grass")) && !(strcmp(enemy.element, "Water"))){  abc();
 } else if(!(strcmp(player.element, "Water")) && !(strcmp(enemy.element, "Fire"))){
  abc();
 } else{
  printf("You lost\n");
  exit(1);
 }

}
Exemple #11
0
int
main(int argc, char *argv[])
{
    void xyz(void), abc(void);

    printf("main() calling xyz()\n");
    xyz();

    abc();

    exit(EXIT_SUCCESS);
}
Exemple #12
0
int main (void)
{
	int ddd = abc();
	int i;

	for (i = 0; i < 10; i++)
		ddd ++;

	printf("ddd = %d\n", ddd);

	return 0;
}
TEST(DOF6, Source)
//void t1()
{
  time_t ti = time(NULL);
  ROS_INFO("init Source with %d",(int)ti);
  srand(ti);

  for(int i=0; i<CYCLES; i++) {
    DOF6::TFLinkvf rot1, rot2;
    const Eigen::AngleAxisf aa=createRandomAA();
    const Eigen::Vector3f t=createRandomT();

    //tf1 should be tf2
    Eigen::Matrix4f tf1 = build_random_tflink(rot1,30,0.4,aa,t);
    Eigen::Matrix4f tf2 = build_random_tflink(rot2,30,0.2,aa,t);

    //check
    const float d1=MATRIX_DISTANCE(rot1.getTransformation(),tf1,0.4);
    const float d2=MATRIX_DISTANCE(rot2.getTransformation(),tf2,0.2);

    DOF6::DOF6_Source<DOF6::TFLinkvf,DOF6::TFLinkvf> abc(rot1.makeShared(), rot2.makeShared());


//    std::cout<<"rot\n"<<aa.toRotationMatrix()<<"\n";
//    std::cout<<"t\n"<<t<<"\n";
//
//    std::cout<<"rot\n"<<rot1.getRotation()<<"\n";
//    std::cout<<"t\n"<<rot1.getTranslation()<<"\n";
//
//    std::cout<<"rot\n"<<rot2.getRotation()<<"\n";
//    std::cout<<"t\n"<<rot2.getTranslation()<<"\n";
//
//    std::cout<<"rot\n"<<abc.getRotation().toRotMat()<<"\n";
//    std::cout<<"t\n"<<abc.getTranslation()<<"\n";
//
//
//    std::cout<<"getRotationVariance    "<<rot1.getRotationVariance()<<"\n";
//    std::cout<<"getTranslationVariance "<<rot1.getTranslationVariance()<<"\n";
//
//    std::cout<<"getRotationVariance    "<<rot2.getRotationVariance()<<"\n";
//    std::cout<<"getTranslationVariance "<<rot2.getTranslationVariance()<<"\n";
//
//    std::cout<<"getRotationVariance    "<<abc.getRotationVariance()<<"\n";
//    std::cout<<"getTranslationVariance "<<abc.getTranslationVariance()<<"\n";

    float d3=MATRIX_DISTANCE((Eigen::Matrix3f)abc.getRotation(),aa.toRotationMatrix(),0.2);
    EXPECT_NEAR((abc.getTranslation()-t).norm(),0,0.2);
    d3+=(abc.getTranslation()-t).norm();

    //EXPECT_LE(d3,std::max(d1,d2));
  }
}
Exemple #14
0
    void object::test<5>()
    {
		geos::geom::Coordinate center;
		geos::geom::Triangle abc(a, b, c);
		
		// Expected: ~4.2426406871192857
		abc.inCentre(center);
		// 1e-16 fails sometimes
		ensure( std::fabs(center.x - 6.0) < 1e-15 );
		ensure( center.y > 4.2 );
		ensure( center.y < 4.3 );
		ensure( 0 != ISNAN( center.z ) );
    }
Exemple #15
0
    void object::test<5>()
    {
		geos::geom::Coordinate center;
		geos::geom::Triangle abc(a, b, c);
		
		// Expected: ~4.2426406871192857
		abc.inCentre(center);
		// 1e-16 fails sometimes
		ensure( fabs(center.x - 6.0) < 1e-15 );
		ensure( center.y > 4.2 );
		ensure( center.y < 4.3 );
		ensure_equals( center.z, DoubleNotANumber );
    }
Exemple #16
0
bool Plane::intersectLine(const Line& line, Vector3* intersection) const {
  Vector3 abc(a,b,c);
  Float numer = d + abc.dot(line.a);
  Float denom = -abc.dot(line.ray());

  if (denom == 0) {
    // parallel to the plane
    return false;
  }

  intersection->set(line.a).add(line.ray().scale(numer/denom));

  return true;
}
int main() {
	try {
		Sudoku abc(std::cin);
		abc[0][0].field=Sudoku::Number::ONE;
		for (int i=0; i<9; i++) {
			for (int j=0; j<9; j++) {
				std::cout<<abc[i][j].field<<" ";
			}
			std::cout<<"\n";
		}
	} catch (std::exception& e) {
		std::cout<<e.what();
	}

	return 0;
}
Exemple #18
0
bool Plane::intersectSegment(const Line& segment, Vector3* intersection) const {
  Vector3 abc(a,b,c);
  Float numer = d + abc.dot(segment.a);
  Float denom = -abc.dot(segment.ray());

  if (denom == 0) {
    // parallel to the plane
    return false;
  }

  Float t = numer / denom;

  // check to make sure it falls between the segment's endpoints
  if (t < 0 || t > 1) return false;

  intersection->set(segment.a).add(segment.ray().scale(t));

  return true;
}
Exemple #19
0
void principal() {
    int i;
    int j;
    bool d;
    bool e;
    bool f;
    scanf("%d",&i);
    j = abc(j, d);
    if(i > 10) {
        printf("%d",i);
    }
    else {
        printf("%c",'<'      );
    }
    while (i < 10) {
        printf("%c",'<'      );
        i = i + 1;
    }
}
void TestMessageFormat::sample() 
{
    MessageFormat *form = 0;
    UnicodeString buffer1, buffer2;
    UErrorCode success = U_ZERO_ERROR;
    form = new MessageFormat("There are {0} files on {1}", success);
    if (U_FAILURE(success)) {
        errln("Err: Message format creation failed");
        logln("Sample message format creation failed.");
        return;
    }
    UnicodeString abc("abc");
    UnicodeString def("def");
    Formattable testArgs1[] = { abc, def };
    FieldPosition fieldpos(0);
    assertEquals("format",
                 "There are abc files on def",
                 form->format(testArgs1, 2, buffer2, fieldpos, success));
    assertSuccess("format", success);
    delete form;
}
Exemple #21
0
    void object::test<4>()
    {
		geos::geom::Triangle abc(a, b, c);
		geos::geom::Triangle copy(d, e, f);

		ensure_equals( abc.p0, a );
		ensure_equals( abc.p1, b );
		ensure_equals( abc.p2, c );
		ensure_equals( copy.p0, d );
		ensure_equals( copy.p1, e );
		ensure_equals( copy.p2, f );

		copy = abc;

		ensure_equals( copy.p0, a );
		ensure_equals( copy.p1, b );
		ensure_equals( copy.p2, c );
		ensure( copy.p0 != d );
		ensure( copy.p1 != e );
		ensure( copy.p2 != f );
	}
Exemple #22
0
int main(int argc, char *argv[]) {
    void xyz(void);
    void xyz_old(void), xyz_new(void);
    void abc(void);

    printf("Calling abc()\n");
    abc();

    printf("Calling xyz()\n");
    xyz();

    printf("Calling xyz_new()\n");
    xyz_new();

    printf("Calling xyz_old()\n");
    xyz_old();

    //xxx();

    exit(0);
}
Exemple #23
0
int main()
{
	Grid *g;

	g = (Grid *)calloc(1, sizeof(Grid));
	gridInit(g);	// initialize 2D grid

	abcInit(g);	// initialize ABC
	tfsfInit(g);	// initialize TFSF boundary
	snapshotInit2d(g);	// initialize snapshots

	/* do time stepping */
	for (Time = 0; Time < MaxTime; Time++) {
		updateH2d(g);	// update magnetic fields
		tfsfUpdate(g);	// apply TFSF boundary
		updateE2d(g);	// update electric fields
		abc(g);	// apply ABC
		snapshot2d(g);	// take a snapshot (if appropriate)
	} // end of time-stepping

	return 0;
}
void testVectors(){
    vector<double> test1(10,8.0);
    vector<double> abc(10,7.);
    vector<double> res(10);

    cout<<"vecadd test1+abc "<<endl;
    vectorAdd(&test1,&abc,&res);
    vectorPrint(&res);

    cout<<"vecsub res-abc "<<endl;
    vectorSub(&res,&abc,&res);
    vectorPrint(&res);

    cout<<"vecscalar 3 "<<endl;
    vectorScalar(&res,3.);
    vectorPrint(&res);

     cout<<"vecscalar 3 "<<endl;
    vectorScalar(&res,3.,&test1);
    vectorPrint(&test1);

    cout<<"vecvec test1 abc "<<endl;
    cout<<vectorVector(&test1,&abc)<<endl;
    vector<map< int,double> > testmat(2);//=new vector<map< int,double> >(n);
    for (int i=0;i<2;++i){
        testmat[i];//=new map< int,double> ();
    }

    testmat[0][0]= 1;
    testmat[0][1]= 1;
    testmat[1][0]= 1;
    //testmat[1][1]= 1;

    vector<double> vec(2,8.0);
    vector<double> ret(2);
    matrixVector(&testmat,&vec,&ret);
    vectorPrint(&ret);

}
Exemple #25
0
int fnumb(int i, int (*f)(Tchar))
{
	int j;

	j = 0;
	if (i < 0) {
		j = (*f)('-' | nrbits);
		i = -i;
	}
	switch (nform) {
	default:
	case '1':
	case 0:
		return decml(i, f) + j;
	case 'i':
	case 'I':
		return roman(i, f) + j;
	case 'a':
	case 'A':
		return abc(i, f) + j;
	}
}
int main()
{
	std::vector<int> vec1;
	for(int i=0; i<5; i++)
	{
		vec1.push_back(2*i + 1);
	}

	vec<int> vec2(vec1.begin(),vec1.end());
	std::cout << "[" << vec2[0];
	for(int i=1; i<vec2.size(); i++)
	{
		std::cout << "," << vec2[i];
	}
	std::cout << "]" << std::endl;

	str abc("abcdefghijklmnopqrstuvwxyz");
	str test(abc.begin(),abc.end());

	std::cout << test << std::endl;

	return 0;
}
Exemple #27
0
void
StringTest::TestStringPieceComparisons() {
    StringPiece empty;
    StringPiece null(NULL);
    StringPiece abc("abc");
    StringPiece abcd("abcdefg", 4);
    StringPiece abx("abx");
    if(empty!=null) {
        errln("empty!=null");
    }
    if(empty==abc) {
        errln("empty==abc");
    }
    if(abc==abcd) {
        errln("abc==abcd");
    }
    abcd.remove_suffix(1);
    if(abc!=abcd) {
        errln("abc!=abcd.remove_suffix(1)");
    }
    if(abc==abx) {
        errln("abc==abx");
    }
}
Exemple #28
0
double findR(double ang)
{
	cout << "angle=" << ang << endl;
	double pi = asin(1.)*2;
	double rad = pi * 2. * ang / 360.;
	double hSpeedStart = 20. * cos(rad);
	double vSpeedStart = 20. * sin(rad);

	double a = .5 * 9.81;
	double b = -vSpeedStart;
	//double b = 0;
	double c = -100;

	pair<double, double> t2 = abc(a,b,c);

	cout << "t=" << t2.first << " or " << t2.second << endl;
	double t = max(t2.first, t2.second);
	
	double r = t * hSpeedStart;
	//double r = t * 20.;

	cout << "r=" << r << endl;
	return r;
}
Exemple #29
0
int main()
{
  Grid *g;

  ALLOC_1D(g, 1, Grid);  // allocate memory for Grid

  gridInit(g);         // initialize the grid
  abcInit(g);          // initialize ABC  /*@ \label{abcdemo1A} @*/
  tfsfInit(g);         // initialize TFSF boundary
  snapshotInit(g);     // initialize snapshots

  /* do time stepping */
  for (Time = 0; Time < MaxTime; Time++) {

    updateH3(g);   // update magnetic field
    tfsfUpdate(g); // correct field on TFSF boundary
    updateE3(g);   // update electric field
/*b*/    abc(g);/*n*/         // apply ABC -- after E-field update/*@ \label{abcdemo1B} @*/
    snapshot(g);   // take a snapshot (if appropriate)

  } /* end of time-stepping */

  return 0;
}
Exemple #30
-1
int main()
{ 
    int i=0;
    for(i;i<6;i++)
    abc(i);
   // extern int g;
    printf(" \n %d",g);
    getch(); 
}