Compile fixes.
[SquirrelJME.git] / nanocoat / tests / testTraverseRemoveEmpty.c
blobf38c99e1f91112c4ae91f115d3c8f36109a6e079
1 /* -*- Mode: C; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
3 // SquirrelJME
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 // -------------------------------------------------------------------------*/
10 #include "test.h"
11 #include "proto.h"
12 #include "mock.h"
13 #include "unit.h"
15 #include "sjme/traverse.h"
16 #include "testTraverse.h"
18 /**
19 * Tests removal of something from an empty traversal tree.
21 * @since 2024/09/01
23 SJME_TEST_DECLARE(testTraverseRemoveEmpty)
25 sjme_traverse_test_data traverse;
26 sjme_jint i;
28 /* Setup traverse. */
29 traverse = NULL;
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),
39 i, i);
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?");
49 /* Success! */
50 return SJME_TEST_RESULT_PASS;