Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 58ff673 in mainline


Ignore:
Timestamp:
2018-07-05T21:41:24Z (2 years ago)
Author:
Dzejrou <dzejrou@…>
Branches:
master
Children:
3adbbda
Parents:
9ab4026
git-author:
Dzejrou <dzejrou@…> (2018-05-15 17:58:59)
git-committer:
Dzejrou <dzejrou@…> (2018-07-05 21:41:24)
Message:

cpp: added some simple stack tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/cpp/src/internal/test/adaptors.cpp

    r9ab4026 r58ff673  
    153153
    154154        test_eq(
    155             "priority_queue initialized from iterator range operations",
     155            "priority_queue initialized from iterator range ops",
    156156            check1.begin(), check1.end(),
    157157            aux::priority_queue_iterator<int>{q1},
     
    166166
    167167        q2.push(3);
    168         test_eq("priority_qeueu push pt1", q2.size(), 6U);
    169         test_eq("priority_qeueu push pt2", q2.top(), 1);
     168        test_eq("priority_queue push pt1", q2.size(), 6U);
     169        test_eq("priority_queue push pt2", q2.top(), 1);
    170170
    171171        test_eq(
    172             "priority_queue initialized from vector and compare operations",
     172            "priority_queue initialized from vector and compare ops",
    173173            check2.begin(), check2.end(),
    174174            aux::priority_queue_iterator<int, std::greater<int>>{q2},
     
    179179    void adaptors_test::test_stack()
    180180    {
     181        std::stack<int> s{std::deque<int>{1}};
     182
     183        test_eq("stack initialized from deque top", s.top(), 1);
     184        test_eq("stack initialized from deque size", s.size(), 1U);
     185        test_eq("stack initialized from deque not empty", s.empty(), false);
     186
     187        s.push(2);
     188        test_eq("stack push top", s.top(), 2);
     189        test_eq("stack push size", s.size(), 2U);
     190
     191        s.pop();
     192        test_eq("stack pop top", s.top(), 1);
     193        test_eq("stack pop size", s.size(), 1U);
    181194    }
    182195}
Note: See TracChangeset for help on using the changeset viewer.