Skip to content

Commit

Permalink
tests upd
Browse files Browse the repository at this point in the history
  • Loading branch information
Smoren committed Mar 10, 2024
1 parent 7c8387c commit e743191
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ $originalView = ArrayView::toView($originalArray);
$originalView.subview(new MaskSelector([true, false, true, false, true])).toArray(); // [1, 3, 5]
$originalView.subview(new IndexListSelector([1, 2, 4])).toArray(); // [2, 3, 5]
$originalView.subview(new SliceSelector('::-1')).toArray(); // [5, 4, 3, 2, 1]
$originalView.subview('::-1').toArray(); // [5, 4, 3, 2, 1]

$originalView.subview(new MaskSelector([true, false, true, false, true])).apply(fn ($x) => x * 10);
print_r(originalArray); // [10, 2, 30, 4, 50]
Expand Down
4 changes: 4 additions & 0 deletions tests/unit/Examples/ExamplesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ public function testSubview()
[5, 4, 3, 2, 1],
$originalView->subview(new SliceSelector('::-1'))->toArray(),
);
$this->assertSame(
[5, 4, 3, 2, 1],
$originalView->subview('::-1')->toArray(),
);

$originalView->subview(new MaskSelector([true, false, true, false, true]))
->apply(fn(int $x) => $x * 10);
Expand Down

0 comments on commit e743191

Please sign in to comment.