Commit graph

44 commits

Author SHA1 Message Date
Sei Lisa
fe574bb462 Bump copyright year.
'bout time.
2017-08-09 19:45:46 +02:00
Sei Lisa
9b812a2d2a Add no-coverage markers to Windows-specific code.
It won't be reached. Also, simplify the expected errors line to make it shorter.
2017-01-22 01:32:50 +01:00
Sei Lisa
acd6264cd8 Minor reordering of llUnescapeURL tests, and add 'x' to some tests.
(To the UTF-16 surrogate tests, to be specific)
2017-01-20 02:38:33 +01:00
Sei Lisa
007a726bee Fix llUnescapeURL with % in place of the second hex character.
When the input was of the form e.g. "%4%40", the second "%" was erroneously starting another quoted character. LSL doesn't behave that way: parsing resumes without starting another quoted character. Disturbingly, the expected result in the corresponding test was wrong. Fixed both the test case and the code to match actual LSL behaviour.
2017-01-20 01:59:59 +01:00
Sei Lisa
b0f8b7036b A bit of reordering, to put some similar tests together. 2017-01-20 01:40:19 +01:00
Sei Lisa
1dfcb16d5a Remove another duplicate test. 2017-01-19 05:37:06 +01:00
Sei Lisa
b8985adca9 Remove duplicate test and reorder things a bit.
There was a duplicate(ish) test, which tested float("nan") instead of NaN or Indet. On Windows it was not duplicate, because under Windows, float("nan") produces Indet, which was not tested. Change it to Indet so we know what we're testing.
2017-01-19 02:51:25 +01:00
Sei Lisa
7f8cb4ec58 Fix llAbs corner case.
As an exception, llAbs(-2147483648) equals -2147483648.
2017-01-18 00:50:59 +01:00
Sei Lisa
3a91f04cb5 Minor consistency adjustments to llBase64ToString tests. 2017-01-18 00:44:24 +01:00
Sei Lisa
2a76b26e13 Remove more duplicate tests. 2017-01-15 03:18:50 +01:00
Sei Lisa
c8aa679da0 Emphasize that byte strings are byte strings. 2017-01-15 02:35:06 +01:00
Sei Lisa
1e017b5c56 Remove duplicate test. 2017-01-15 01:49:26 +01:00
Sei Lisa
742532d48e Run llFrand test just once.
It doesn't make sense to check the output multiple times. It would if lslcommon.IsCalc were set to True, because then it wouldn't be distinguishable from a randomly obtained value. But in non-calc mode, it would raise ELSLCantCompute if it were unpredictable, so it's OK to check just once because if it doesn't raise, it's predictable and can be checked.
2017-01-14 03:56:33 +01:00
Sei Lisa
2b0633e2f9 Expand llPow results table to test indeterminates too. 2017-01-13 01:45:09 +01:00
Sei Lisa
133c1572f6 Remove unnecessary activation of LSO mode in a test. 2017-01-12 19:02:58 +01:00
Sei Lisa
b623d6ae5c Remove duplicate test, add test for LSO llListFindList
The test for two empty lists passed to llListFindList was duplicated. That case generates -1 under LSO, and that wasn't tested, so we add that as a test now. Check also that another corner case behaves properly under LSO.
2017-01-07 23:33:50 +01:00
Sei Lisa
19dec1d79e Allow llModPow and llXorBase64Strings to work in calculator mode.
e16fad0 was somewhat hurried. Revert it and use ELSLCantCompute, which is intended exactly for that purpose.
2017-01-07 20:46:14 +01:00
Sei Lisa
e16fad0366 llXorBase64Strings and llModPow are not safe to precompute.
The reason is they have an embedded delay. A script might rely on it, therefore substituting the call with its value is not equivalent to leaving the call. They were both already excluded from the SEF table for the same reason.
2016-12-25 05:25:24 +01:00
Sei Lisa
a68bbeac23 Check that the tests distinguish 0.0 and -0.0. 2016-12-25 01:11:12 +01:00
Sei Lisa
d54ba42330 Fix more test failures on Windows.
On Windows, float('nan') produces Indeterminate. To fix, set Indet first and then set NaN to the opposite.
2016-12-22 06:05:47 +01:00
Sei Lisa
e8d7dd50f3 Test NaN behaviour in more detail. 2016-12-22 05:30:39 +01:00
Sei Lisa
91fd9734c8 Fix llRot2Fwd/llRot2Left/llRot2Up and add regression tests. 2016-12-22 03:06:56 +01:00
Sei Lisa
44a9c9a40c Fix test case that caused an exception. 2016-12-22 01:22:11 +01:00
Sei Lisa
14488ddd92 Improve behaviour of llAtan2 to make it closer to SL's.
Especially regarding NaN inputs. Add regression tests.
2016-12-22 01:08:07 +01:00
Sei Lisa
159fae90bf Improve llFrand.
- Remove it from lslextrafuncs, and move all the code to lslbasefuncs.
- Make it behave like SL's more accurately. Denormals return 0 always in SL.
- Use int() for truncation rather then floor/ceil.
- Add test cases.
2016-12-22 01:05:21 +01:00
Sei Lisa
43beb767f2 Fix llBase64ToString's behaviour with invalid UTF-8.
llBase64ToString doesn't behave like llUnescapeURL wrt invalid UTF-8. First, the last NUL if any is removed, and the remaining NULs are converted to "?". Second, all overlong sequences are converted to a single "?", *including the 5- and 6-byte UTF-8*.

