GithubHelp home page GithubHelp logo

cegta's People

Contributors

rodionovd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cegta's Issues

Expectations on pointers?

Something basic like

it("should work with pointers as well", ^{
    int *p, *q;
    // ...
    requirePtr(q, toBe(NULL));
    // ...
    expectPtr(p, notToBe(NULL));
});

would be enough.

Ability to disable tests

it("foo", ^{
    // test foo
});

pending("bar", ^{
    // all expectations here will be treated as fulfilled
});

Add support for "blocking" expectations = requires

When a "blocking" expectation fails, no other tests within current it() block will be executed.

Suggested syntax: require():

it("should do something with the file <blah>", ^{
    int fd = open_particular_file("blah");
    require(fd, notToBe(-1));
    // if the require() fails, the code below won't be even executed
    int err = do_stuff_with_file(fd);
    expect(err, toBe(KERN_SUCCESS));
});

Shortcuts for common expectations

For integers (the same goes for floating points numbers):

expectInt(foo, toBeLessThan(bar));
expectInt(foo, toBeLessOrEqual(bar));
expectInt(foo, toBeGreaterThan(bar));

for booleans:

expectToBeTrue(foo);
expectToBeFalse(bar);

for strings:

expectString(foo, toContain("bar");

beforeAll() and afterAll()

From Specta:

beforeAll(^{
    // This is run once and only once before all of the examples
    // in this group and before any beforeEach blocks.
  });

afterAll(^{
    // This is run once and only once after all of the examples
    // in this group and after any afterEach blocks.
  });

Measure an execution time of a test sample

For now it can be done this way:

clock_t tick, tock;

beforeEach(^(const char *it) {
    tick = clock();
});

afterEach(^(const char *it) {
    fprintf(stderr, "TIME: [%lfs]\n", (double)(tock - tick) / CLOCKS_PER_SEC);
});

it("", ^{
    // some heavy stuff here
    /// ...
    tock = clock();
});

but I want it to be like:

measure_it("blah-blah", ^{
   // do something
});

Output:

โœ“ foo blah-blah [0.151462 s]

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.