Esempio n. 1
0
int main()
{
  printf("%s\n", "testing sl_cons");
  sphere *s1 = sphere_new(vec_new(0.0, 0.0, 0.0), 10.0, rgb_new(0.5, 0.5, 0.5));
  sphere *s2 = sphere_new(vec_new(1.0, 1.0, 1.0), 5.0, rgb_new(0.1, 0.1, 0.1));
  sphere *s3 = sphere_new(vec_new(100.0, 100.0, 100.0), 100.0, rgb_new(0, 0, 0));

  sphere_list *sl = sl_cons(s1, sl_cons(s2, sl_cons(s3, NULL)));
  sl_print(sl);
  printf("%s\n", "testing sl_singleton");
  sphere_list *sl2 = sl_singleton(sphere_dup(s1));
  sl_print(sl2);
  sphere_list *sl3 = sl_cons(sphere_dup(s2), sl_singleton(sphere_dup(s1)));
  sl_print(sl3);

  printf("%s\n", "testing sl_dup");
  sphere_list *sl4 = sl_dup(sl);
  sl_print(sl4);


  printf("%s\n", "FOR VALGRIND TESTING");
  sl_free(sl);
  sl_free(sl2);
  sl_free(sl3);
  sl_free(sl4);
}
Esempio n. 2
0
int main()
{
	srand((int)time(NULL)); 
	skiplist* S = (skiplist*)malloc(sizeof(skiplist));
	node nodes[2] = {
		{-1, &nodes[1], NULL},
		{1000000, NULL, NULL}
	};
	S->top = &nodes[0];

	int i;
	printf("Start...\n");
	scanf("%d", &i);
	while (i != -1) {
		if (i == -2) {
			sl_print(S);
		} else {
			sl_insert(S, i);
		}
		scanf("%d", &i);
	}
	delete(S);
	printf("End of program!\n");
	return 0;
}
Esempio n. 3
0
void scene_print(scene *s)
{
    printf("\n\tScene\n");
    printf("Background color:\n");
    rgb_print(s->bg);
    sl_print(s->spheres);
    light_print(s->light);
    rgb_print(s->amb);
}