Skip to content

Commit

Permalink
FIX: union/skip not working correctly in some cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Oldes committed Sep 22, 2022
1 parent eabca3e commit 07e09a2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/t-map.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@

// Append new value the target series:
if (mode > 1) {
hashes[hash] = SERIES_TAIL(series)+1;
hashes[hash] = (SERIES_TAIL(series) / wide) +1;
//Debug_Num("hash:", hashes[hash]);
Append_Series(series, (REBYTE*)key, wide);
//Dump_Series(series, "hash");
Expand Down
9 changes: 9 additions & 0 deletions src/tests/units/series-test.r3
Original file line number Diff line number Diff line change
Expand Up @@ -2162,6 +2162,15 @@ Rebol [
--test-- "union with none and unset"
--assert [#[none] #[unset]] = union [#[none]] [#[unset]]

--test-- "union/skip"
;@@ https://github.com/Oldes/Rebol-issues/issues/2520
--assert (union [a 1 b 2] [a 1 b 2] ) == [a 1 b 2]
--assert (union/skip [b 1 b 2] [b 1 b 2] 2 ) == [b 1]
--assert (union/skip [b 1 b 2] [b 2 b 2] 2 ) == [b 1]
--assert (union/skip [b 2 b 2] [b 2 b 2] 2 ) == [b 2]
--assert (union/skip [a 1 b 2] [a 1 b 2] 2 ) == [a 1 b 2]
--assert (union/skip ["a" 1 "b" 2] ["a" 1 "b" 2] 2) == ["a" 1 "b" 2]

--test-- "union/skip with negative skip"
;@@ https://github.com/Oldes/Rebol-issues/issues/736
--assert all [
Expand Down

0 comments on commit 07e09a2

Please sign in to comment.