-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
proposal for cross-platform testsuite #259
Comments
Sweet! You are on fire, @andik! Really looking forward to taking a look at On Thu, Feb 5, 2015 at 12:26 PM, andik [email protected] wrote:
Morgan Packard |
Generally, this looks great to me. Couple things:
I think this is close to something we can run with, and I REALLY appreciate all your time and thought on it! If you can create something that compiles and runs reliably on all our target platforms (address issue #3), I'll be very happy. If you can come up with a less weird way of registering the test cases: probably not using Thanks @andik! |
Hey morgan, you're basically a little too fast ^^ to #1 and #3: this has been adressed, really, this wasn't my best idea ^^ to #4: Thank you for that tip, I wasn't aware that this macro exists. I'm almost exactly doing what the If you mind, I created the basic headers as a new public domain library, so that it is refactored out of Tonic and you don't have to maintain it (https://github.com/andik/adaptest) ^^. sadly visual buffer comparison isn't implemented yet. But thats not a problem, because I only can issue a pull request when the cmake stuff is merged, I do not want to fiddle the differences by hand. So I would prefer to finish this first, one after another. I still have a lot of stuff in my mind (how about a clock scheduler for the metro like pd has). |
@andik Got everything to compile (using make), and it works! I'm not happy with how the generated xcode project looks, or performs (doesn't compile immediately, weird double-listed files, weird directory structure), but I see no reason not to just say the tests must be run using cmake, and that xcode isn't supported for tests. I can imagine ways to make this nicer (the biggest thing being some way to run all the tests with one click), but I think what you've set up here will totally work for us. I'm excited to start writing some more tests and incorporating this in to my cross-platform work flow! Do you think this is ready to fold in to the main repository, or are there still significant changes you're considering? |
Hey morgan, I have written some Stuff to print out buffer differences as CSV and generating a gnuplot script for it. I need to test and verify it a little, but I think during that week I will get this done. I also thought a little about the cmake. I could PR only the test files without the cmake (using a new branch). This way we could keep that thread open and discuss it further... By the way cmake provides a one-shot all test runner using |
I wasn't able to run the tests without cmake, so I'm not sure it makes On Mon, Feb 16, 2015 at 2:08 AM, andik [email protected] wrote:
Morgan Packard |
Hey @andik. Couple things.
|
I think it could be written as |
|
ok, commited a new release. To watch plots you don't need gnuplot anymore. only the generated html files and the supplied dygraph.js (copied into the directory of the html file). |
Hey @andik. Tried to install mingw but didn't finish. So tried again to generate the visual studio project using cmake. I get further than I did last time, but get this error:
Apparently, Visual Studio doesn't support this function yet. |
Got the stuff to compile by changing the offending lines to With that change, I can compile and run individual tests from the project. (see the screen shot to see what the visual studio project looks like.) Hooray!!!! However, the application exits before I can read the output and tell if the tests passed or failed! Do you think it might make sense to wait for keyboard input before exiting the test suite application? |
Yes I can remember having this problem when I ported other software from Unix to windows... You could use _snprintf also. For the other point we would need to check if the tests started their own console. This may be complicated. How would you think about using file based recording instead of console based? |
I think it's important to be able to see the results in the console. Why not just wait for keyboard input at the end of the |
This is enough to keep the console open in the standalone demo:
|
If you like, I'll put this into the Tonic tests... I will not put this into adaptest because I do not think that this is a good general purpose solution. We could also make this only for Visual Studio (using a cmake generated define in a cmake generated headerfile aka |
It'd be great if you'd be willing to put that in the tonic tests. Thanks! |
done. Aaargh, commited not pushed... will do that this evening |
I'd like to merge this in to development. I'd prefer a leaner approach to the cmakelists files, one where they aren't sprinkled around the project. At this point, I'm not comfortable enough with cmake to present it as the dominant build system. I'd much rather have the cmake files in their own place, separate from the source, and not in the root folder, like in #261. However, I don't feel strongly enough about that to hold off on getting the tests in to Tonic. I think what you've done is really great, and works solidly enough on mac and windows. So, what do you think needs to be done before this branch is ready to be merged in to development? Thanks so much for all the work you put in to making this happen, @andik! Very much appreciated! |
How about having a cmakefile only in the Tests directory. (And maybe one in the standalone example directory?) Both could grap Tonic sources without building a lib. I'll do this and the file a PR, okay? |
This sounds great. I am really interested in switching over totally to cmake for builds, but until we do that this more minimal approach feels good to me. |
Hey guys,
The following is the description of the concept of the cross-platform testsuite: please tell me what you think about it:
I did not use an existing framework because they either:
REQUIRE(x == y, ...)
magic macros which cannot easily be specialised p.e. for buffer comparison. (catch, lest)The files holding the testcases are cpp. I plan to use one file for each testsuite, but it is not system-imposed to do so.
The following is the basic class layout without any macro hideaway:
this all could be hidden by using some macro magic:
It all works extremly simple:
TestcaseRegistration<>
adds a instance ofSpecialisedTestcase
toMyTestsuiteStorage
upon it's instantiation (which is ordered by declaration orTestcaseRegistration
's in the class, maybe additional through__LINE__
template parameter).TestcaseRegistration<>
template is a subclass ofTestsuite<>
. Thus it can access it's static methods easily it usesTestsuite<>::addTestcase()
for the job described abose.TESTCASE()
macro also uses theTestsuite<>
namespace: the Type ``Testsuite<>::LocalTestcasedefines the Type which
MyTestcase0` should inherit from.MyTestsuite::run()
iterates through theMyTestsuiteStorage
list/map (has yet to be decided) and callsMyTestcase0::run()
upon each testcase instance.Testcase::test_eq()
writes a message tofailstream
if the test fails and returnsFAILED
which in turn causesMyTestsuite::run()
to count the test as failed and output a pretty formatted message (or write a log etc.).__LINE__
macro.TEST(...)
macro expands to a simple function call which can be implemented in theSpecialisedTestcase
easily. This way we can easily extend the testability. p.e.TEST(eq, ...)
will betest_eq(...)
but it also returns whentest_eq()
fails.The magic here is the automatic Testcase registrations, so that we don't have to maintain a separate testcase list or generate code. the idea was taken from the catch framework and adapted to use classes instead of functions.
I want to do this all on a class level, because this is much easier to specialise for example for generator tests, etc.
My Main problem with this solution is that the braces will get hidden. This may annoy pro users and syntax highlighting. But I did not find a better Solution. Also this saves us a lot of useless characters, and looks quite nice, so this is my proposal.
See https://github.com/andik/Tonic/tree/cmake-unit-tests
Note: In the branch the principle class layout is done, but not the correct hideaway through macros, also I need to get rid of the
#include
stuff I do to get the testcases in. I want to make one cpp file for each suite. Also the class-naming there is not up to this concept. But yesterday night nearly instantly 10 of 16 generator test converted from the iPhone suite passed.Maybe I'll publish this as a separate public domain Library and just include it into tonic so that this is available to other people also.
The text was updated successfully, but these errors were encountered: