Commit graph

98 commits

Author SHA1 Message Date
8dac2a541a change the semantics of EventLog "clearing"
use the smart-ptr semantics to just detach from the log.
This allows other entities still to hold onto a joined log
2016-02-14 00:56:52 +01:00
e9a649ff63 draft test for mesage dispatch to UI-Elements
seems to work already, just there is some mismatch
in the test verification code
2016-02-13 22:55:57 +01:00
3f22150ab3 back to topic: get all the arguments of command binding logged
...when the Test-Nexus processes a command binding message.
In the real system of course we do not want to log every bind message.

The challenge here is the fact that command binding as such
is opaque, and the types of the data within the bind message
are opaque as well. Finally I settled on the compromise
to log them as strings, but only the DataCap part;
most value types applicable within GenNode
have a string representation to match.
2016-02-05 15:55:22 +01:00
5a5beebd15 marcro to indicate current test function on STDOUT
since our test.sh runner can be used to verify the
expected output printed by tests, working with these
output transcripts of larger tests can be hard at times.

These separators help to find who produced which output
and they prevent a regexp match to grep beyond the feed
of a single function (which can be a common problem
when using the self-diagnostic output of the facility
currently in test, which obviously will be similar
on any data printed.
2016-01-15 01:44:35 +01:00
ecd1375e92 fix and adjust broken test defintions. Closes #985 2016-01-10 12:25:45 +01:00
6633cb03bd sanity: how to pass 'anything' properly to the type diagnostics function
turns out this is a tricky situation.
We want to accept pretty mutch everything, yet we want to get a grip
on anything object-like, so to reveal available RTTI information.
Now, given the way C++ template substitution works, the 'TY const&' overload
wins with only a few exceptions. The reason is, C++ invokes most functions
passing the concrete argument as reference, unless this is not possible,
because the concrete artument is a rvalue. The automatic reduction of
reference expressions does the rest. Consequently the overload with 'const&'
turns out to be the best match even when we invoke the function with a
pointer expression, which would then be made into a pointer-to-a pointer
by our forward call.

There are two remedies for this dilemma:
- make the second overload just typeStr (TY&)
- explicitly remove the second overload for pointers

The first solution unfortunately would rule out passing of anonymous
objects like concatenated strings; in fact it would rule out passing
rvalues as such. While the second solution, chosen here, works really
for everything, and also has the nice side effect of stripping away
any const, pointer and reference adornements elegantly before we
even start to analyse the type.

The only downside of this solution is that it looks intimidating
to the casual reader. Well, I'd say, get used to it.
2016-01-09 22:23:50 +01:00
615f112f5c clean-up(#985): unify various type-indicating helpers
over time, we got quite a jungle with all those
shome-me-the-type-of helper functions.

Reduced and unified all those into
- typeString : a human readable, slightly simplified full type
- typeSymbol : a single word identifier, extracted lexically from the type

note: this changeset causes a lot of tests to break,
since we're using unmangeled type-IDs pretty much everywhere now.
Beore fixing those, I'll have to implement a better simplification
scheme for the "human readable" type names....
2016-01-09 02:05:23 +01:00
2c20d407fc mass clean-up: adapt usage of std::cout pretty much everywhere
- remove unnecessary includes
- expunge all remaining usages of boost::format
- able to leave out the expliti string(elm) in output
- drop various operator<<, since we're now picking up
  custom string conversions automatically
- delete diagnostics headers, which are now largely superfluous
- use newer helper functions occasionally

I didn't blindly change any usage of <iostream> though;
sometimes, just using the output streams right away
seems adequate.
2016-01-07 20:12:46 +01:00
0c4495a451 reorganisation(#985): move basic typeString implementation into lib::meta
- simple function to pick up the mangled type
- pretty-printing is implemented in format-obj.cpp
- also move the demangleCxx()-Function to that location,
  it starts to be used for real, outside the test framework
2016-01-05 23:34:53 +01:00
286a051088 fix broken logic when matching on events with classifier
the fixed version is actually more permissive,
insofar it matches any type of event, when ID = classifier
(or alternatively it matches events with type = classifier)
2016-01-03 05:11:25 +01:00
540151b56b provide a mock handler for commands and state marks
in the real system, this will be the task of the CoreService,
while here, in test mode, we allow to install handling closures
from the unit-test-code
2016-01-03 03:23:39 +01:00
3230660d86 implement, cover and use the log clearing function 2016-01-02 02:00:07 +01:00
c6945a452e need helper functionality for tests to scrap existing log contents
...this is necessary whenever the mocked facility covered
by log matching is managed automatically as singleton,
because then other test cases will leave garbage
in the log
2016-01-02 01:41:53 +01:00
603f9e2b7d DOC: fix some Doxygen link syntax
I worked under the erroneous assumption, that Doxygen
will use its internal entity-IDs as the link-IDs when
generating mardown-links. Yes, this seemed logical and
this would be the way I'd implement it....

But seemingly, Doxygen is not so consistent when it
comes to questions of syntax. The same holds true for
markdown, which lacking a coherent definition anyway.

Another problem is that Doxygen's auto-link generation
frequently fails, for reasons not yet clear to me.
Sometimes it seems to be necessary to give it a nudge
by including the \ref command. While I'm not willing
to go into focussed invstigation of Doxygen syntax
right now, at least I've done a search-and-replace
to remove the malformed links I've written the
last days
2015-12-27 03:16:49 +01:00
cb4a0a6e60 change the EventLog header to store a "this" attribute
seems more logical than calling the attribute "ID",
especially since we're now able to use the on("xyz") matcher
2015-12-15 23:44:34 +01:00
c8068496d1 EventLog unit test PASS
so this turned out to be rather expensive,
while actually not difficult to implement.
On the way, I've learned
- how to build a backtracking matcher, based on
  a filtering (monadic) structure and chained lambdas
- learned the hard way how (not) to return a container
  by move-reference
- made first contact with the regular expressions
  now available from the standard library
2015-12-13 05:03:36 +01:00
d0cdae2cee implement matching on regular expressions 2015-12-13 03:24:25 +01:00
42a5668831 implement further match refinements (type, attribute, target) 2015-12-12 23:41:24 +01:00
941fe3a9b9 factor out util function to "stringify" arbitrary arguments
this function is of use also for creating a vector of strings
from a bunch of C-Strings, but it could also be used to
construct other stuff initialised by strings (e.g. RegExps)
2015-12-12 23:18:25 +01:00
33f7fe116a implement refinement filter on log entry's arguments.
Whew! functional programming is such a powerful concept.
You get additional refinement and lazy backtracking
basically for free....
2015-12-12 03:13:32 +01:00
5bc6919bdb implement the specialised event or call-matching logic 2015-12-12 02:23:12 +01:00
80ffdc1f05 provide the remaining, specialised logging calls 2015-12-12 01:35:38 +01:00
261bcc9fdb implement logging of "events" with additional ID / classifier 2015-12-12 01:28:42 +01:00
4522e209fb implement generic log entry with arbitrary fields 2015-12-12 01:24:52 +01:00
894ef68a8f EventLog: implement logging of function invocations 2015-12-12 01:01:46 +01:00
761154ae63 stub the code into submission.... 2015-12-11 20:02:30 +01:00
bf92333339 implement log joining in shared heap storage 2015-12-09 01:18:15 +01:00
cd8e6d874c EventLog: switch to shared PImpl
this is prerequisite for joining and sharing logs
2015-12-08 22:14:29 +01:00
09afbb0e12 change implementation technique: use flags instead of exceptions
abandon the use of an assertion exception to signal match failure,
rather use a final bool conversion to retrieve the results.

Error messages are now delivered by side effect into STDERR


The reason is we're unable to deliver the desisred behaviour
with the chosen DSL syntax in C++ ; on a second thought the
new approach is even better aligned with the overall way
we're writing tests in Lumiera. And we produce match-trace
messages to indicate the complete matching path now
2015-12-08 03:20:52 +01:00
b3881696e5 this solution for negative matches is not usable
implemented a solution to determine negative matches.
But because this solution relies on throwing from a destructor,
it is not possible to catch the resulting assertion failure.
Not sure why (AFAIK there is no second exception thrown
while unwinding the stack), but throwing from dtors is
considered "undefined behaviour" anyway.

So this solution is of limited use


beyond that solution, I'm not sure if the desired syntax
can be implemented at all in C++. Seems that we need to build
a bracketing construct, first to initiate a negated match
and finally, after all queries, to detect if there happened
any failure or not
2015-12-08 01:10:02 +01:00
272d62d5a3 log handling const correctness
adding log entries requires full access,
whereas matching log entries is const,
since it doesn't alter the log
2015-12-06 04:37:41 +01:00
a95f9a6cac draft how "log joining" shall work 2015-12-06 04:21:35 +01:00
c9d113be87 EventLog: implement match backwards
..based on the new IterCursor, which gives us the ability
to switch the iteration direction
2015-12-06 03:35:07 +01:00
00abf9f1f9 err: got the naming and the junctor condition backwards
the junctor is called "before" but searches ahead.
And in this case we do not need to *extend* the filter condition,
just replace it with a new one...
2015-12-05 03:37:25 +01:00
09a560dfac add explicit diagnostics to assertion failure
...and fix an error (header include order of diagnostics facility)
which prevented the first matcher implementation to work

the after()-match now works as expected
2015-12-05 03:13:01 +01:00
9300a0baaf code up the first event log matching predicate
this establishes the basic pattern used for implementation
Note: test still fails
2015-12-05 02:40:03 +01:00
38fd7d6d69 use the new extensible filter iterator to implement event log matching 2015-12-05 02:07:25 +01:00
68dd8a9e03 refine implementation draft: make FilterIter extensible on-the-fly
after looking into our various iterator tools,
it seems obvious that our filtering iterator implementation
has almost all of the required behaviour; we only need to
add a hook to rewrite and extend the filtering functor,
which can now nicely done with a lambda closure.

This means all memory management, if necessary, is
pushed into std::function and the automated memory
management for closures provided by the runtime.
2015-12-05 00:28:07 +01:00
41626c363e WIP: draft how to implement those chained EventLog matchers
the solver is a Monad; succesively flatMap more conditions
and try to get some element from the solution
2015-12-02 23:37:54 +01:00
d38b28da5b implement initial EventLog entry 2015-12-02 01:31:37 +01:00
b2542b86f7 stub and rectify interfaces defined thus far.
...compilation PASS again
2015-11-28 23:50:56 +01:00
809ed36b56 WIP: draft initial test for event logging helper 2015-11-28 19:20:10 +01:00
1eda2a070b harmonise the form of the header include guards
no trailing underscore
2015-11-28 18:36:35 +01:00
d04e6d74d8 WIP: arrange some elements needed for MockElm implementation 2015-11-27 19:24:00 +01:00
b0368a6d2b full unit test coverage of equality
horay!
seems like madness?
well -- found and squashed a bug: equality on RecordRef
implicitly converted to GenNode(RecordRef), which always
generates new (distinct) IDs and so never succeeds. What
we really want is equality test on the references
2015-08-29 21:27:33 +02:00
273bd698e1 test helper to show short demangled type names without scope 2015-04-25 01:40:39 +02:00
7686122354 implementation complete -- kindof works
there is a problem with the virtual assignment,
seems the default policy was picked.

Beyond that, the rest of the unit test passes
2015-04-19 02:02:54 +02:00
8b6177a1c5 Design: Backbone of the GUI
This is the first step towards a generic backbone to connect
any GUI elements to the session within Proc-Layer.

It is based on a spefic understanding of Model-View-Controller,
which turns the Model-Controller interactions into messages.
2015-01-06 23:44:58 +01:00
088e4422fb Test helper to show demangled C++ names
Heureka! found out that the C++ standard library exposes a
cross vendor C++ ABI, which amongst others allows to show
object code names and type-IDs in the language-level, human
readable unmangeld form.

Of course, actual application code should not rely on such a
internal representation, yet it is of tremendous help when
writing and debugging unit tests.

Signed-off-by: Ichthyostega <prg@ichthyostega.de>
2014-11-22 03:31:59 +01:00
059dbd8c75 fix and finish the diagnostics helper
there was still a subtle bug in this helper.
testing your own test fixture is sometimes a good idea ;-)
2014-09-23 03:37:28 +02:00