Fixes the test to actually run `check-contains-char` as well as some issues with that function.
Also fixes similar problems with the `string/conj-char` test.
This changes `vector/_replacefirst` to just return the original vector if the value that will be replaced was not found. This change was made in order to be more consistent with Clojush.
This adds tests for `vector/_replace`.
We might want to change `vector/_replace` to return `:ignore-instruction` when the value to be replaced is not present in the vector. Same with `vector/_remove`.
Similar to `vector/_first` and `vector/_last`, `vector/_nth` would not check for the case of an empty vector and would divide by 0. This changes the instruction so that it simply throws `:ignore-instruction` in that case.
This adds tests for `vector/_length`.
Also moves the tests for `vector/_indexof` higher in the file in order to be more consistent with the ordering in `vector.cljc`.
This adds tests for `vector/_conj`.
Also moves the tests for `vector/_concat` towards the top of the file to be more consistent with the order in `vector.cljc`.
This moved the new `gen-specs` macro to the top of the file, and uses it to simplify the generation for the existing specifications. This allowed us to remove quite a lot of code.
We also had to change the order of arguments for all the "old" check functions so that `value-type` comes first. We renamed a few check functions so the naming is more consistent.
This add `gen-spec` which provides a fairly general macro for creating `test.check` specifications for vector instructions. It takes a string used to generate specification names, a function used to check the state after running the function under test, and a list of keywords indicating types for arguments generated by `test.check` and passed to the check function.
Keywords like `:integer` and `:string` are associated with "simple" generators such as `gen/small-integer` and `gen/string`. The keyword `:vector` is used to generate a vector of items whose type is specified by the `generator` argument to `generator-for-arg-type`. This allows us to loop over all of the supported vector item types in the macro and generate a separate specification for each type.
We moved the `value-type` argument for the `check` functions to the front to simplify passing in the value type arguments, which can vary in number.
The specs for `vector/_emptyvector`, `vector/_first`, and `vector/_last` all called `prop/for-all` within their 'check' functions, whereas the other specs all called it within their macros. This change makes the three specs mentioned more consistent with the rest of the specs by having them also call `prop/for-all` within their macros.
This introduces some fancy macro action that allows us to skip the four calls to `(concat-spec …)` with the different generators and types.
@ErikRauer and I wrestled with this for a _long_ time today, and it turned out that it was absolutely necessary to quote the generators in `gen-type-pairs on lines 10-13. I'm not 100% sure why, but it seems that without that something (perhaps a level of macro-ness) got unwrapped too early and then it couldn't find the generator because it had lost the namespace it belonged in.
Whether this actually _simplifies_ things is really up for debate. If this is as far as we get, it's probably not worth it. If we can find a reasonable way to reduce the other sources of duplication, however, it might be worth it?
Similar to `vector/_first`, this didn't check for the empty vector case, so I've changed it to return `:ignore-instruction` in that case.
There's a lot of duplication between `_first` and `_last`, which makes me think there's some refactoring opportunities.
This adds test.check tests for `vector/_last`. This is _really_ similar to `vector/_first` (and the other vector tests), so I think there are definitely ways to extract common logic from these.