Fix head and tail check with negative offset in _quicklistInsert (#9311)
Fix head and tail check with negative offset in _quicklistInsert (#9311)

Some background:
This fixes a problem that used to be dead code till now,
but became alive (only in the unit tests, not in redis) when #9113 got merged.
The problem it fixes doesn't actually cause any significant harm,
but that PR also added a test that fails verification because of that.
This test was merged with that problem due to human error, we didn't run it
on the last modified version before merging.
The fix in this PR existed in #8641 (closed because it's just dead code)
and #4674 (still pending but has other changes in it).

Now to the actual fix:
On quicklist insertion, if the insertion offset is -1 or `-(quicklist->count)`,
we can insert into the head of the next node rather than the tail of the
current node. this is especially important when the current node is full,
and adding anything to it will cause it to be split (or be over it's fill limit setting).

The bug was that the code attempted to determine that we're adding to
the tail of the current node by matching `offset == node->count` when in
fact it should have been `offset == node->count-1` (so it never entered that `if`).
and also that since we take negative offsets too, we can also match `-1`.
same applies for the head, i.e. `0` and `-count`.

The bug will cause the code to attempt inserting into the current node (thinking
we have to insert into the middle of the node rather than head or tail), and
in case the current node is full it'll have to be split (something that also
happens in valid cases).
On top of that, since it calls _quicklistSplitNode with an edge case, it'll actually
split the node in a way that all the entries fall into one split, and 0 into the other,
and then still insert the new entry into the first one, causing it to be populated
beyond it's intended fill limit.

This problem does not create any bug in redis, because the existing code does
not iterate from tail to head, and the offset never has a negative value when insert.

The other change this PR makes in the test code is just for some coverage,
insertion at index 0 is tested a lot, so it's nice to test some negative offsets too.
charsyam/redis,soloestoy/redis,soloestoy/redis,soloestoy/redis,neomantra/redis,yossigo/redis,soloestoy/redis,ofirluzon/redis,antirez/redis,yossigo/redis,neomantra/redis,neomantra/redis,oranagra/redis,charsyam/redis,yossigo/redis,PKRoma/redis,ofirluzon/redis,yossigo/redis,antirez/redis,oranagra/redis,ofirluzon/redis,PKRoma/redis,antirez/redis,antirez/redis,PKRoma/redis,neomantra/redis,charsyam/redis,PKRoma/redis,soloestoy/redis,oranagra/redis,oranagra/redis,yossigo/redis,PKRoma/redis,neomantra/redis,ofirluzon/redis,charsyam/redis,charsyam/redis,oranagra/redis,ofirluzon/redis