3 * Copyright (c) 2012-2016 Nest Labs, Inc.
6 * This document is the property of Nest. It is considered
7 * confidential and proprietary information.
9 * This document may not be reproduced or transmitted in any form,
10 * in whole or in part, without the express written permission of
17 * This file implements a unit test suite for the Nest Labs
18 * compile-time assertion library.
24 #include "nlassert-test-config.h"
26 #define NL_ASSERT_PRODUCTION (NL_ASSERT_TEST_WANT_PRODUCTION)
30 #include <nlunit-test.h>
32 #if NL_ASSERT_TEST_WANT_STATIC_SUCCESS
33 #define _TEST_STATIC_OP ==
35 #define _TEST_STATIC_OP !=
36 #endif /* NL_ASSERT_TEST_WANT_STATIC_SUCCESS */
39 * Test static, compile-time assertions outside of function bodies.
43 nlSTATIC_ASSERT(sizeof(test) _TEST_STATIC_OP 4);
45 nlSTATIC_ASSERT_PRINT(sizeof(test) _TEST_STATIC_OP 4, "nlASSERT_PRINT_STATIC Failed");
48 * Test static, compile-time assertions within a function body.
50 static void TestStatic(nlTestSuite *inSuite, void *inContext)
52 nlSTATIC_ASSERT(sizeof(test) _TEST_STATIC_OP 4);
54 nlSTATIC_ASSERT_PRINT(sizeof(test) _TEST_STATIC_OP 4, "nlASSERT_PRINT_STATIC Failed");
57 static const nlTest sTests[] = {
58 NL_TEST_DEF("static", TestStatic),
64 nlTestSuite theSuite = {
71 nlTestSetOutputStyle(OUTPUT_CSV);
73 nlTestRunner(&theSuite, NULL);
75 return nlTestRunnerStats(&theSuite);