summaryrefslogtreecommitdiff
path: root/AK/Tests
AgeCommit message (Collapse)Author
2020-04-14AK: Add a little test for String::split()Andreas Kling
Just to verify that the parts are all null-terminated.
2020-04-12AK: Parse query and fragment in URL::parse()Linus Groh
2020-04-03AK: Remove relative path in AK testsuiteEmanuel Sprung
With relative filenames in the executable code, the executable is basically not relocatable. This makes out-of-source builds unneccesery hard. This patchset moves the relative link into the filesystem: that can be handled much easier :^)
2020-04-01AK: Add String::replace() functionalityEmanuel Sprung
This adds a replace functionality that replaces a string that contains occurences of a "needle" by a "replacement" value. With "all_occurences" enabled, all occurences are being replaced, otherwise only the first occurence is being replaced.
2020-03-22AK: Add FlyString, a simple flyweight string classAndreas Kling
FlyString is a flyweight string class that wraps a RefPtr<StringImpl> known to be unique among the set of FlyStrings. The class is very unoptimized at the moment. When to use FlyString: - When you want O(1) string comparison - When you want to deduplicate a lot of identical strings When not to use FlyString: - For strings that don't need either of the above features - For strings that are likely to be unique
2020-03-08AK: Remove all the AK .host.o files on "make clean" in AK/TestsAndreas Kling
This is a bit hackish, but sometimes these files stick around and mess up rebuilds.
2020-03-06AK: Fix all the warnings in the AK testsAndreas Kling
2020-03-02Meta: Adjust some copyright dates by Fei WuAndreas Kling
2020-03-02AK: Move to_int(), to_uint() implementations to StringUtils (#1338)howar6hill
Provide wrappers in String and StringView. Add some tests for the implementations.
2020-03-02AK: Move the wildcard-matching implementation to StringUtilshowar6hill
Provide wrappers in the String and StringView classes, and add some tests.
2020-03-02AK: Add enqueue_begin() for the CircularDeque class (#1320)howar6hill
Also add tests for CircularDeque.
2020-02-27Tests: Fix a typo inTestRefPtrhowar6hill
2020-02-22AK: Add StringView::starts_with(char) & StringView::ends_with(char)Shannon Booth
This is simply meant to be a more efficient implementation in the case that we only need to check a single character.
2020-02-15AK: Add String starts_with(char) & ends_with(char)Shannon Booth
This is simply meant to be a more efficient implementation in the case that we only need to check a single character.
2020-01-24Meta: Claim copyright for files created by meSergey Bugaev
This changes copyright holder to myself for the source code files that I've created or have (almost) completely rewritten. Not included are the files that were significantly changed by others even though it was me who originally created them (think HtmlView), or the many other files I've contributed code to.
2020-01-23AK: Let's call decrementing reference counts "unref" instead of "deref"Andreas Kling
It always bothered me that we're using the overloaded "dereference" term for this. Let's call it "unreference" instead. :^)
2020-01-19AK: Teach Vector::insert() to use memmove() for trivial typesAndreas Kling
2020-01-19AK: Make it possible to swap() a NonnullRefPtr with itselfAndreas Kling
The generic swap() is not able to swap a NonnullRefPtr with itself, due to its use of a temporary and NonnullRefPtr asserting when trying to move() from an already move()'d instance.
2020-01-18AK: NonnullRefPtr should allow assigning owner to owneeAndreas Kling
Given the following situation: struct Object : public RefCounted<Object> { RefPtr<Object> parent; } NonnullRefPtr<Object> object = get_some_object(); object = *object->parent; We would previously crash if 'object' was the only strongly referencing pointer to 'parent'. This happened because NonnullRefPtr would unref the outgoing pointee before reffing the incoming pointee. This patch fixes that by implementing NonnullRefPtr assignments using pointer swaps, just like RefPtr already did.
2020-01-18Meta: Add license header to source filesAndreas Kling
As suggested by Joshua, this commit adds the 2-clause BSD license as a comment block to the top of every source file. For the first pass, I've just added myself for simplicity. I encourage everyone to add themselves as copyright holders of any file they've added or modified in some significant way. If I've added myself in error somewhere, feel free to replace it with the appropriate copyright holder instead. Going forward, all new source files should include a license header.
2020-01-06AK: Fix test compile warningsShannon Booth
These warnings are pretty harmless, but warnings nonetheless.
2020-01-02Build: HOST_CXX -> USE_HOST_CXXjoshua stein
Allow HOST_CXX to be passed to make which will be the actual host C++ compiler used, such as 'make HOST_CXX=clang++'.
2020-01-01Build: AK/Tests: use Makefile.commonjoshua stein
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.