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/alloc.h"
18 * Tests referencing a non-weak pointer.
22 SJME_TEST_DECLARE(testAllocWeakRefNonWeak
)
30 if (sjme_error_is(sjme_alloc(test
->pool
, 512, &p
)) || p
== NULL
)
31 return sjme_unit_fail(test
, "Could not allocate block?");
33 /* Create weak reference, fails because not weak. */
35 error
= sjme_alloc_weakRefE(p
, &weak
,
38 /* Test conditions. */
39 sjme_unit_equalP(test
, weak
, NULL
,
40 "A weak pointer was allocated?");
41 sjme_unit_equalI(test
, error
, SJME_ERROR_NOT_WEAK_REFERENCE
,
42 "Incorrect error was set?");
45 return SJME_TEST_RESULT_PASS
;