예제 #1
0
파일: main.cpp 프로젝트: whunmr/circa
int main(int argc, char** argv)
{
    block_test::register_tests();
    building_test::register_tests();
    c_objects_test::register_tests();
    code_iterator_test::register_tests();
    compound_type_test::register_tests();
    control_flow_test::register_tests();
    fakefs::register_tests();
    file::register_tests();
    file_watch::register_tests();
    handle::register_tests();
    importing::register_tests();
    interpreter::register_tests();
    migration::register_tests();
    modules::register_tests();
    names::register_tests();
    native_patch_test::register_tests();
    parser_test::register_tests();
    path_expression_tests::register_tests();
    stateful_code_test::register_tests();
    string_tests::register_tests();
    symbol_test::register_tests();
    tokenizer::register_tests();

    caWorld* world = circa_initialize();

    run_all_tests();

    circa_shutdown(world);
}
예제 #2
0
int main(int argc, char** argv)
{
    caWorld* world = circa_initialize();

    circa_load_module_from_file(world, "ClassA", "ClassA.ca");

    // circa_dump_b(circa_kernel(world));

    caStack* stack = circa_alloc_stack(world);

    circa_push_function_by_name(stack, "create_ClassA");
    circa_run(stack);

    if (circa_has_error(stack))
        circa_print_error_to_stdout(stack);

    caValue* classA = circa_alloc_value();
    circa_move(circa_output(stack, 0), classA);
    circa_pop(stack);

    // Dump to stdout
    circa_push_function_by_name(stack, "ClassA.dump");
    circa_copy(classA, circa_input(stack, 0));
    circa_run(stack);
    if (circa_has_error(stack))
        circa_print_error_to_stdout(stack);
    circa_pop(stack);

    for (int i=0; i < 5; i++) {
        // Increment
        circa_push_function_by_name(stack, "ClassA.increment");
        circa_copy(classA, circa_input(stack, 0));
        circa_run(stack);
        if (circa_has_error(stack))
            circa_print_error_to_stdout(stack);

        // Using index #1 not 0:
        circa_move(circa_output(stack, 1), classA);
        circa_pop(stack);

        // And dump
        circa_push_function_by_name(stack, "ClassA.dump");
        circa_copy(classA, circa_input(stack, 0));
        circa_run(stack);
        if (circa_has_error(stack))
            circa_print_error_to_stdout(stack);
        circa_pop(stack);
    }

    circa_dealloc_value(classA);
    circa_dealloc_stack(stack);
    circa_shutdown(world);
}
예제 #3
0
int main(int argc, const char * args[])
{
    caWorld* world = circa_initialize();
    
#if CIRCA_USE_LIBUV
    // Install extensions.
    libuv_native_patch(world);
#endif

    circa_use_local_filesystem(world, "");

    int result = 0;

    result = run_command_line(world, argc, args);

    circa_shutdown(world);
    return result;
}
예제 #4
0
int main(int argc, char** argv)
{
    const int iteratations = 100;

    caWorld* world = circa_initialize();
    caStack* stack = circa_alloc_stack(world);

    // Write initial version
    write_script_to_file(0);

    caBranch* module = circa_load_module_from_file(world, "file_to_reload", "file_to_reload.ca");

    int currentKey = 0;

    for (int i=0; i < iteratations; i++) {

        // Update file on every other iteration
        if ((i % 2) == 1) {
            printf("writing to file: %d\n", i);
            currentKey = i;
            write_script_to_file(i);
            sleep(2);
        }

        circa_refresh_module(module);

        circa_push_function_by_name(stack, "f");
        circa_run(stack);
        if (circa_has_error(stack)) {
            circa_print_error_to_stdout(stack);
            break;
        }

        int readValue = circa_int(circa_output(stack, 0));

        if (currentKey != readValue) {
            printf("Failed, currentKey (%d) != readValue (%d)\n", currentKey, readValue);
            break;
        }
        circa_pop(stack);
    }

    circa_shutdown(world);
}
예제 #5
0
int main(int argc, char** argv)
{
    caWorld* world = circa_initialize();

    circa_add_module_search_path(world, "tests/embed");

    int iteration = 0;

    while (true) {

        caValue* value = circa_alloc_value();
        circa_set_int(value, iteration);

        circa_actor_run_message(world, "TestA", value);
        sleep(1);
        iteration++;
    }

    circa_shutdown(world);
}
예제 #6
0
파일: main.cpp 프로젝트: andyfischer/circa
int main(int argc, char** argv)
{
    hashtable_test::register_tests();

    bytecode_test::register_tests();

#if 0
    block_test::register_tests();
    building_test::register_tests();
    code_iterator_test::register_tests();
    control_flow_test::register_tests();
    compound_type_test::register_tests();
    fakefs_test::register_tests();
    file_test::register_tests();
    file_watch_test::register_tests();
    function_test::register_tests();
    if_block_test::register_tests();
    list_test::register_tests();
    loop_test::register_tests();
    migration_test::register_tests();
    modules_test::register_tests();
    names_test::register_tests();
    native_patch_test::register_tests();
    parser_test::register_tests();
    path_expression_test::register_tests();
    stack_test::register_tests();
    symbol_test::register_tests();
    tagged_value_test::register_tests();
    string_test::register_tests();
    tokenizer_test::register_tests();
    type_test::register_tests();
#endif

    caWorld* world = circa_initialize();

    run_all_tests();

    circa_shutdown(world);
}