Code Monkey home page Code Monkey logo

c-convey's People

Contributors

gdamore avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

c-convey's Issues

Documentation needed

Proper documentation (perhaps a github pages site) is called for, as there are definitely some gotchas around order of execution, macro use etc.

Makefile or CMakeLists for Windows

The Windows side has to be built by hand at the moment. That's a bit unfortunate; create an NMakefile or whatever to make Windows happy.

Calling conveys multiple times does not work

Because of our use of static variables to hold setjmp information, it does not work to call Convey() from different call sites or multiple times. For example, two functions cannot call a 3rd function that embeds a Convey() block.

This is a major limitation. We need a way to understand the context of the caller, and either reset it, or cope. I'm not sure how to solve this at present; probably the static variable approach is just inadequate.

Rename test* to convey*

The test symbol name is a bit too common, and test.c is a also a bit weird.

We propose the following:

Rename all test_xxx symbols to convey_xxx

Rename T_ symbols to CONVEY_ (less likely to collide than C_.)

Rename test.c to convey.c

Merge test.h and convey.h into just convey.h - and offer a feature test ("CONVEY_NONPOLLUTE") or some such to limit namespace pollution.

Probably we should look at making all the "private" stuff in convey.c use some prefixed symbol name too, in case folks just want to #include the .c directly. (Bad idea, but some folks will want.)

Compilation errors are "hard" to debug

Because of the crazy amount of work we do with the C preprocessor, it can be quite confusing to debug compilation errors when compiling test programs using C Convey.

I'm not sure how we can make this simple. The truth is that the CPP is an ugly beast, and its too bad we have to use it -- but this is the nature of trying to emulate lambda functions in C... When it works, it's terrifically beautiful. When it fails, its terrifically ugly.

Richer So() assertions

We could implement an extended version of So that is variadic, and then define custom assertions against them, like GoConvey has. I imagine that we'd have an "assertion" type that's actually a function pointer (could be variadic), that returns a result, which would include information appropriate for logs, and which would take the arguments.

Because C is strongly typed, we'd probably need versions of these macros that understand different types. I think this would be relatively straight-forward, other than it requires C99 variadics. (Fortunately I think these are supported ~everywhere these days.)

Add variadic macros for Error(), Printf(), Printf(), and Skip()

Using variadics (which are now pretty darned universal -- Microsoft is mostly the last hold out on C99, and studio supports this C99 feature), we can give richer debugging support to the code.

We can offer a non-variadic fallback (that only takes a single argument) for folks who are stuck in the past -- enabled via CONVEY_NO_VARIADICS. That should be ~nobody.

Variadic macro support is likely to be critical for supporting richer assertions in the future.

Want a way to "expect failure"

This is really more for our own internal testing of C Convey... we'd really like to test assertion failures, and trap those failures without percolating the failed state up. What's called for here is some kind of "ExpectFailure()" or similar. This should actually invert the failure state of the current convey, so that a failure is considered "normal", although the Convey block still needs to cease execution.

This could actually include a code block, which executes in the failed context, allowing for further validation of the nature of the failure. This would greatly facilitate deep validation of our own failure handling modes.

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.