Commit graph

14 commits

Author SHA1 Message Date
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