-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added testContentsFrom and testContentsReversedFrom test cases
- Loading branch information
Showing
4 changed files
with
65 additions
and
1 deletion.
There are no files selected for viewing
1 change: 0 additions & 1 deletion
1
...ory/RediStick-Stream-Objects-Tests.package/RsRedisStreamTest.class/instance/testComing.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...diStick-Stream-Objects-Tests.package/RsRedisStreamTest.class/instance/testContentsFrom.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
tests | ||
testContentsFrom | ||
| strm conts fifteen fifteenToLast seventeen fifteenToSeventeen eighteenToLast | | ||
strm := self newStreamNamed: 'testContentsFrom'. | ||
strm trimTo: 0. | ||
self assert: strm length equals: 0. | ||
1 to: 20 do: [ :idx | | ||
strm nextPut: idx -> idx. | ||
]. | ||
conts := strm contents. | ||
self assert: conts size equals: 20. | ||
fifteen := conts at: 15. | ||
fifteenToLast := strm contentsFrom: fifteen id. | ||
|
||
self assert: fifteenToLast size equals: 6. | ||
self assert: conts last content equals: fifteenToLast last content. | ||
|
||
seventeen := conts at: 17. | ||
fifteenToSeventeen := strm contentsFrom: fifteen id to: seventeen id. | ||
|
||
self assert: fifteenToSeventeen size equals: 3. | ||
self assert: fifteenToLast first content equals: fifteenToSeventeen first content. | ||
|
||
self assert: (strm contentAt: seventeen id) content equals: '17'->'17'. | ||
|
||
eighteenToLast := strm contentsNextFrom: seventeen id count: 3. | ||
self assert: eighteenToLast size equals: 3. | ||
self assert: conts last content equals: eighteenToLast last content. | ||
|
||
strm trimTo: 0. | ||
self assert: strm length equals: 0 |
31 changes: 31 additions & 0 deletions
31
...Stream-Objects-Tests.package/RsRedisStreamTest.class/instance/testContentsReversedFrom.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
tests | ||
testContentsReversedFrom | ||
| strm conts fifteen fifteenToFirst seventeen seventeenToFifteen sixteenToFifteen | | ||
strm := self newStreamNamed: 'testContentsReversedFrom'. | ||
strm trimTo: 0. | ||
self assert: strm length equals: 0. | ||
1 to: 20 do: [ :idx | | ||
strm nextPut: idx -> idx. | ||
]. | ||
conts := strm contentsReversed. | ||
self assert: conts size equals: 20. | ||
fifteen := conts at: 6. | ||
fifteenToFirst := strm contentsReversedFrom: fifteen id. | ||
|
||
self assert: fifteenToFirst size equals: 15. | ||
self assert: conts last content equals: fifteenToFirst last content. | ||
|
||
seventeen := conts at: 4. | ||
seventeenToFifteen := strm contentsReversedFrom: seventeen id to: fifteen id. | ||
|
||
self assert: seventeenToFifteen size equals: 3. | ||
self assert: fifteenToFirst first content equals: seventeenToFifteen last content. | ||
|
||
self assert: (strm contentAt: seventeen id) content equals: '17'->'17'. | ||
|
||
sixteenToFifteen := strm contentsReversedNextFrom: seventeen id count: 2. | ||
self assert: sixteenToFifteen size equals: 2. | ||
self assert: fifteenToFirst first content equals: sixteenToFifteen last content. | ||
|
||
strm trimTo: 0. | ||
self assert: strm length equals: 0 |
3 changes: 3 additions & 0 deletions
3
repository/RediStick-Stream-Objects.package/RsStream.class/instance/contentsReversedFrom..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
reading | ||
contentsReversedFrom: fromMessageId | ||
^ self contentsReversedFrom: fromMessageId to: RsStreamMessageId min |