Compile fixes.
[SquirrelJME.git] / nanocoat / tests / testAllocWeakEnqueueSetSecond.c
blob4b132069abeebb314669c405d0158436d2a8783e
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 static sjme_errorCode testEnqueue(
16 sjme_attrInNotNull sjme_alloc_weak weak,
17 sjme_attrInNullable sjme_pointer data,
18 sjme_attrInValue sjme_jboolean isBlockFree)
20 return SJME_ERROR_NONE;
23 /**
24 * Tests second set of enqueue.
26 * @since 2024/07/08
28 SJME_TEST_DECLARE(testAllocWeakEnqueueSetSecond)
30 sjme_alloc_weak weak;
31 sjme_alloc_weak weakB;
32 void* p;
34 /* Allocate weak reference. */
35 p = NULL;
36 weak = NULL;
37 if (sjme_error_is(sjme_alloc_weakNew(test->pool, 512,
38 NULL, NULL, &p, &weak)))
39 return sjme_unit_fail(test, "Failed to allocate weak?");
41 /* The enqueues should be set. */
42 sjme_unit_equalP(test, weak->enqueue, NULL,
43 "Enqueue function was set?");
44 sjme_unit_equalP(test, weak->enqueueData, NULL,
45 "Enqueue data was was set?");
47 /* Add enqueue and data in. */
48 weakB = NULL;
49 if (sjme_error_is(sjme_alloc_weakRefE(p, &weakB,
50 testEnqueue, test)))
51 return sjme_unit_fail(test, "Weak ref failed?");
53 /* The enqueues should be set. */
54 sjme_unit_equalP(test, weak->enqueue, testEnqueue,
55 "Enqueue function not set?");
56 sjme_unit_equalP(test, weak->enqueueData, test,
57 "Enqueue data was not set?");
59 /* Success! */
60 return SJME_TEST_RESULT_PASS;