
Reece Dunn wrote:
Larry Evans wrote:
On 09/23/2004 02:35 PM, Hartmut Kaiser wrote: [snip]
My point wasn't the concrete syntax, this is volatile at this stage anyway. My point was the concept to implement a library, which is 'dual' to Spirit, based on the idea, that a grammar describes all possible matchable input sequences, so why not use this 'grammar' to specify, how to generate this input sequences.
Also, couldn't these 'dual' libraries be used to generate test cases for each other?
Sure. This would be good for performing a feature-by-feature comparison. Hooking the machinery into Boost.Test would be a good way of getting the results. Naturally, the test cases for each library should pass their own tests on supported platforms; the interesting cases will be the test cases from the other libraries.
How do we implement the tests? I suggest that we split the information into:
[1] the data type (type) being formatted, e.g. std::map< std::string, std::string > with the details of its contents;
[2] for output -- the string (str) such that: type val = ...; ostringstream ss; ss << some_fn( val ); BOOST_TEST( ss.str() == str );
I think there's a wrap_stringstream() in the sandbox. You could then do: BOOST_TEST( (wrap_strinstream() << some_fn(val)) == str); Best, John -- John Torjo -- john@torjo.com Contributing editor, C/C++ Users Journal -- "Win32 GUI Generics" -- generics & GUI do mix, after all -- http://www.torjo.com/win32gui/ -- v1.4 - save_dlg - true binding of your data to UI controls! + easily add validation rules (win32gui/examples/smart_dlg)