Code Monkey home page Code Monkey logo

ctest's Issues

Implement assertions

The following assertions should be implemented in assertions.h:

  • equality of integer values (ASSERT_EQ)
  • not equal for integer values (ASSERT_NE)
  • less than for integer values (ASSERT_LT)
  • greater than for integer values (ASSERT_GT)
  • less than or equal for integer values (ASSERT_LTE)
  • greater than or equal for integer values (ASSERT_GTE)
  • is 0 or was successful (ASSERT_ZERO, ASSERT_SUCCESS); the successful status comes from the philosophy of Unix syscalls which return 0 on success
  • string relations (ASSERT_STRCMP(a, b, expected_relation))
  • equality for floating point values (ASSERT_FLOAT_EQ)

Allow parsing command line arguments for running custom sets of tests

The library should provide a main function for the test executables.

The program should accept the following command line arguments:

  • --all or -a to run all the registered tests
  • --suite <suite_name> or -s <suite_name> to run all the tests registered within the given suite_name
  • --failed to skip running the tests that failed on the last run

Assertions should be evaluated immediately, not postponed until test execution ends

Failed assertions should leave the test in a FAILED state and should not allow the execution to continue.

Required changes:

The test function should receive an assertion_runner_fn instead of an assertion_container. This will not only help in the above mentioned problem, but also eliminate the limitation created by MAX_ASSERTIONS_PER_TEST definition.

The assertion_runner_fn should be defined as follows:

typedef int (*assertion_runner_fn)(struct assertion *);

This function should return 0 when the assertion successes and 1 when the assertion fails (similar to Unix syscalls).

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.