Changeset 71f713a in mainline


Ignore:
Timestamp:
2018-07-05T21:41:24Z (6 years ago)
Author:
Dzejrou <dzejrou@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d9a9e7b
Parents:
1668862
git-author:
Dzejrou <dzejrou@…> (2018-05-18 17:44:19)
git-committer:
Dzejrou <dzejrou@…> (2018-07-05 21:41:24)
Message:

cpp: finished non-modifying algorithm tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/cpp/src/__bits/test/algorithm.cpp

    r1668862 r71f713a  
    142142        );
    143143        test_eq("count_if", res13, 4);
     144
     145        std::array<int, 6> data4{1, 2, 3, 4, 5, 6};
     146        std::array<int, 6> data5{1, 2, 3, 4, 6, 5};
     147        auto res14 = std::mismatch(
     148            data4.begin(), data4.end(),
     149            data5.begin(), data5.end()
     150        );
     151
     152        test_eq("mismatch pt1", res14.first, &data4[4]);
     153        test_eq("mismatch pt2", res14.second, &data5[4]);
     154
     155        auto res15 = std::equal(
     156            data4.begin(), data4.end(),
     157            data4.begin(), data4.end()
     158        );
     159        test("equal pt1", res15);
     160
     161        auto res16 = std::equal(
     162            data4.begin(), data4.end(),
     163            data5.begin(), data5.end()
     164        );
     165        test("equal pt2", !res16);
     166
     167        auto res17 = std::equal(
     168            data4.begin(), data4.end(),
     169            data4.begin(), data4.end(),
     170            [](auto lhs, auto rhs){
     171                return lhs == rhs;
     172            }
     173        );
     174        test("equal pt3", res17);
     175
     176        auto res18 = std::equal(
     177            data4.begin(), data4.end(),
     178            data5.begin(), data5.end(),
     179            [](auto lhs, auto rhs){
     180                return lhs == rhs;
     181            }
     182        );
     183        test("equal pt4", !res18);
     184
     185        // TODO: is_permutation, search
    144186    }
    145187}
Note: See TracChangeset for help on using the changeset viewer.