Commit Graph

66 Commits (e92d3dcf1013ab340fdef514b41ebf790f79e04c)

Author SHA1 Message Date
Oz Linden b5c834c6fd merge changes for STORM-1051 2011-04-05 07:23:43 -04:00
Merov Linden ae1435e8ee Autobuild: fix for Mac build using XCode 2011-02-17 21:13:48 -08:00
Nat Goodspeed dad558250f Add test to call map-style functions with full map/array params.
Test also passes overlong arrays and maps with extraneous keys; in all cases
we expect the same set of values to be passed to the registered functions.
2011-02-09 23:28:10 -05:00
Nat Goodspeed a4d0a29c49 For test purposes, capture at registration each function's Vars*.
We'd introduced FunctionsTriple to associate a pair of registered function
names with the Vars* on which those functions should operate. But with more
different tests coming up, it became clear that restating the Vars* every time
a given function name appeared in any such context was redundant.
Instead, extended addf() to accept and store the relevant Vars* for each
registered function, be it the global Vars for the free functions and static
methods or the stack Vars for the non-static methods.
Added varsfor() function to retrieve and validate the Vars* for a given
function name.
Eliminated array_funcs() function, restating aggregates of names to test as
LLSD collections. Where before these were coerced into a separate LLSD map
with ["a"] and ["b"] keys, that map can now be part of the original structure.
2011-02-07 11:53:58 -05:00
Nat Goodspeed 1a1563bb15 Untested support for passing array to map-registered function.
An array-registered function has no param names, so you can only pass an
array: a map would be meaningless. Initial implementation of map-registered
functions assumed that since you CAN pass a map, you MUST pass a map. But in
fact it's meaningful to pass an array as well -- for whatever reason -- and
easy to implement, so there you are. Tests to follow.
2011-02-06 21:32:25 -05:00
Nat Goodspeed f4f3791a5f Add test verifying passing LLSD() to const char* parameter.
LLSDParam<const char*> is coded to pass NULL for an isUndefined() LLSD value,
so event-based caller can choose whether to pass NULL, "" or whatever string
value to such a parameter. Ensure this behavior.
2011-02-06 11:57:19 -05:00
Nat Goodspeed e51ccdac0e Introduce zipmap() function and use it in place of frequent loops.
One operation we often use is to take an LLSD array of param names, a
corresponding LLSD array of values, and create from them a name=value LLSD
map. Instead of doing that "by hand" every time, use a function.
2011-02-05 23:31:11 -05:00
Nat Goodspeed 934e8c3976 Make array-funcs success test exercise args-array-too-long case too.
Streamline a bit more redundancy from the code in that test.
2011-02-05 22:49:53 -05:00
Nat Goodspeed 54b1db2f65 Consolidate paramsa, paramsb, et al., into ["a"], ["b"] arrays.
Following the C++ convention of having two distinct somethigna, somethingb
names, initially we introduced paramsa, paramsb LLSD arrays, following that
convention all the way down the line. This led to two distinct loops every
time we wanted to walk both arrays, since we didn't want to assume that they
were both the same size. But leveraging the fact that distinct LLSD arrays
stored in the same LLSD container can in fact be of different lengths,
refactored all the pairs of vars into top-level LLSD maps keyed by ["a"] and
["b"]. That lets us perform nested loops rather than duplicating the logic,
making test code much less messy.
2011-02-05 22:29:43 -05:00
Nat Goodspeed 230d22ceb2 Fix Vars::cp dangling-pointer problem.
Naively storing a const char* param in a const char* data member ignores the
fact that once the caller's done, the string data referenced by that pointer
will probably be freed. Store the referenced string in a std::string instead.
2011-02-05 11:30:52 -05:00
Nat Goodspeed 950cac24cc Add successful calls to array-style functions. 2011-02-05 11:11:20 -05:00
Alain Linden cbffa57351 fix linking to llqtwebkit. 2011-02-04 12:52:36 -08:00
Nat Goodspeed f18885e55d Change FunctionsTriple refs to pointers to facilitate passing.
A certain popular-but-dumb compiler seems to think that initializing a
std::vector from a pair of iterators requires assignment. A struct containing
a reference cannot be assigned. Pointers get us past this issue.
2011-02-04 14:54:20 -05:00
Nat Goodspeed f0c1c4f5b0 Move FunctionsTriple data to function returning vector<same>.
We want to break out a couple different test methods that both need the same
data. While we could define a std::vector<FunctionsTriple> in the
lleventdispatcher_data class and initialize it using a classic {} initializer
as in array_funcs(), using a separate function puts it closer to the tests
consuming that data, and helps reduce clutter in the central data class.
Either way, it's cool that BOOST_FOREACH() handles the gory details of
iterating over a std::vector vs. a classic-C array.
2011-02-04 10:57:48 -05:00
Nat Goodspeed f2bb1b451c BOOST_FOREACH(LLSD) helpers more readable with 'using namespace'. 2011-02-03 23:04:40 -05:00
Nat Goodspeed d814e76cad Introduce BOOST_FOREACH() helpers for LLSD in llsdutil.h.
You can't directly write:
BOOST_FOREACH(LLSD item, someLLSDarray) { ... }
because LLSD has two distinct iteration mechanisms, one for arrays and one for
maps, neither using the standard [const_]iterator typedefs or begin()/end()
methods. But with these helpers, you can write:
BOOST_FOREACH(LLSD item, llsd::inArray(someLLSDarray)) { ... }
or
BOOST_FOREACH(const llsd::MapEntry& pair, llsd::inMap(someLLSDmap)) { ... }
These are in namespace llsd instead of being (e.g.) llsd_inMap because with a
namespace at least your .cpp file can have a local 'using':
using namespace llsd;
BOOST_FOREACH(LLSD item, inArray(someLLSDarray)) { ... }
It's namespace llsd rather than LLSD because LLSD can't be both a namespace
and a class name.
2011-02-03 22:54:16 -05:00
Nat Goodspeed 3cdd1931c6 Add test to call array-style functions with too-short array.
Also, finally got sick of hand-writing the official iterator-loop idiom and
dragged in BOOST_FOREACH(). Because LLSD has two completely different
iteration styles, added inArray and inMap helper classes to be able to write:
BOOST_FOREACH(LLSD item, inArray(someArray)) { ... }
2011-02-03 19:38:41 -05:00
Nat Goodspeed 84a402adf1 Add test to call no-args functions using (map | array)-style calls 2011-02-02 17:42:26 -05:00
Nat Goodspeed 63f81d59f6 Add test to exercise map/array args mismatch validation. 2011-02-02 17:17:41 -05:00
Nat Goodspeed f1262c83fc First few LLEventDispatcher call cases: try_call(), call Callables 2011-02-02 11:13:07 -05:00
Nat Goodspeed 66083f9e7a Replace ad-hoc test functions/methods with systematic enumeration.
Previous tests involved a small handful of functions with only a couple
different parameter types. Now we exhaustively invoke every registration case,
plus every metadata query case. Call cases still pending.
2011-02-01 15:52:32 -05:00
Alain Linden 3a782eb733 HACK just to get the build to work. FIX THIS TEST! 2011-01-31 13:09:59 -08:00
Nat Goodspeed 2bafe0dc8a Extend LLEventAPI to directly call other functions & methods.
Until now, LLEventAPI has only been able to register functions specifically
accepting(const LLSD&). Typically you add a wrapper method to your LLEventAPI
subclass, register that, have it extract desired params from the incoming LLSD
and then call the actual function of interest.
With help from Alain, added new LLEventAPI::add() methods capable of
registering functions/methods with arbitrary parameter signatures. The code
uses boost::fusion magic to implicitly match incoming LLSD arguments to the
function's formal parameter list, bypassing the need for an explicit helper
method.
New add() methods caused an ambiguity with a previous convenience overload.
Removed that overload and fixed the one existing usage.
Replaced LLEventDispatcher::get() with try_call() -- it's no longer easy to
return a Callable for caller to call directly. But the one known use of that
feature simply used it to avoid fatal LL_ERRS on unknown function-name string,
hence the try_call() approach actually addresses that case more directly.
Added indra/common/lleventdispatcher_test.cpp to exercise new functionality.
2011-01-28 20:18:10 -05:00
Aaron Terrell (Enus) 48743cbd41 standardizing test suite names as class name under test 2010-08-24 23:41:47 -07:00
Oz Linden 06b0d72efa Change license from GPL to LGPL (version 2.1) 2010-08-13 07:24:57 -04:00
Mark Palange (Mani) 6bafc3c3c9 Automated merge with ssh://hg.lindenlab.com/dessie/viewer-release 2010-06-07 13:22:25 -07:00
Tofu Linden 15b855409a Fix a long-suffering logging unit test failure, re-enable the test.
This makes logs look less scary on Linux, in-line with other platforms.
2010-06-04 13:58:19 +01:00
palange@pdp47.lindenlab.com 71f3913679 EXT-3780 FIX Fixed CPU MHz to be MHz on all platforms. 2010-06-02 15:24:59 -07:00
Mark Palange (Mani) 070954495a Added eol-at-eof 2010-06-01 18:43:41 -07:00
Mark Palange (Mani) 7bf5e5c618 EXT-3780 FIX Added llprocessor regression test 2010-06-01 18:39:43 -07:00
Tofu Linden a4d224ff93 EXT-5055 LLInstanceTracker promotes some dangerous patterns - detect them 2010-02-06 21:38:57 +00:00
Nat Goodspeed 97f97f286c Skip logging test that fails on Linux, no idea why 2009-12-03 09:14:17 -08:00
richard 8c90e4d468 DEV-42747 - lltreeiterators_test.cpp broken on Windows
reviewed by Nat
2009-11-12 13:54:30 -08:00
Nat Goodspeed a97aebb84a Enhance LLInstanceTracker variants to be more uniform.
For both the (so far unused) generic KEY form and the KEY = T* form, provide
key_iter, beginKeys(), endKeys().
Change instance_iter so that when dereferenced, it gives you a T& rather than
a T*, to be more harmonious with a typical STL container. (You parameterize
LLInstanceTracker with T, not with T*.)
Fix existing usage in llfasttimer.cpp and lltimer.cpp to agree.
For the KEY = T* specialization, add T* getInstance(T*) so client isn't forced
to know which variant was used.
Add unit tests for uniformity of public operations on both variants.
2009-11-10 13:30:29 -05:00
Nat Goodspeed aa75245a1a Automated merge with ssh://hg.lindenlab.com/viewer/viewer-2-0/ 2009-10-20 11:34:46 -04:00
Nat Goodspeed 6f44e1de9b Don't include linden_common.h in lldate.h, or any other .h files.
Migrate to the .cpp files where it's needed.
2009-10-20 08:53:18 -04:00
Steve Bennetts 65bf35cfed merge 2009-10-19 10:49:48 -07:00
Mark Palange (Mani) 3e10fa4d51 merge from latest svn/viewer-2-0 to hg/viewer-2-0 2009-10-16 16:42:45 -07:00
Adam Moss a0ee6fbbdd DEV-41408 convert lldependencies tut test to llcommon integration test. 2009-10-16 13:42:58 +00:00
Adam Moss e922089ff4 DEV-41080 more automated testing love - minor comment fixing. 2009-10-16 12:39:05 +00:00
Adam Moss fc6c7e3933 DEV-41403 convert reflection tut test to llcommon integration test. 2009-10-16 11:37:17 +00:00
Adam Moss 95cf5766f9 DEV-41402 convert stringize tut test to llcommon integration test. 2009-10-16 11:32:46 +00:00
Adam Moss 9672abecd4 DEV-41367 resurrect dead bitpack test, convert it to a llcommon integration test. 2009-10-15 18:51:23 +00:00
Adam Moss 35c0d21c1e DEV-41366 convert monolithic llbase64 test into a llcommon integration test. 2009-10-15 18:44:59 +00:00
Adam Moss ad583afe2c DEV-41354 #includes tidyup. 2009-10-15 18:12:10 +00:00
Adam Moss db6dff1d1f DEV-41354 convert llerror tut test into a llcommon integration test 2009-10-15 18:10:46 +00:00
Adam Moss 986bf99839 DEV-41352 convert lluri tut test to a llcommon integration test 2009-10-15 18:05:15 +00:00
Adam Moss c7df37b531 DEV-41344 convert monolithic tut lltreeiterators test to a llcommon integration test. 2009-10-15 16:49:08 +00:00
Adam Moss 423f5b0078 DEV-41341 tut lltiming test -> llframetimer integration test 2009-10-15 16:32:56 +00:00
Adam Moss 2a99e18ea1 DEV-41178 convert lldate legacy monolithic tut test into a llcommon integration test. 2009-10-12 14:56:03 +00:00