Implement this behavour and the corresponding unit tests.
2016-12-13 15:04:02 +01:00
Sei Lisa
b593141f9f Fix UTF-8 in the surrogate range passing as good.
Our UTF-8 validity checker failed to recognize that characters in the surrogate range (D800-DFFF) were invalid. Fortunately, Python 2 is happy about that, therefore it doesn't crash (Python 3 fixed that range too). Unfortunately, SL isn't, therefore we fix it.

Added corresponding unit tests.
2016-12-13 03:30:32 +01:00
Sei Lisa
ae984169ad Add llGetEnv to the partially computable functions.
Includes all known settings up to 16.12.03.322072 so far. It will be updated as new settings are added.
2016-12-12 22:58:12 +01:00
Sei Lisa
899b550133 Add tests for inf < inf and -inf < inf 2016-11-29 22:56:00 +01:00
Sei Lisa
74115345f0 Fix blunder in operator priority
-a//-b did the wrong thing. Use -(a//-b) and add corresponding regression tests.
2016-11-06 04:09:43 +01:00
Sei Lisa
79dff25769 Update copyright years of some files; add legalese to seftable.txt 2016-06-27 20:06:41 +02:00
Sei Lisa
a067cc6b7f Test program no longer needs a tolerance. Also add more tests.
Tests all boundary values for all three functions, for exact values. The inexact test is no longer necessary.
2016-05-21 04:28:57 +02:00
Sei Lisa
7b70bfe55f Fix precision error in llTan special values. 2016-05-21 02:27:15 +02:00
Sei Lisa
94ea0a1140 Add two more tests to be more confident on NaN/Indet comparison. 2016-05-15 20:08:09 +02:00
Sei Lisa
c2560303dc Improve NaN tests to properly check for indeterminates.
One big disappointment is that Python doesn't allow redefining float.__repr__, leading to a much increased difficulty in checking and reporting differences in NaN vs. Indet. We do what we can, though. We re-enable the recursive comparison as opposed to the repr comparison.

As a result, many of the tests reported wrong results. Fixed them. Fix also a problem with comparing infinities (they can't be compared to a tolerance).

This commit also changes the struct.pack check to math.copysing as in the previous commit.
2016-05-15 20:00:04 +02:00
Sei Lisa
b5dc38e9e6 Add more NaN-related tests, make NaN checking stricter
reallyequal: Compare the sign of NaN when checking if the args are NaN.

Tests added:

- llAsin, llAcos with out-of-range argument produces NaN.
- llAtan2 with (0, 0) produces 0.
- Sign of NaN is not distinguished in lists, even if NaN compares equal to NaN.
2016-05-15 18:25:13 +02:00
Sei Lisa
23b27bd3af Produce more math errors in division
Besides dividing by zero, any result producing NaN including inf/inf, NaN/anything, anything/NaN causes a math error as well. We only contemplated NaN/anything and neglected the rest, so we generalize it.
2016-05-15 18:21:24 +02:00
Sei Lisa
055663b79d Another str -> repr change affecting a float. 2015-12-09 03:43:59 +01:00
Sei Lisa
2d72b8e198 Fix llList2CSV with -nan in vector and quaternion (with test case). 2015-09-09 18:14:27 +02:00
Sei Lisa
bc4f574b33 Managed to deal with the '-nan' case in llList2CSV. Add test cases. 2015-09-07 02:56:44 +02:00
Sei Lisa
c68a1f4ad6 Add copyright notices to all files, to prepare the program for release. 2015-03-05 23:18:41 +01:00
Sei Lisa
f03466629f Fix several bugs in lslbasefuncs; change InternalJsonScanMatching strategy.
Fix bug: add(Key, Key) is not valid.
Fix bug: llList2CSV was raising an exception always.
Fix bug in test program: llDumpList2String requires Unicode separator.
Patch test program to not output the passed tests.
2014-07-31 19:18:26 +02:00
Sei Lisa
4bff3aaf94 Thorough review of lslbasefuncs and associated files, adding new stuff.
- Scratch TODO item: Change shouldbeXXX to asserts.
  - shoudlbeXXX(x) has been turned into assert isXXX(x). Affects lsl2json too.

- New base functions:
  - compare (for == and !=)
  - less (for <, >, <=, >=)

- minus() renamed to neg() for consistency. Affects testfuncs too.

- add() now supports key+string and string+key.

- Allow integers in place of floats. That has caused the addition of three utility functions:
  - ff (force float)
  - v2f (force floats in all components of a vector)
  - q2f (force floats in all components of a quaternion)
  Used everywhere where necessary.

  Special care was taken in a few funcs (llListFindList and maybe others) to ensure that lists containing vectors or quaternions which in turn contain integer components, behave as if they were floats, because LSL lists can not physically hold integer values as components of vectors/quats.
  This also fixes a case where if a large integer had more precision than a F32 (e.g. 16777217), the product/division would be more precise than what LSL returns.

- Fix bugs of missing F32() in some places (llRotBetween, llEuler2Rot).

- Some functions marked for moving in an incoming commit.

- llList2CSV marked with a warning that it is not thread safe. That's a future TODO.

- Document llListFindList better.

- Make llListStatistics Use a more orthodox method to return the result for LIST_STAT_RANGE, LIST_STAT_MIN, LIST_STAT_MAX.

- Make llAxisAngle2Rot use more precision from llVecNorm, by adding an optional truncation parameter in the latter.

- Change order of some F32(Quaternion(...)) to not force so much instancing.

- Bugfix: llVecNorm did not return a Vector.
2014-07-26 20:54:01 +02:00
Sei Lisa
4ee320ace1 Add the unit testing files.
testfuncs.py uses custom testing functions.
testparser.py uses the unittest standard module.
2014-07-26 03:18:02 +02:00