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 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
;
24 * Tests second set of enqueue.
28 SJME_TEST_DECLARE(testAllocWeakEnqueueSetSecond
)
31 sjme_alloc_weak weakB
;
34 /* Allocate weak reference. */
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. */
49 if (sjme_error_is(sjme_alloc_weakRefE(p
, &weakB
,
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?");
60 return SJME_TEST_RESULT_PASS
;