Dag-Erling Smørgrav
8351719b84
Simplify test cases by a) using C99 VLAs and b) removing error checks for
...
allocation failures which are either harmless (e.g. failing to allocate
the test description string) or will trigger a segfault which the driver
now catches, allowing subequent test cases to run.
2015-08-19 11:27:48 +00:00
Dag-Erling Smørgrav
cbc2cd1112
If a test case triggers one of a list of signals (including SIGABRT and
...
SIGSEGV), eat it and fail the test. Also print a summary in verbose mode.
2015-08-19 11:17:06 +00:00
Dag-Erling Smørgrav
5e1e20c624
Add marginally useful test cases based on t_zero.
2015-08-18 15:21:02 +00:00
Dag-Erling Smørgrav
d670e3e94d
Increase the sizeo of t_zero to 4096 bytes.
2015-08-18 15:14:11 +00:00
Dag-Erling Smørgrav
531eeec36b
Add a simple implementation of the Adler-32 checksum.
2015-08-18 13:27:06 +00:00
Dag-Erling Smørgrav
1609b4e08a
Cite the Fletcher paper.
2015-08-18 10:42:41 +00:00
Dag-Erling Smørgrav
20cd7d6012
Add 16-bit endian conversion functions.
2015-08-17 15:37:07 +00:00
Dag-Erling Smørgrav
e4c5e8a9dd
Fix props
2015-08-17 15:24:50 +00:00
Dag-Erling Smørgrav
aa97da3335
Add simple implementations of Fletcher's checksum.
2015-08-17 15:21:47 +00:00
Dag-Erling Smørgrav
9103fab696
Add missing header
2015-04-08 12:17:51 +00:00
Dag-Erling Smørgrav
0d730bd66b
Don't forget to distribute and install <cryb/memset_s.h>
2015-02-16 11:07:43 +00:00
Dag-Erling Smørgrav
110ad04333
If no SVN version is available, use today's date.
...
Place the temporary directory in ${builddir} rather than /tmp.
2015-02-15 09:19:25 +00:00
Dag-Erling Smørgrav
dc75f2edd8
Add a memset_s() implementation (cf. C11 / WG14 N1381)
2015-02-15 09:18:18 +00:00
Dag-Erling Smørgrav
f26cbe997d
There is no reason not to distribute our ctype-like macros and strl*()
...
functions.
2015-01-21 23:34:52 +00:00
Dag-Erling Smørgrav
342ac3fd78
Note that rand_bytes() is just a placeholder for the sake of liboath.
2015-01-08 12:24:19 +00:00
Dag-Erling Smørgrav
a33f58cad7
Fix equality predicate.
2015-01-07 19:23:38 +00:00
Dag-Erling Smørgrav
d0fb2359f1
Implement mpi_{add,sub}() in terms of mpi_{add,sub}_abs().
2015-01-07 18:59:44 +00:00
Dag-Erling Smørgrav
cddb6c0e02
Rewrite the zero shortcut tests to avoid dropping a const qualifier.
2014-12-30 20:03:58 +00:00
Dag-Erling Smørgrav
3904e809b2
Add two test cases for shortcut logic used when one operand is zero and
...
the other is also the target.
2014-12-30 19:57:07 +00:00
Dag-Erling Smørgrav
241f524238
Fix a bogus t_malloc_fail in one of the mpi_add_abs() tests.
...
Add several subtraction test cases and modify some others to better
exercise the carry logic, which is far more complex for subtraction than
for addition.
Add test cases where the target is the same MPI as one or both operands.
2014-12-30 19:48:57 +00:00
Dag-Erling Smørgrav
7a90ca7b42
Since X may point to the same MPI as either G or L (or even both), we
...
can't set the carry flag based on the contents of G or L after having
modified X. Instead, compute and stash the new carry value first.
2014-12-30 19:14:59 +00:00
Dag-Erling Smørgrav
8d0e24dee7
Remove the "trailing garbage" version of the mpi_cmp() test. It would
...
be better to systematically pad MPIs used in all tests with garbage.
Greatly expand the number of mpi_cmp() tests to cover all possible
combinations of same or different sign, same or different msb and same
or different magnitude.
2014-12-30 17:00:56 +00:00
Dag-Erling Smørgrav
f18b915b67
Fix the "x = a + b" allocation failure test. Since a and b were
...
equal, mpi_sub_abs() would return early and the test would never
exercise the mpi_grow() call which is intended to fail.
2014-12-30 16:46:44 +00:00
Dag-Erling Smørgrav
0d483f20ab
Fix msb calculation. We may have to backtrack quite a bit, for
...
instance when subtracting two nearly equal large numbers.
2014-12-30 16:45:18 +00:00
Dag-Erling Smørgrav
2027ce33e7
Add tests for the off-by-one bug we just fixed in mpi_cmp_abs().
2014-12-30 16:38:47 +00:00
Dag-Erling Smørgrav
1c024928f9
Fix off-by-one bug in mpi_cmp() which could cause it to read past the
...
end of the buffer.
2014-12-30 16:35:13 +00:00
Dag-Erling Smørgrav
43b870dc83
WIP: implement subtraction correctly. The actual result is now correct
...
most of the time, but the MSB calculation is not.
2014-12-30 11:23:30 +00:00
Dag-Erling Smørgrav
e21452d0c7
Add a few tests for subtraction. They're not particularly well thought
...
out, because currently subtraction does not work at all, but they work
well enough in the sense that they fail with the current implementation.
2014-12-30 11:19:02 +00:00
Dag-Erling Smørgrav
7524a14386
comment nit
2014-12-30 11:15:28 +00:00
Dag-Erling Smørgrav
c5b962387c
Add mpi_eq_abs() and mpi_eq() predicates.
2014-12-30 11:12:11 +00:00
Dag-Erling Smørgrav
b6368af502
Re-add $(RT_LIBS) where needed.
2014-12-29 23:56:22 +00:00
Dag-Erling Smørgrav
03867777c6
Add numerous tests, mostly for allocation failures and edge conditions.
...
Add a t_compare_mpi() predicate which checks that two MPIs have the same
value (but not necessarily the exact same representation).
Clean up and improve existing tests.
2014-12-29 23:54:02 +00:00
Dag-Erling Smørgrav
7b6b493509
Declare t_malloc_fail_after.
2014-12-29 23:49:50 +00:00
Dag-Erling Smørgrav
3ec87c7a8c
Introduce t_malloc_fail_after: if non-zero, it serves as a countdown to
...
setting t_malloc_fail. Also, enforce t_malloc_fail in realloc(), but not
before checking that the argument was valid.
2014-12-29 23:49:29 +00:00
Dag-Erling Smørgrav
bc8e9d67ba
In both mpi_add_abs() and mpi_sub_abs(), make sure that the target is
...
untouched if the operation fails. Also ensure that A = A +/- A works.
2014-12-29 23:44:34 +00:00
Dag-Erling Smørgrav
98c6349d4a
In mpi_zero(), save a memset() if the target is already zero.
2014-12-29 23:22:54 +00:00
Dag-Erling Smørgrav
1412dac680
Shifting any number by zero places is a no-op, but so is shifting zero by
...
any number of places.
2014-12-29 23:20:26 +00:00
Dag-Erling Smørgrav
8228f19d5a
In mpi_copy(), any failure should leave the target untouched.
2014-12-29 23:18:57 +00:00
Dag-Erling Smørgrav
b2ec312d9f
Link each test with only the libraries it needs. This avoids rebuilding
...
every single test whenever any of the libraries changes.
2014-12-29 22:17:02 +00:00
Dag-Erling Smørgrav
889412ec40
Accept a -jN argument which we pass on to gmake.
...
Delete all coverage files, not just the root one.
Exit if the tests fail so we can inspect the result.
2014-12-29 17:04:30 +00:00
Dag-Erling Smørgrav
85defb9929
Fix a cast that discards a const qualifier.
2014-12-29 15:23:52 +00:00
Dag-Erling Smørgrav
82f5c5cf77
In mpi_load(), use be32dec() when possible.
...
In mpi_set(), it is impossible for the value being loaded to exceed
the minimum size of an mpi; thus, there is no need for mpi_grow().
2014-12-29 15:08:09 +00:00
Dag-Erling Smørgrav
7a09b0638f
I had forgotten that t_add_test() is actually a printf()-like variadic
...
function, which obviates the need for asprintf() in the string comparison
and equality tests.
2014-12-29 14:24:08 +00:00
Dag-Erling Smørgrav
3333bd5709
Add test cases for the static inline functions in <cryb/endian.h>.
2014-12-29 14:20:28 +00:00
Dag-Erling Smørgrav
3e3d1f8084
Ignore test.cov
2014-12-29 13:38:32 +00:00
Dag-Erling Smørgrav
0dae3b2417
Test string_equal() using the same test cases as for string_compare().
...
Improve test case descriptions.
2014-12-29 13:36:06 +00:00
Dag-Erling Smørgrav
e20e76a3f7
Recognize "on" and "off".
2014-12-29 13:25:44 +00:00
Dag-Erling Smørgrav
82e32027af
Move the decision of whether to check for memory leaks from the malloc()
...
code to the driver and allow an environment variable to override the
default (on unless coverage is enabled).
2014-12-29 13:24:44 +00:00
Dag-Erling Smørgrav
56eccb99fe
Add two utility functions which check if a string contains something that
...
can be interpreted as either true or false. Use this instead of a basic
non-NULL test for the CRYB_PERFTEST check.
2014-12-29 13:22:53 +00:00
Dag-Erling Smørgrav
559f6c24f7
Fix off-by-one error in TAP output: the test case number was being
...
incremented (converted from zero-based to one-based) twice.
2014-12-29 13:03:08 +00:00