1 /* -*- Mode: C; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the Mozilla Public License Version 2.0.
7 // See license.mkd for licensing and copyright information.
8 // -------------------------------------------------------------------------*/
15 #include "sjme/traverse.h"
16 #include "testTraverse.h"
19 * Tests removal of something from an empty traversal tree.
23 SJME_TEST_DECLARE(testTraverseRemoveEmpty
)
25 sjme_traverse_test_data traverse
;
30 if (sjme_error_is(test
->error
= sjme_traverse_new(test
->pool
,
31 &traverse
, MAX_ELEMENTS
, test_data
, 0)) || traverse
== NULL
)
32 return sjme_unit_fail(test
, "Could not create traverse?");
34 /* Constantly try to remove. */
35 for (i
= 1; i
<= 32; i
++)
37 test
->error
= sjme_traverse_remove(
38 SJME_AS_TRAVERSE(traverse
),
40 sjme_unit_equalI(test
, test
->error
, SJME_ERROR_NO_SUCH_ELEMENT
,
41 "Element was found in the tree?");
44 /* Destroy traverse. */
45 if (sjme_error_is(test
->error
= sjme_traverse_destroy(
46 SJME_AS_TRAVERSE(traverse
))))
47 return sjme_unit_fail(test
, "Could not destroy traverse?");
50 return SJME_TEST_RESULT_PASS
;