Hash :
6da4c4d7
Author :
Thomas de Grivel
Date :
2025-07-15T23:42:41
fix: tag_init_copy PVAR handling and missing include - Follow bound PVAR to actual tag in tag_init_copy - Add missing sym.h include in bool_test.c
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
/* kc3
* Copyright from 2022 to 2025 kmx.io <contact@kmx.io>
*
* Permission is hereby granted to use this software granted the above
* copyright notice and this permission paragraph are included in all
* copies and substantial portions of this software.
*
* THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
* PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
* AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
* THIS SOFTWARE.
*/
#include <string.h>
#include "../libkc3/bool.h"
#include "../libkc3/str.h"
#include "../libkc3/sym.h"
#include "test.h"
void bool_test (void);
TEST_CASE_PROTOTYPE(bool_compat);
TEST_CASE_PROTOTYPE(bool_init_cast_pstruct);
void bool_test (void)
{
TEST_CASE_RUN(bool_compat);
TEST_CASE_RUN(bool_init_cast_pstruct);
}
TEST_CASE(bool_compat)
{
TEST_EQ(true, 1);
TEST_EQ(false, 0);
TEST_ASSERT(true);
TEST_ASSERT(! false);
TEST_ASSERT((bool) true);
TEST_ASSERT(! (bool) false);
}
TEST_CASE_END(bool_compat)
TEST_CASE(bool_init_cast_pstruct)
{
bool b;
s_tag pstruct_tag = {0};
const s_sym *bool_type = &g_sym_Bool;
pstruct_tag.type = TAG_PSTRUCT;
pstruct_tag.data.pstruct = NULL; // Minimal pstruct for testing
TEST_ASSERT(bool_init_cast(&b, &bool_type, &pstruct_tag));
TEST_EQ(b, true);
}
TEST_CASE_END(bool_init_cast_pstruct)