示例#1
0
int main(int argc, char *argv[])
{
	Animal animal;
	Bird bird, mutantBird;
	Cat cat;
	Crow crow;

	newAnimal(&animal);
	animal.setName(&animal, animalName);

	newBird(&bird);
	((Animal *) &bird)->setName((Animal *) &bird, birdName);

	newBird(&mutantBird);
	((Animal *) &mutantBird)->setName((Animal *) &mutantBird, mutantBirdName);
	((Animal *) &mutantBird)->setLegs((Animal *) &mutantBird, 3);

	newCat(&cat);
	((Animal *) &cat)->setName((Animal *) &cat, catsName);

	newCrow(&crow);
	((Animal *) &crow)->setName((Animal *) &crow, crowName);

	test_animal(&animal);
	test_animal((Animal *) &bird);
	test_animal((Animal *) &mutantBird);
	test_animal((Animal *) &cat);
	test_animal((Animal *) &crow);

	test_cat(&cat);

	test_bird(&bird);
	test_bird((Bird *) &mutantBird);
	test_bird((Bird *) &crow);

	test_crow(&crow);

	return 0;
}
示例#2
0
int main(int argc, char *argv[])
{
  unsigned long i;
  char ant_name[65];
  char malice_name[65];
  char water_name[513];

  h_core_seed_random_with_time();

  if (h_core_bool_false) {

    ant_name[64] = '\0';
    for (i = 0; i < 32; i++) {
      randomize_ant_name(ant_name);
      test_ant(ant_name);
      /*  printf("%s\n", ant_name);  */
    }

    for (i = 0; i < 256; i++) {
      test_clear(i);
    }

    test_crow(26715);
    test_crow(28050);

    for (i = 0; i < 256; i++) {
      test_eca(i);
    }

    test_k3(0);
    test_k3(782563);
    test_k3(4438761);
    test_k3(6618712);
    test_k3(8388608);
    test_k3(9615746);
    test_k3(11145723);
    test_k3(11222444);
    test_k3(11416532);
    test_k3(11417530);
    test_k3(11417532);
    test_k3(12256311);
    test_k3(12410031);
    test_k3(14817253);
    test_k3(15736917);
    test_k3(16777215);
    if (h_core_bool_false) {
      for (i = 0; i < 32; i++) {
        test_k3(random() % 16777216);
      }
    }

    malice_name[64] = '\0';
    for (i = 0; i < 32; i++) {
      randomize_malice_name(malice_name);
      test_malice(malice_name);
      /*  printf("%s\n", malice_name);  */
    }

    water_name[512] = '\0';
    for (i = 0; i < 32; i++) {
      randomize_water_name(water_name);
      test_water(water_name);
      /*  printf("%s\n", water_name);  */
    }

  }

  water_name[512] = '\0';
  for (i = 0; i < 32; i++) {
    randomize_water_name(water_name);
    test_pov(water_name);
    /*  printf("%s\n", water_name);  */
  }

  return 0;
}