static void test_variables( libvlc_instance_t *p_vlc ) { libvlc_int_t *p_libvlc = p_vlc->p_libvlc_int; srand( time( NULL ) ); log( "Testing for integers\n" ); test_integer( p_libvlc ); log( "Testing for booleans\n" ); test_booleans( p_libvlc ); log( "Testing for floats\n" ); test_floats( p_libvlc ); log( "Testing for strings\n" ); test_strings( p_libvlc ); log( "Testing for addresses\n" ); test_address( p_libvlc ); log( "Testing the callbacks\n" ); test_callbacks( p_libvlc ); log( "Testing the limits\n" ); test_limits( p_libvlc ); log( "Testing choices\n" ); test_choices( p_libvlc ); log( "Testing var_Change()\n" ); test_change( p_libvlc ); log( "Testing type at creation\n" ); test_creation_and_type( p_libvlc ); }
int main(int argc, char *argv[]) { bool suc = true; suc &= test_avltree(); suc &= test_integer(); return suc ? 0 : 1; }
int main(int argc, char **argv) { int ret = 0; ret += test_integer (); ret += test_integer_more(); ret += test_unsigned (); ret += test_octet_string (); ret += test_general_string (); ret += test_generalized_time (); return ret; }
int main() { test_symbol(); test_integer(); test_cell(); test_list(); test_environment(); test_eval(); test_plus_integer(); test_begin(); test_string(); test_tokenize(); test_newlispobj(); test_expandreadmacro(); test_read_tokens(); test_macro(); test_equal(); test_cond(); return 0; }
int main (int , char **) { test_vector (); test_map (); test_integer_vector (); test_double_vector (); test_string_vector (); test_integer (); test_double (); test_map_exchanges (); test_vector_exchanges (); test_native_vectors (); test_queue (); test_vector_transfer (); test_flex_map (); test_collection (); return 0; }
int main(int argc, char **argv) { int ret = 0; ret += test_integer (); ret += test_integer_more(); ret += test_unsigned (); ret += test_octet_string (); ret += test_bmp_string (); ret += test_universal_string (); ret += test_general_string (); ret += test_generalized_time (); ret += test_oid (); ret += test_bit_string(); ret += test_heim_integer(); ret += test_boolean(); ret += check_fail_unsigned(); ret += check_fail_integer(); ret += check_fail_length(); ret += check_fail_boolean(); ret += check_fail_general_string(); ret += check_fail_bmp_string(); ret += check_fail_universal_string(); ret += check_fail_heim_integer(); ret += check_fail_generalized_time(); ret += check_fail_oid(); ret += check_fail_bitstring(); ret += test_heim_int_format(); ret += test_heim_oid_format(); ret += check_trailing_nul(); ret += test_misc_cmp(); ret += corner_generalized_time(); ret += corner_tag(); return ret; }
struct Symbol* postfix_expression(struct PostfixExpression* node, struct Symbol** orig_symbol) { struct Symbol* symbol, *ref, *newSymbol = 0, *symbol1; switch (node->type) { case 0: return primary_expression(node->primaryExpression, orig_symbol); case 1: symbol = load_symbol(postfix_expression(node->postfixExpression, orig_symbol)); test_referenceable(symbol); ref = load_symbol(expression_func(node->expression)); *orig_symbol = new_symbol("", symbol->storage, 0, symbol->specifier, symbol->stars - 1, 0, 0); if (symbol->stars == 1) (*orig_symbol)->specifier = 32; ADDSTRING(" "); code_gen_symbol('%', *orig_symbol); ADDSTRING(" = getelementptr inbounds "); code_gen_type_specifier(symbol->specifier, 0, symbol->length, symbol->stars); ADDSTRING(" "); if (symbol->depth == 0) code_gen_symbol('@', symbol); else code_gen_symbol('%', symbol); if (symbol->length) ADDSTRING(", i32 0"); ADDSTRING(", "); test_integer(ref); code_gen_type_specifier(ref->specifier, 0, 0, 0); ADDSTRING(" "); code_gen_symbol('%', ref); ADDSTRING("\n"); ADDSTRING(" "); newSymbol = new_symbol("", 0, 2, symbol->specifier, symbol->stars - 1, 0, 0); newSymbol->reference = *orig_symbol; code_gen_symbol('%', newSymbol); ADDSTRING(" = load "); code_gen_type_specifier(symbol->specifier, 0, (*orig_symbol)->length, symbol->stars); ADDSTRING(" "); code_gen_symbol('%', *orig_symbol); ADDSTRING(", align "); if (newSymbol->stars) { if (PTR_LENGTH == 8) { ADDSTRING("8\n"); } else { ADDSTRING("4\n"); } } else { int len = len_gen_type_specifier(newSymbol->specifier); sprintf(buf, "%d\n", len); ADDSTRING(buf); } return newSymbol; case 2: case 3: symbol = postfix_expression(node->postfixExpression, orig_symbol); test_functionable(symbol); if (node->type == 3) { argument_expression_list(node->argumentExpressionList, symbol->parameterlist); } if (!(symbol->specifier & 0x02)) { newSymbol = new_symbol("", symbol->storage, 2, symbol->specifier, symbol->stars, 0, symbol->length); ADDSTRING(" "); code_gen_symbol('%', newSymbol); ADDSTRING(" = call "); } else { ADDSTRING(" call "); newSymbol = symbol; } if (strcmp(symbol->name, "free") != 0) { code_gen_type_specifier(symbol->specifier, 0, symbol->length, symbol->stars); ADDSTRING(" "); if (strcmp(symbol->name, "printf") == 0 || strcmp(symbol->name, "scanf") == 0) { ADDSTRING("(i8*, ...)* "); } code_gen_symbol('@', symbol); } else { ADDSTRING("i32 ("); code_gen_type_specifier(symbol_arg[0]->specifier, 0, 0, symbol_arg[0]->stars); ADDSTRING(", ...)* bitcast (i32 (...)* @free to i32 ("); code_gen_type_specifier(symbol_arg[0]->specifier, 0, 0, symbol_arg[0]->stars); ADDSTRING(", ...)*)"); } ADDSTRING("("); if (node->type == 3) { pop_arg(); } ADDSTRING(")\n"); *orig_symbol = newSymbol; return newSymbol; case 4: case 5: // to do: struct return 0; case 6: case 7: symbol = load_symbol(postfix_expression(node->postfixExpression, orig_symbol)); test_changeable(*orig_symbol); symbol1 = new_symbol("", symbol->storage, 2, symbol->specifier, symbol->stars, 0, symbol->length); ADDSTRING(" "); code_gen_symbol('%', symbol1); ADDSTRING(" = "); if ((symbol->specifier & (3 << 6)) > 0) { ADDSTRING("f"); } if (node->type == 6) { ADDSTRING("add "); } else { ADDSTRING("sub "); } code_gen_type_specifier(symbol->specifier,1,symbol->length, symbol->stars); ADDSTRING(" "); code_gen_symbol('%', symbol); ADDSTRING(", "); if ((symbol->specifier & (3 << 6)) > 0) { ADDSTRING("1.000000e+00\n"); } else { ADDSTRING("1\n"); } ADDSTRING(" store "); code_gen_type_specifier(symbol->specifier,0,symbol->length, symbol->stars); ADDSTRING(" "); code_gen_symbol('%', symbol1); ADDSTRING(", "); code_gen_type_specifier(symbol->specifier,0,symbol->length, symbol->stars); ADDSTRING("* "); code_gen_symbol('%', *orig_symbol); ADDSTRING(", align "); int l = len_gen_type_specifier(symbol->specifier); sprintf(buf, "%d", l); ADDSTRING(buf); ADDSTRING("\n"); return symbol; default: return 0; } }
struct Symbol* unary_expression(struct UnaryExpression* node, struct Symbol** orig_symbol) { int len; struct Symbol *symbol, *symbol1 = NULL; switch (node->type) { case 0: return postfix_expression(node->postfixExpression, orig_symbol); case 1: case 2: symbol = load_symbol(unary_expression(node->unaryExpression, orig_symbol)); test_changeable(*orig_symbol); if (node->type == 2) symbol1 = test_calculable(symbol, '-'); else symbol1 = test_calculable(symbol, '+'); if (symbol1) return symbol1; ADDSTRING(" "); symbol1 = new_symbol("", symbol->storage, symbol->qualifier, symbol->specifier, symbol->stars - 1, 0, symbol->length); code_gen_symbol('%', symbol1); ADDSTRING(" = "); if ((symbol->specifier & (3 << 6)) > 0) { ADDSTRING("f"); } if (node->type == 1) { ADDSTRING("add "); } else { ADDSTRING("sub "); } code_gen_type_specifier(symbol->specifier,1,symbol->length, symbol->stars); ADDSTRING(" "); code_gen_symbol('%', symbol); ADDSTRING(", "); if ((symbol->specifier & (3 << 6)) > 0) { ADDSTRING("1.000000e+00\n"); } else { ADDSTRING("1\n"); } ADDSTRING(" store "); code_gen_type_specifier(symbol->specifier,0,symbol->length, symbol->stars); ADDSTRING(" "); code_gen_symbol('%', symbol1); ADDSTRING(", "); code_gen_type_specifier(symbol->specifier,0,symbol->length, symbol->stars); ADDSTRING("* "); code_gen_symbol('%', *orig_symbol); ADDSTRING(", align "); int l = len_gen_type_specifier(symbol->specifier); sprintf(buf, "%d", l); ADDSTRING(buf); ADDSTRING("\n"); *orig_symbol = 0; break; case 3: symbol = cast_expression(node->castExpression); switch (node->unaryOperator) { case 1: test_pointable(symbol); symbol = symbol->reference; *orig_symbol = 0; symbol1 = new_symbol("", symbol->storage, 2, symbol->specifier, symbol->stars + 1, 0, symbol->length); ADDSTRING(" "); code_gen_symbol('%', symbol1); ADDSTRING(" = getelementptr inbounds "); code_gen_type_specifier(symbol->specifier, 0, symbol->length, symbol1->stars); ADDSTRING(" "); code_gen_symbol('%', symbol); ADDSTRING(", "); ADDSTRING(PTR_LEN_TYPE); ADDSTRING(" 0\n"); break; case 2: test_referenceable(symbol); symbol = load_symbol(symbol); symbol1 = new_symbol("", symbol->storage, 0, symbol->specifier, symbol->stars - 1, 0, symbol->length); *orig_symbol = symbol1; if (symbol1->stars == 0) symbol1->specifier = 32; symbol1->reference = symbol; ADDSTRING(" "); code_gen_symbol('%', symbol1); ADDSTRING(" = load "); code_gen_type_specifier(symbol->specifier, 0, symbol->length, symbol->stars); ADDSTRING(" "); code_gen_symbol('%', symbol); ADDSTRING(" "); code_gen_symbol('%', symbol); ADDSTRING(", align 8\n"); break; case 3: test_regular(symbol); symbol1 = symbol; *orig_symbol = 0; break; case 4: test_regular(symbol); symbol = load_symbol(symbol); symbol1 = test_calculable(symbol, 'n'); if (symbol1) { return symbol1; } symbol1 = new_symbol("", symbol->storage, 2, symbol->specifier, symbol->stars, 0, 0); *orig_symbol = symbol; ADDSTRING(" "); code_gen_symbol('%', symbol1); if ((symbol->specifier & (3 << 6)) != 0) { ADDSTRING(" = f"); } else { ADDSTRING(" = "); } ADDSTRING("sub "); code_gen_type_specifier(symbol->specifier,1, symbol->length, symbol->stars); ADDSTRING(" "); if ((symbol->specifier & (3 << 6)) != 0) { ADDSTRING("0.000000e+00"); } else { ADDSTRING("0"); } ADDSTRING(", "); code_gen_symbol('%', symbol); ADDSTRING("\n"); *orig_symbol = 0; break; case 5: test_integer(symbol); symbol = load_symbol(symbol); symbol1 = test_calculable(symbol, '~'); if (symbol1) { return symbol1; } *orig_symbol = 0; symbol = cast_symbol(symbol, 16, 0); symbol1 = new_symbol("", symbol->storage, symbol->qualifier, symbol->specifier, symbol->stars, 0, symbol->length); ADDSTRING(" "); code_gen_symbol('%', symbol1); ADDSTRING(" = xor "); code_gen_type_specifier(symbol->specifier,0, symbol->length, symbol->stars); ADDSTRING(" "); code_gen_symbol('%', symbol); ADDSTRING(", -1"); ADDSTRING("\n"); break; case 6: *orig_symbol = 0; symbol1 = test_calculable(symbol, '!'); symbol = load_symbol(symbol); if (symbol1) { return symbol1; } symbol1 = new_symbol("0", 0, 2, 16, 0, 2, 0); symbol1 = equality_symbol(symbol, symbol1, 2, 1); break; default: break; } break; case 4: *orig_symbol = 0; symbol = unary_expression(node->unaryExpression, orig_symbol); if (symbol->stars > (symbol->length > 0)) len = PTR_LENGTH; else { len = len_gen_type_specifier(symbol->specifier); if (symbol->length) len *= symbol->length; } sprintf(buf, "%d", len); symbol1 = new_symbol(buf, 0, 2, 4, 0, 2, 0); break; case 5: *orig_symbol = 0; len = len_gen_type_name(node->typeName); sprintf(buf, "%d", len); symbol1 = new_symbol(buf, 0, 2, 4, 0, 2, 0); break; default: break; } return symbol1; }
void test_all_integer() { test_integer(nan, nan, "nan"); test_integer(nannan, nan, "nannan"); test_integer(zero, zero, "zero"); test_integer(zip, zero, "zero"); test_integer(minnum, zero, "minnum"); test_integer(epsilon, zero, "epsilon"); test_integer(cent, zero, "cent"); test_integer(half, zero, "half"); test_integer(one, one, "one"); test_integer(negative_one, negative_one, "negative_one"); test_integer(dec64_new(20000000000000000, -16), two, "two"); test_integer(e, two, "e"); test_integer(pi, three, "pi"); test_integer(negative_pi, dec64_new(-4, 0), "-pi"); test_integer(maxint, maxint, "maxint"); test_integer(maxnum, maxnum, "maxnum"); test_integer(negative_maxint, negative_maxint, "negative_maxint"); test_integer(dec64_new(-12500000000000000, -16), dec64_new(-2, 0), "-1.25"); test_integer(dec64_new(-1500000000000000, -15), dec64_new(-2, 0), "-1.5"); test_integer(dec64_new(-1560000000000000, -15), dec64_new(-2, 0), "-1.56"); test_integer(dec64_new(11111111111111111, -17), zero, "0.1..."); test_integer(dec64_new(22222222222222222, -17), zero, "0.2..."); test_integer(dec64_new(33333333333333333, -17), zero, "0.3..."); test_integer(dec64_new(4444444444444444, -16), zero, "0.4..."); test_integer(dec64_new(5555555555555556, -16), zero, "0.5..."); test_integer(dec64_new(6666666666666667, -16), zero, "0.6..."); test_integer(dec64_new(7777777777777778, -16), zero, "0.7..."); test_integer(dec64_new(8888888888888889, -16), zero, "0.8..."); test_integer(dec64_new(10000000000000000, -16), one, "1"); test_integer(dec64_new(-11111111111111111, -17), negative_one, "-0.1..."); test_integer(dec64_new(-22222222222222222, -17), negative_one, "-0.2..."); test_integer(dec64_new(-33333333333333333, -17), negative_one, "-0.3..."); test_integer(dec64_new(-4444444444444444, -16), negative_one, "-0.4..."); test_integer(dec64_new(-5555555555555556, -16), negative_one, "-0.5..."); test_integer(dec64_new(-6666666666666667, -16), negative_one, "-0.6..."); test_integer(dec64_new(-7777777777777778, -16), negative_one, "-0.7..."); test_integer(dec64_new(-8888888888888889, -16), negative_one, "-0.8..."); test_integer(dec64_new(-10000000000000000, -16), negative_one, "-0.9..."); test_integer(dec64_new(449, -2), four, "4.49"); test_integer(dec64_new(-449, -2), dec64_new(-5, 0), "-4.49"); test_integer(dec64_new(450, -2), four, "4.50"); test_integer(dec64_new(-450, -2), dec64_new(-5, 0), "-4.50"); }