Code Monkey home page Code Monkey logo

ocaml's Introduction

OCaml Image

Container image for OCaml used by CodeRunner.

Usage

W=/workspace
# Create container
BUILD="ocamlbuild -quiet -use-ocamlfind cwtest.native"
C=$(docker container create --rm -w $W ghcr.io/codewars/ocaml:latest sh -c "$BUILD && exec ./cwtest.native")

# Copy solution and test files
docker container cp ${1:-examples/basic}/. $C:$W

# Start
docker container start --attach $C

Building

docker build -t ghcr.io/codewars/ocaml:latest .

ocaml's People

Contributors

hobovsky avatar kazk avatar monadius avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

monadius hobovsky

ocaml's Issues

Print messages for skipped tests

Currently, skipped tests are completely ignored. A message for skipped tests should be printed.

This kata skips one test conditionally but a message is not printed when the test is skipped.

Do not concatenate solution, preloaded, and test code

It should be possible to have 3 separate files: preloaded.ml, solution.ml, and tests.ml. It will be necessary to manually import preloaded code with open Preloaded (or using the Preloaded. prefix) and solution with open Solution. But all line numbers in error and warning messages will be correct for both user code and tests.

Improvement: add support for nested labels

After #2 gets improved or merged, the event listener could be extended with support for nested TestLabel tests (not to be confused with nested test groups):

"Nested labels" >::: [
          "Outer label" >: ("Inner label" >: ("Tests with nested labels" >::: [
            TestCase (fun _ -> assert_equal false (is_even 100) ~msg:"Incorrect answer for n=100" ~printer: string_of_bool);
            TestCase (fun _ -> assert_equal false (is_even 100) ~msg:"Incorrect answer for n=100" ~printer: string_of_bool);          
            
          ]))
        ]

Such construct should not be too common, nonetheless OUnit supports it, it should not be difficult to support it in the listener, and currently the listener omits outer labels and displays only the innermost one.

Gc.full_major is invoked after each test

The new OUnit test framework invokes Gc.full_major () after each test when the function OUnit.perform_test is used to call tests (see this line of OUnitRunner and this line of OUnit where conf is created). This negatively impacts performance if huge data structures are created outside of test functions (see this kata: https://www.codewars.com/kata/60cc93db4ab0ae0026761232/ocaml).

It is possible to turn off the garbage collection step by setting the property OUnitRunner.run_gc_full_major to false. But I don't see any way to change the default configuration when OUnit.perform_test is used. It seems to be necessary to call OUnitCore.perform_test directly with an appropriate configuration.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.