Changeset db87a35 for tests/algorithms


Ignore:
Timestamp:
Dec 3, 2021, 3:33:02 PM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
Children:
4c26a94
Parents:
8e658241
Message:

Added more testing of the range iterator.

Location:
tests/algorithms
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tests/algorithms/.expect/range_test.txt

    r8e658241 rdb87a35  
    110 1 2 3 4 5 6
     20
     30 1 2 3 4 5 6 22 23 24 25 26 27 28 29 30
     40 2 4 6 8 10
     50 1 2 3 4 5 6 8 9 10 11 12 13 14 16 32
     60 1 2 3 4 6 8 9 10 11 12 14 16 17 18 19 20
  • tests/algorithms/range_test.cfa

    r8e658241 rdb87a35  
    1717#include <algorithms/range_iterator.hfa>
    1818
     19void print(const char * range){
     20        RangeIter r = { range };
     21        while(moveNext(r)) {
     22                sout | r.com | nonl;
     23        }
     24        sout | nl;
     25}
     26
    1927int main() {
    20         {
    21                 RangeIter r = { "0-6" };
    22                 while(moveNext(r)) {
    23                         sout | r.com | nonl;
    24                 }
    25                 sout | nl;
    26         }
     28        print("0-6");
     29        print("0");
     30        print("0-6,22-30");
     31        print("0,2,4,6,8,10");
     32        print("0-6,8-14,16,32");
     33        print("0-4,6,8-12,14,16-20");
    2734}
Note: See TracChangeset for help on using the changeset viewer.