C-Reduce, a C program reducer
github.com
github.com
Kinda fun, but tedious because it ruthlessly trashes the formatting, so matching up the before and after code is hard.
This isn't all that interesting to do except on code that already has ~100% branch coverage. (Since obviously any unexecuted code is going to get removed, and lcov is a lot less work to use :) )
There aren't really any good mutation testing tools for C— e.g. tools to test your tests by breaking your code and making sure your tests fail. C-reduce can be used as a limited kind of mutation test— one that only tests reductions.
One nice thing is that for code with 100% coverage any successful reduction is quite often a shortcoming in the tests or a missed optimization in the code, which isn't something you can say for most other kinds of mutations. (except for the fact that c-reduce does a lot of formatting garbling that doesn't really change the code)
It runs your tests and makes sure they all pass then it mutates the code under test (changing a == b to a != b or a <= 10 to a < 10) and makes sure that at least one of your tests fails.
If your tests still pass after the mutation then you know you are not covering something.
Tis a great idea but making a C version with the equivalent functionality would be a lot harder I think.
[1] http://stackoverflow.com/questions/4715890/what-mutation-tes...
You'd likely get better results by running both source files through an indenter and diffing the results. That's a strong argument for enforcing a canonical style via tools like "go fmt" or "indent".
The demogroup Farbrausch wrote a code-reduction tool for a slightly different purpose, but with a similar motivation: http://fgiesen.wordpress.com/2012/04/08/metaprogramming-for-...
This also reminds me of the joke http://github.com/mattdiamond/fuckitjs which does almost the exact opposite --- reduces code until it does not have any errors.
Then the powers that be came and took all the credit. Since then I haven't touched it.
But if you think there is some other license that better expresses my... sentiment... you are welcome :)
(I know, it sounds kiddish. It was a long time ago and I felt really burned because PayPal management, from lower to top, is seriously fscked ethically. It took me more than a year to get interested in creating something new.)
As such, if you license your code under the GPL anybody at paypal can use and modify it under the terms of the GPL, as per the terms of the license.
What you can do is have a dual license "as long as the combination of restrictions on the work as a whole does not put any additional restrictions beyond what GPL allows"[1].
That being said, I'm not a lawyer, so I might have misinterpreted the wording of the license.
[1] https://en.wikipedia.org/wiki/GNU_General_Public_License#Com...
Safest would be everyone except PayPal.