1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
#include "salad/rope.h"
#include "unit.h"
#include "rope_common.h"
/******************************************************************/
static void
test_avl_rotations()
{
header();
struct rope *rope = test_rope_new();
/* counterclockwise single rotation. */
test_rope_insert(rope, 0, "1");
test_rope_insert(rope, 1, "2");
test_rope_insert(rope, 2, "<");
/* clockwise single rotation */
test_rope_insert(rope, 0, "0");
test_rope_insert(rope, 0, ">");
/* counterclockwise double rotation */
test_rope_insert(rope, 1, "*");
/* clocckwise double rotation */
test_rope_insert(rope, 3, "p");
test_rope_insert(rope, 3, "p");
test_rope_insert(rope, 3, "p");
test_rope_insert(rope, 3, "p");
test_rope_insert(rope, 3, "*");
rope_delete(rope);
footer();
}
int
main()
{
test_avl_rotations();
return 0;
}
|