summaryrefslogtreecommitdiff
path: root/AK/Tests
AgeCommit message (Collapse)Author
2019-12-29AK: Fix JSON parser crashing when encountering UTF-8Andreas Kling
The mechanism that caches the most recently seen string for each first character was indexing into the cache using a 'char' subscript. Oops!
2019-12-29AK: Add StringView::ends_with functionShannon Booth
2019-12-28AK: Unbreak Tests Makefile. Turns out this newline was effectful :^)Andreas Kling
2019-12-28Build: wrap make invocations with flock(1)joshua stein
Lock each directory before entering it so when using -j, the same dependency isn't built more than once at a time. This doesn't get full -j parallelism though, since one make child will be sitting idle waiting for flock to receive its lock and continue making (which should then do nothing since it will have been built already). Unfortunately there's not much that can be done to fix that since it can't proceed until its dependency is built by another make process.
2019-12-20Build: clean up build system, use one shared Makefilejoshua stein
Allow everything to be built from the top level directory with just 'make', cleaned with 'make clean', and installed with 'make install'. Also support these in any particular subdirectory. Specifying 'make VERBOSE=1' will print each ld/g++/etc. command as it runs. Kernel and early host tools (IPCCompiler, etc.) are built as object.host.o so that they don't conflict with other things built with the cross-compiler.
2019-12-09AK: Use size_t for the length of stringsAndreas Kling
Using int was a mistake. This patch changes String, StringImpl, StringView and StringBuilder to use size_t instead of int for lengths. Obviously a lot of code needs to change as a result of this.
2019-12-02AK: StringView::lines() should keep empty linesAndreas Kling
2019-12-02AK: Add a BinarySearch template implementationWilliam McPherson
binary_search takes a haystack, a size, a needle and a compare function. The compare function should return negative if a < b, positive if a > b and 0 if a == b. The "sane default" compare function is integral_compare which implements this with subtraction a - b. binary_search returns a pointer to a matching element, NOT necessarily the FIRST matching element. It returns a nullptr if the element was not found. This patch includes tests for binary_search.
2019-12-02LibMarkdown: Handle CRLF line endingsTommy Nguyen
Previously, MDDocument only split on Unix-style line endings. This adds a new function to StringView which handles LF, CR and CRLF.
2019-11-09HackStudio: Start fleshing out the GUI for a GUI designer :^)Andreas Kling
I'll be reconstructing parts of the VisualBuilder application here and then we can retire VisualBuilder entirely once all the functionality is available in HackStudio.
2019-11-06AK: Always rebuild unit tests if AK headers changeAndreas Kling
This is a hack to avoid failing AK unit tests because it didn't even try to rebuild.
2019-10-23AK: Make it possible to store complex types in a CircularQueueAndreas Kling
Previously we would not run destructors for items in a CircularQueue, which would lead to memory leaks. This patch fixes that, and also adds a basic unit test for the class.
2019-10-21URL: Unbreak the serialization testAndreas Kling
http:// URLs no longer include ":80" when serialized, since port 80 is implied by the protocol. Non-standard ports are still serialized.
2019-10-12AK: Add Atomic.hTom
Use gcc built-in atomics
2019-10-01AK: Remove empty files JsonArray.cpp and JsonObject.cppAndreas Kling
2019-09-13Revert "AK: Made Strings reversible"Andreas Kling
This reverts commit 26e81ad574d463faee19f5973108f80d0e02aaf6. We forgot to consider UTF-8 here. String is UTF-8 and we need to be careful about things like this.
2019-09-13AK: Made Strings reversibleJesse Buhagiar
`AK::String` can now be reversed via AK::String::reverse(). This makes life a lot easier for functions like `itoa()`, where the output ends up being backwards. Very much not like the normal STL (which requires an `std::reverse` object) way of doing things. A call to reverse returns a new `AK::String` so as to not upset any of the possible references to the same `StringImpl` shared between Strings.
2019-09-13TestStringView: Add test for starts_withMinusGix
2019-09-06AK: Rename <AK/AKString.h> to <AK/String.h>Andreas Kling
This was a workaround to be able to build on case-insensitive file systems where it might get confused about <string.h> vs <String.h>. Let's just not support building that way, so String.h can have an objectively nicer name. :^)
2019-08-28AK: Add a Utf8View type for iterating over UTF-8 codepointsSergey Bugaev
Utf8View wraps a StringView and implements begin() and end() that return a Utf8CodepointIterator, which parses UTF-8-encoded Unicode codepoints and returns them as 32-bit integers. This is the first step towards supporting emojis in Serenity ^) https://github.com/SerenityOS/serenity/issues/490
2019-08-23AK: Make FileSystemPath better at handling relative pathsAndreas Kling
Relative paths now canonicalize into a string starting with "./" Previously, "foo" would be canonicalized as "/foo" which was clearly not right.
2019-08-15StringView: Add StringView::operator==(StringView)Andreas Kling
Previously we'd implicitly convert the second StringView to a String when comparing two StringViews, which is obviously not what we wanted.
2019-08-14JsonParser: "" is an empty string, not a null valueAndreas Kling
2019-08-14AK: Make it possible to use HashMap<K, NonnullOwnPtr>::get()Andreas Kling
Add the concept of a PeekType to Traits<T>. This is the type we'll return (wrapped in an Optional) from HashMap::get(). The PeekType for OwnPtr<T> and NonnullOwnPtr<T> is const T*, which means that HashMap::get() will return an Optional<const T*> for maps-of-those.
2019-08-14OwnPtr: Add a way to turn an OwnPtr into a NonnullOwnPtrAndreas Kling
Okay, so, OwnPtr<T>::release_nonnull() returns a NonnullOwnPtr<T>. It assumes that the OwnPtr is non-null to begin with. Note that this removes the value from the OwnPtr, as there can only be a single owner.
2019-08-12Vector: Use memcpy to implement remove() for trivial typesAndreas Kling
This is a lot faster than the generic code path. Also added some unit testing for this.
2019-08-10AK: Add a basic URL class to help us handle URL'sAndreas Kling
We're gonna need these as we start to write more networking programs.
2019-08-07AK: Add a basic unit test for FileSystemPathAndreas Kling
Just to make sure that things are on the up-and-up.
2019-08-07Vector: Add a test for growing a Vector beyond its inline capacityAndreas Kling
2019-08-07AK: Add a FixedArray<T> containerAndreas Kling
This is a simple array wrapper that knows its size. It has begin/end so you can use range-for. It also has a resize() that reallocates.
2019-08-07Vector: Use TypedTransfer in more parts of VectorAndreas Kling
Make more Vector-of-trivial-type operations go fast :^)
2019-08-07Vector: Use memcmp for comparing two vectors with trivial elementsAndreas Kling
2019-08-05AK: Fix leak in Optional(Optional&&)Andreas Kling
We were *copying* the other Optional's value and then marking it as not having a value. This prevented us from ever destroying the original.
2019-08-05AK: Optional::operator=(Optional&&) should clear movee's has_value bitAndreas Kling
We were forgetting to clear m_has_value in the Optional being moved from when using operator=(Optional&&).
2019-08-04AK: Add a benchmark for parsing 4chan catalog JSONAndreas Kling
I was able to get parsing time down to about 1/3 of the original time by using callgrind+kcachegrind. There's definitely more improvements that can be made here, but I'm gonna be happy with this for now. :^)
2019-08-02AK: Fix ref leaks in RefPtr assignment operators.Andreas Kling
Many of the RefPtr assignment operators would cause ref leaks when we call them to assign a pointer that's already the one kept.
2019-08-02AK: Fix ref leak in NonnullRefPtr::operator=(T&).Andreas Kling
We would leak a ref when assigning a T& to a NonnullRefPtr that already contains that same T.
2019-08-02AK: Add a test for iterating a HashTable during clear (should assert)Andreas Kling
Ideally we should also verify that the assertion actually happens, but we need some support in the TestSuite framework for that.
2019-08-02TestSuite: Hijack the ASSERT macros during unit tests.Andreas Kling
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-02AK: Fix typo in the WeakPtr test. Behavior was actually correct.Andreas Kling
Also remove an unused variable.
2019-08-02AK: Fix typo in TestVector.cpp, oops.Andreas Kling
2019-08-01AK: Use Vector::empend() a bit in the unit tests, and fix a bug.Andreas Kling
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-07-21AK: Run host tests on makeRobin Burchell
Restructure the makefile a little so it only builds objects once, and then run them on make clean. This is a little slower (since we're relinking tests each makeall), but it also ensures that it will work.
2019-07-21AK: Add a unit test for Vector::prepend(Vector&&) with complex T.Andreas Kling
It's good to verify that complex objects can be moved nicely by Vector.
2019-07-21AK: Add some basic unit tests for WeakPtr.Andreas Kling
2019-07-20AK: Add Vector::prepend(Vector&&).Andreas Kling
Also included a good boy unit test.
2019-07-16AK: Add a new TestSuite.h from my own work, adapted to match the existing ↵Robin Burchell
one a bit This gives a few new features: * benchmarks * the ability to run individual testcases easily * timing of tests
2019-07-13AK: Support case-insensitive HashMap<String, T>.Andreas Kling
We achieve this by allowing you to specify custom traits for the key type. For convenience, we also provide a CaseInsensitiveStringTraits for String.
2019-07-11AKString: add missing comparison operatorsLawrence Manning
And some trivial tests.
2019-07-04AK: Add Vector::insert_before_matching(T&&, callback);Andreas Kling
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.