ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
has anybody used reflection in C++, like there is reflection in Java.
i have to build a Testing tool to test a class.. so i need the run time info. about the various variables, methods of a class.
i have got one reflection library at sf.net called "cppreflect"
can anyone help me on this..??
AFAIK, there is no reflection in C++. You don't really need it anyways, with real templates instead of "Generics". If you haven't already, you should check out boost.
i need to build a data flow testing tool..
that is a class is input into the tool, the tool generates different sequences of methods of the class.
& finally shortlists the feasible sequences out of these...!
each method is embedded with 3 things
1. Pre-Condition: that must be tue bfore the method executes
2. Post-Condition: that must be tue after the method execution is over
3. Invariant: condition true for the entire class
the class is emedded with these conditions & input to the tool for its data flow testing: (flow of data from one method to another)..
does the boost library provide a mechanism which can help me??
or if u have some suggestion regarding other ways of doing this,,
please share them..!
So, you want make an automatic unit testing data generator? How are you embedding the constraints into the code? As marked asserts?
I believe the best way to do this (in C++) is to essentially "compile" your sources. You can use lex and yacc to do this, or use Boost.Spirit for parsing.
Right, you're trying to make a unit test generator. Right there, it's more or less legal C++, but you're throwing away the condtion results. Best practice to make sure that you are actually assert()ing them, see http://en.wikipedia.org/wiki/Assertion_(computing).
Anyway, my original suggestion still applies (to write a "compiler"), and good luck with your project!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.