Coder Social home page Coder Social logo

erlang-tests-generator's Introduction

testgen

A generator for the exercises testsuite

Build

$ make testgen

Run

$ make

Implement a Testgenerator

  1. Create a module that is named as the exercise, but prefixed with tgen_.
  2. Make it implement the tgen behaviour.

Callbacks

tgen:revision/0

Spec: () -> pos_integer()

When you initially create the module make this return 1, after that every PullRequest changing the module shall also increment the number by 1.

It is the monotonically increasing version of this module.

tgen:generate_test/2

Spec: (non_neg_integer(), exercise_json()) -> {ok, erl_syntax:syntax_tree() | [erl_syntax:syntax_tree()], [{string() | binary(), non_neg_integer()}]} } | ignore

The first argument, usually called N has to be considered opaque, it has to be passed to tgen:to_test_name/2 as first argument to generate the testname.

The second argument is the current JSON blob. Please refer to the actual JSON specification of the exercise.

tgen:prepare_test_module/0 (Optional)

Spec: prepare_test_module() -> {ok, [erl_syntax:syntax_tree()]}

Can inject arbitrary code into the test module, eg. helper functions, macros, etc.

tgen:prepare_tests/1 (Optional)

Spec: prepare_tests([exercise_json()]) -> [exercise_json()]

This callback is called with a list of the JSON as it got parsed, it can be used to enrich the JSON with additional data or to filter some tests out, or even to change order of tests.

erlang-tests-generator's People

Contributors

ihid avatar nobbz avatar rlebedys avatar wojtii avatar

Watchers

 avatar

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.