Exemplo n.º 1
0
void test_push() {
    utils::CArrayList<Foo2> list;
    Foo2 f = Foo2('1', 2);
    list.push(f);
    assert(list.size() == 1);
    assert(list[0].ch == '1');

    list.push(Foo2('3', 4));
    assert(list.size() == 2);
    assert(list[1].ch == '3');

    Foo2 farr[] = {{'5', 6},
                   {'7', 8}};
    list.push(farr, 2);
    assert(list.size() == 4);
    assert(list[3].ch == '7');

    for (int i = 0; i < 20; ++i) {
        Foo2 ff4 = Foo2('0', i + 9);
        list.push(ff4);
    }

    assert(list.size() == 24);
    assert(list[list.size() - 1].id == 28);

}
Exemplo n.º 2
0
TEST( Hit_Check_Test, RectHit ){

	wing::DefaltLoader Loader;
	auto img = Loader.load();

	TestSprite Hoge(100,100,img);

	TestSprite Foo(50,80,img);
	ASSERT_EQ(wing::sprite::checkRectHit(Hoge,Foo) , true);
	ASSERT_EQ(wing::sprite::checkRectHit(Foo,Hoge) , true);


	TestSprite Foo2(50,80,img,wing::Position(80,80) );
	ASSERT_EQ(wing::sprite::checkRectHit(Hoge,Foo2) , true);
	ASSERT_EQ(wing::sprite::checkRectHit(Foo2,Hoge) , true);

	
	TestSprite Foo3(50,80,img,wing::Position(100,80));
	ASSERT_EQ(wing::sprite::checkRectHit(Hoge,Foo3) , false);
	ASSERT_EQ(wing::sprite::checkRectHit(Foo3,Hoge) , false);


	TestSprite Foo4(50,80,img,wing::Position(80,120));
	ASSERT_EQ(wing::sprite::checkRectHit(Hoge,Foo3) , false);
	ASSERT_EQ(wing::sprite::checkRectHit(Foo3,Hoge) , false);

}
Exemplo n.º 3
0
void test_copy_constructor() {
    utils::CArrayList<Foo2> list;
    list.push(Foo2('1', 2));
    list.push(Foo2('3', 4));

    utils::CArrayList<Foo2> copyList(list);
    assert(copyList.size() == 2);

    // change values for first list
    for (Foo2 &ff : list) {
        ff.id = 8;
    }

    assert(list[0].id == 8); // check changes
    assert(copyList[0].id == 2); // check no changes in copy
}
Exemplo n.º 4
0
int main()
{
    printf("Foo:\n");
    Foo(1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13);
    printf("\nFoo1:\n");
    Foo1(-1, 2, -3, 4, -5, 6, -7, 8, -9, 10, -11, 12, -13);
    printf("\nFoo2:\n");
    Foo2(-1, 2, -3, 4, -5, 6, -7, 8, -9, 10, -11, 12, -13);
}
Exemplo n.º 5
0
void Bar ()
{
  Foo1 (&Baz); // { dg-message "required from here" }

  Foo2 (&Baz);

  Foo3 (&Baz);

  Foo3 (&Baz, &Baz);
}
Exemplo n.º 6
0
void Bar ()
{
  Foo1 (&Baz); // #1

  Foo2 (&Baz);

  Foo3 (&Baz);

  Foo3 (&Baz, &Baz); // { dg-error "no matching function" "" }
  // { dg-message "candidate" "candidate note" { target *-*-* } 21 }
}
Exemplo n.º 7
0
TEST( Hit_Check_Test, RectHitChangeRate ){
	wing::DefaltLoader Loader;
	auto img = Loader.load();

	TestSprite Hoge(100,100, img, wing::Position(0, 0), 80);
	TestSprite Foo(100,100, img, wing::Position(70, 70), 100);

	ASSERT_EQ(wing::sprite::checkRectHit(Hoge, Hoge) , false);



	ASSERT_EQ(wing::sprite::checkRectHit(Hoge, Foo) , true);
	ASSERT_EQ(wing::sprite::checkRectHit(Foo, Hoge) , true);

	TestSprite Foo1(100,100,img, wing::Position(90,70), 100);

	ASSERT_EQ(wing::sprite::checkRectHit(Hoge, Foo1) , false);
	ASSERT_EQ(wing::sprite::checkRectHit(Foo1, Hoge) , false);

	TestSprite Foo2(100,100,img, wing::Position(70,90), 100);

	ASSERT_EQ(wing::sprite::checkRectHit(Hoge, Foo2) , false);
	ASSERT_EQ(wing::sprite::checkRectHit(Foo2, Hoge) , false);

	TestSprite Foo3(5, 5, img);

	ASSERT_EQ(wing::sprite::checkRectHit(Hoge, Foo3) , false);
	ASSERT_EQ(wing::sprite::checkRectHit(Foo3, Hoge) , false);

	TestSprite Foo4(5, 5, img, wing::Position(10,10));

	ASSERT_EQ(wing::sprite::checkRectHit(Hoge, Foo4) , true);
	ASSERT_EQ(wing::sprite::checkRectHit(Foo4, Hoge) , true);


}
Exemplo n.º 8
0
 void f() {
   (void)(true ? Bar() : Foo1()); // okay
   (void)(true ? Bar() : Foo2()); // okay
   (void)(true ? Bar() : Foo3()); // expected-error{{no viable constructor copying temporary}}
 }
Exemplo n.º 9
0
void test() {
  Foo2(vector2<int*>());  // expected-error{{no matching function for call to 'Foo2'}}
  Foo(vector<int*>());  // expected-error{{no matching function for call to 'Foo'}}
}