Ignore:
Timestamp:
Mar 29, 2026, 9:52:51 PM (3 days ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
e6e250d
Parents:
00675ed4
Message:

2nd attempt at harmonizing isOp functions, e.g., isEmpty, to C/C++ form empty

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/list/dlist-insert-remove.cfa

    r00675ed4 r81ab5eb  
    14361436// Section 4g
    14371437//
    1438 // Test cases of isEmpty, isFirst, isLast,
     1438// Test cases of empty, isFirst, isLast,
    14391439// remove_first, remove_last, modifications via iter
    14401440//
     
    14491449        mary m3 = {3.7};
    14501450
    1451         dlist(mary) ml;                 assert( isEmpty( ml ));
    1452 
    1453         insert_last(ml, m1);    assert(!isEmpty( ml ));
    1454         insert_last(ml, m2);    assert(!isEmpty( ml ));
    1455         insert_last(ml, m3);    assert(!isEmpty( ml ));
     1451        dlist(mary) ml;                 assert(empty( ml ));
     1452
     1453        insert_last(ml, m1);    assert(!empty( ml ));
     1454        insert_last(ml, m2);    assert(!empty( ml ));
     1455        insert_last(ml, m3);    assert(!empty( ml ));
    14561456
    14571457        mary & m1prev = prev( m1 );
     
    14941494        // queue, back to front
    14951495
    1496         assert( isEmpty( ml ));
     1496        assert(empty( ml ));
    14971497
    14981498        insert_last(ml, m1);
     
    15001500        insert_last(ml, m3);
    15011501
    1502         &m1r = & remove_first(ml);      assert(!isEmpty( ml ));
    1503         &m2r = & remove_first(ml);      assert(!isEmpty( ml ));
    1504         &m3r = & remove_first(ml);      assert( isEmpty( ml ));
    1505         &mxr = & remove_first(ml);      assert( isEmpty( ml ));
     1502        &m1r = & remove_first(ml);      assert(!empty( ml ));
     1503        &m2r = & remove_first(ml);      assert(!empty( ml ));
     1504        &m3r = & remove_first(ml);      assert(empty( ml ));
     1505        &mxr = & remove_first(ml);      assert(empty( ml ));
    15061506
    15071507        assert( &m1r == &m1 );
     
    15161516        // queue, front to back
    15171517
    1518         assert( isEmpty( ml ));
     1518        assert(empty( ml ));
    15191519
    15201520        insert_first(ml, m1);
     
    15221522        insert_first(ml, m3);
    15231523
    1524         &m1r = & remove_last(ml);       assert(!isEmpty( ml ));
    1525         &m2r = & remove_last(ml);       assert(!isEmpty( ml ));
    1526         &m3r = & remove_last(ml);       assert( isEmpty( ml ));
    1527         &mxr = & remove_last(ml);       assert( isEmpty( ml ));
     1524        &m1r = & remove_last(ml);       assert(!empty( ml ));
     1525        &m2r = & remove_last(ml);       assert(!empty( ml ));
     1526        &m3r = & remove_last(ml);       assert(empty( ml ));
     1527        &mxr = & remove_last(ml);       assert(empty( ml ));
    15281528
    15291529        assert( &m1r == &m1 );
     
    15381538        // stack at front
    15391539
    1540         assert( isEmpty( ml ));
     1540        assert(empty( ml ));
    15411541
    15421542        insert_first(ml, m1);
     
    15441544        insert_first(ml, m3);
    15451545
    1546         &m3r = & remove_first(ml);      assert(!isEmpty( ml ));
    1547         &m2r = & remove_first(ml);      assert(!isEmpty( ml ));
    1548         &m1r = & remove_first(ml);      assert( isEmpty( ml ));
    1549         &mxr = & remove_first(ml);      assert( isEmpty( ml ));
     1546        &m3r = & remove_first(ml);      assert(!empty( ml ));
     1547        &m2r = & remove_first(ml);      assert(!empty( ml ));
     1548        &m1r = & remove_first(ml);      assert(empty( ml ));
     1549        &mxr = & remove_first(ml);      assert(empty( ml ));
    15501550
    15511551        assert( &m1r == &m1 );
     
    15601560        // stack at back
    15611561
    1562         assert( isEmpty( ml ));
     1562        assert(empty( ml ));
    15631563
    15641564        insert_last(ml, m1);
     
    15661566        insert_last(ml, m3);
    15671567
    1568         &m3r = & remove_last(ml);       assert(!isEmpty( ml ));
    1569         &m2r = & remove_last(ml);       assert(!isEmpty( ml ));
    1570         &m1r = & remove_last(ml);       assert( isEmpty( ml ));
    1571         &mxr = & remove_last(ml);       assert( isEmpty( ml ));
     1568        &m3r = & remove_last(ml);       assert(!empty( ml ));
     1569        &m2r = & remove_last(ml);       assert(!empty( ml ));
     1570        &m1r = & remove_last(ml);       assert(empty( ml ));
     1571        &mxr = & remove_last(ml);       assert(empty( ml ));
    15721572
    15731573        assert( &m1r == &m1 );
     
    15931593
    15941594        insert_before( iter( ml ), m1 );
    1595         assert( ! isEmpty( ml ) );
     1595        assert( !empty( ml ) );
    15961596
    15971597        mary & mlfirst = first( ml );
Note: See TracChangeset for help on using the changeset viewer.