Exemplo n.º 1
0
    test_assign_ref_to_bool_obj this)
{
    bool *foo = corto_create(NULL, NULL, corto_bool_o);
    test_assert(foo != NULL);

    test_reftype bar = corto_create(NULL, NULL, test_reftype_o);
    test_assert(bar != NULL);

    corto_value left = corto_value_object(foo, NULL);
    corto_value right = corto_value_object(bar, NULL);
    corto_value result = corto_value_init();

    left.ref_kind = CORTO_BY_REFERENCE;
    right.ref_kind = CORTO_BY_REFERENCE;

    int16_t ret = corto_value_binaryOp(CORTO_ASSIGN, &left, &right, &result);

    test_assert(ret != 0);
    test_assert(ut_catch() != 0);

    test_assert(*foo == false);

    test_assert(corto_delete(foo) == 0);
    test_assert(corto_delete(bar) == 0);
}


void test_assign_ref_to_bool_obj_tc_byref_fromobj_bytype(
    test_assign_ref_to_bool_obj this)
{
    bool *foo = corto_create(NULL, NULL, corto_bool_o);
Exemplo n.º 2
0
/* This is a managed file. Do not delete this comment. */

#include <include/test.h>

void test_ValueExpr_tc_add(
    test_ValueExpr this)
{
    corto_value left = corto_value_int(10);
    corto_value right = corto_value_int(20);
    corto_value out = corto_value_value(NULL, NULL);

    corto_int16 ret = corto_value_binaryOp(CORTO_ADD, &left, &right, &out);
    test_assert(ret == 0);
    test_assert(out.kind == CORTO_VALUE);

    corto_type type = corto_value_typeof(&out);
    test_assert(type != NULL);
    test_assert(type == corto_type(corto_int64_o));

    corto_int64 *ptr = corto_value_ptrof(&out);
    test_assert(ptr != NULL);
    test_assertint(*ptr, 30);

    corto_value_free(&out);

}

void test_ValueExpr_tc_and(
    test_ValueExpr this)
{
    corto_value left = corto_value_int(12);