Commit graph

9 commits

Author SHA1 Message Date
Andreas Kling e8e85f5457 Vector: Use memcmp for comparing two vectors with trivial elements 2019-08-07 15:05:10 +02:00
Andreas Kling 6560116b67 TestSuite: Hijack the ASSERT macros during unit tests.
Instead of aborting the program when we hit an assertion, just print a
message and keep going.

This allows us to write tests that provoke assertions on purpose.
2019-08-02 09:23:03 +02:00
Andreas Kling 4e59300650 AK: Fix typo in TestVector.cpp, oops. 2019-08-02 08:59:26 +02:00
Andreas Kling 9230b42f28 AK: Use Vector::empend() a bit in the unit tests, and fix a bug.
There was a bug in the "prepend_vector_object" test but it was masked
by us not printing failures. (The bug was that we were adding three
elements to the "objects" vector and then checking that another
vector called "more_objects" indeed had three elements. Oops!)
2019-08-01 16:24:31 +02:00
Andreas Kling aeae1cb5e2 AK: Add a unit test for Vector::prepend(Vector&&) with complex T.
It's good to verify that complex objects can be moved nicely by Vector.
2019-07-21 11:35:41 +02:00
Andreas Kling 67654ec529 AK: Add Vector::prepend(Vector&&).
Also included a good boy unit test.
2019-07-20 16:10:52 +02:00
Robin Burchell 41d2c674d7 AK: Add a new TestSuite.h from my own work, adapted to match the existing one a bit
This gives a few new features:

* benchmarks
* the ability to run individual testcases easily
* timing of tests
2019-07-16 11:03:38 +02:00
Andreas Kling 55a5c46253 AK: Add Vector::insert_before_matching(T&&, callback);
This allows you to do things like:

vector.insert_before_matching(value, [](auto& entry) {
    return value < entry;
});

Basically it scans until it finds an element that matches the condition
callback and then inserts the new value before the matching element.
2019-07-04 14:20:48 +02:00
Andreas Kling 50700c107f AK: Get rid of ConstVectorIterator.
We can achieve the same with just a VectorIterator<const Vector, const T>.
2019-06-27 14:52:12 +02:00