Commit graph

4283 commits

Author SHA1 Message Date
59c2d2b482 WIP: start implementing the generic UI base 2015-12-16 23:24:11 +01:00
a9a6aabcbc return to topic: UI element protocol
next step will be to rig the mock element and set up
and cover the basic / generic element behaviour

This changeset
 - adapts the (planned) unit test to the semantic of
   the EventLog, which is now fully implemented

 - adjusts the function names on the public Tangible interface,
   to be better in line with the naming convention of the
   corrsponding operations on the UI-Bus:

   * "mark" operations are towards the UI element
   * "note" messages are from the UI element towards some
     state manager, which can be reached via the bus
2015-12-16 02:16:53 +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
c13b859aa5 fix typo in test assertion 2015-12-13 02:02:54 +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
7d9108a079 diagnostics formatting helper: set limited precision for doubles
this deals with a recurring problem in test code:
very common "simple" fractional values can not be represented
precisely as binary floating point. The classical example is 0.1

Since this is a diagnostics facility, we can cheat around this
insidious problem by just setting a limited rendering precision.

Floating point numbers behave deterministic; you just need
to know how to deal with limited precision.
2015-12-12 00:55:28 +01:00
761154ae63 stub the code into submission.... 2015-12-11 20:02:30 +01:00
a9096d8781 WIP: draft further logging functionality to cover
damn nasty how much (eays to implement) functionality
you obviously want to have on any logging facility.
2015-12-11 02:27:14 +01:00
f489343401 WIP: draft behaviour of function call logging 2015-12-10 22:51:31 +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
00df7ff477 draft behaviour of helper for negated machtes 2015-12-07 23:47:07 +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
ef1b640ffb adapt API to the workings of log joining (as defined/planned)
indeed I flipped the meaning, with respect to the previous plan.
It seems more natural to "join this into another log"
2015-12-06 04:30:39 +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
eb208ea145 direction switching iterator unit test PASS 2015-12-06 02:28:47 +01:00
f9c0c4c3d0 WIP: draft a direction switching iterator
...we need that to allow matching backwards in the EventLog
2015-12-06 00:10:27 +01:00
5874b1b4dc change lib::Record string representation to handle empty parts better
...no need to enclose empty sections when there are no
attributes or no children. Makes test code way more readable.



TestEventLog_test PASS as far as implemented
2015-12-05 03:57:11 +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
6659a7dee1 augment extensible filter to add the obvious variations
that is
 - allow also for a disjunctive extension
 - allow for negated conditions
 - allow to flip the current condition

unit test PASS
2015-12-05 02:00:44 +01:00
0e41555402 extensible filter: add re-evaluation (test PASS)
this is the tiny bit of operational functionality needed on top:
whenever we're reconfiguring the predicate, we need to re-trigger
the evaluation (and clear the cached value)

n.b.: I've verified in debugger that the closure is
allocated on the heap and the functors are passed by value
2015-12-05 01:31:23 +01:00
075653a815 define the expected behaviour for an extensible filter iterator 2015-12-05 00:52:45 +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
d4c017fa73 WIP: settle on the Tangible interface 2015-11-28 21:43:09 +01:00
9af20b7cf6 WIP: BusTerm needs to be a concrete class
...providing the standard implementation of UI-Bus connectivity.
It seems reasonable to place all of the UI-Bus implementation into
a single translation unit
2015-11-28 20:55:28 +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
2704ad4512 decide upon the actual mechanics of command binding and invocation 2015-11-28 08:15:32 +01:00
42cec6d604 decision to follow the generic approach (#978, #979) 2015-11-28 05:51:53 +01:00
7b16c6b130 fundamental concerns regarding command binding
prompted by first attempt to define the Tangible interface...
ZOMG! And I thought I might be able just to code-up that stuff
2015-11-28 01:20:40 +01:00
d04e6d74d8 WIP: arrange some elements needed for MockElm implementation 2015-11-27 19:24:00 +01:00
25805635ff WIP: test-driven brainstorming -- a framework for event log verification
this is a recipe for writing UI related tests
2015-11-27 02:38:23 +01:00