mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-19 16:40:26 +02:00
Pointer subtraction using stride instead of size
This commit is contained in:
parent
357f29f94a
commit
200bb6453c
3 changed files with 30 additions and 1 deletions
|
@ -134,9 +134,24 @@ namespace Tests
|
|||
Test.Assert(!(1..<3).Contains(1..<4));
|
||||
|
||||
List<int> iList = scope .() { 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 };
|
||||
int itrCount = 0;
|
||||
total = 0;
|
||||
for (int i in iList[...])
|
||||
{
|
||||
itrCount++;
|
||||
total += i;
|
||||
}
|
||||
Test.Assert(itrCount == 10);
|
||||
Test.Assert(total == 10+20+30+40+50+60+70+80+90+100);
|
||||
|
||||
total = 0;
|
||||
itrCount = 0;
|
||||
for (int i in iList[...].Reversed)
|
||||
{
|
||||
itrCount++;
|
||||
total += i;
|
||||
}
|
||||
Test.Assert(itrCount == 10);
|
||||
Test.Assert(total == 10+20+30+40+50+60+70+80+90+100);
|
||||
|
||||
total = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue