0

I have eclipse with cdt and a project which contains files generated by flex and bison, the project runs perfectly but I couldn't run it as a unit test, here the things I tried:

CUTE

As the answer on this question says, I couldn't find a way to test a project that already exists, so this didn't work.

CppUnit is old as the answer said(didn't try it though but I don't want an old thing).

CDT unit testing

As this question states, unit testing is now a part of cdt, I installed it and installed googletest and followed the instructions but when I run it, it says : Unknown error during parsing Google Test module output : Unexpected test module output.

This is another question getting the same message but it doesn't have an answer(except in comments which is the same answer I followed when setting up cdt unit testing).

and after I ran this test, I got compiler errors in yacc.cpp and lex.yy.cc which I didn't get when running the project in normal.

Goal

I'm a university student doing a project with four collegues, we're building a compiler to a language specified by the professors.

I have seen a question on "bison flex unit testing", this is it : Unit test of flex bison scanner parse, how to drive the test case

but the poster of the question is using C, we're restricted to use C++ in both scanner and parser, so the question can't really help me.

PS

because running the project without unit testing worked well, I thought the error isn't with my yacc.y or lex.l, that's why I didn't post them, if they are needed I'll edit my question.

One last thing, I'm running linux mint 17.1 64bit.

Community
  • 1
  • 1
niceman
  • 2,653
  • 29
  • 57
  • What about using [google test](https://code.google.com/p/googletest/)? – πάντα ῥεῖ Mar 27 '15 at 16:32
  • @πάνταῥεῖ I tried it, gave the error in the post – niceman Mar 27 '15 at 16:36
  • I've got no problems integrating it into Eclipse CTD, works like a charm. See here please http://stackoverflow.com/questions/16741400/eclipse-cdt-plugin-for-running-tests-and-browsing-report You probably missed to configure google test runner to output the JUnit compatible XML for the test results. – πάντα ῥεῖ Mar 27 '15 at 16:40
  • @πάνταῥεῖ I really think you should read the question carefully, I know that question, it's posted and I said I followed the steps and it didn't work – niceman Mar 27 '15 at 17:01
  • Well, sorry then. I've got no clue why it's not working in your case. (If you would have incorporated the linked question's title in your text I would have recognized that it mine earlier BTW). – πάντα ῥεῖ Mar 27 '15 at 17:03
  • @πάνταῥεῖ no problem, no one knows every thing – niceman Mar 27 '15 at 17:07
  • Also, did you run the test runner from a console? What's the output it gives actually? – πάντα ῥεῖ Mar 27 '15 at 17:09
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/73955/discussion-between-niceman-and--). – niceman Mar 27 '15 at 17:11
  • You have discarded the question [Unit test of flex bison scanner parse, how to drive the test case](http://stackoverflow.com/questions/22205557/unit-test-of-flex-bison-scanner-parse-how-to-drive-the-test-case) but much of my answer there would also relate to C++. – Brian Tompsett - 汤莱恩 Apr 04 '15 at 20:34
  • @BrianTompsett flex scanner uses a class, not supported on C(C doesn't have OOP) so I don't think it will work, maybe an answer on how to get CUnit to work with c++ would be delightful – niceman Apr 05 '15 at 07:19

0 Answers0