1
0
Fork 0
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:
Brian Fiete 2023-03-01 05:41:20 -05:00
parent 357f29f94a
commit 200bb6453c
3 changed files with 30 additions and 1 deletions

View file

@ -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;