Changeset d93f01a6 in mainline


Ignore:
Timestamp:
2018-07-05T21:41:20Z (6 years ago)
Author:
Dzejrou <dzejrou@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9475faf
Parents:
c06328da
git-author:
Dzejrou <dzejrou@…> (2018-04-07 15:01:43)
git-committer:
Dzejrou <dzejrou@…> (2018-07-05 21:41:20)
Message:

cpp: improved array and vector tests

Location:
uspace/lib/cpp
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/cpp/include/internal/test/test.hpp

    rc06328da rd93f01a6  
    7171            }
    7272
    73             template<class T>
    74             bool assert_eq(const T& lhs, const T& rhs)
     73            template<class T, class U>
     74            bool assert_eq(const T& lhs, const U& rhs)
    7575            {
    7676                return lhs == rhs;
  • uspace/lib/cpp/src/internal/test/array.cpp

    rc06328da rd93f01a6  
    101101        // TODO: test bound checking of at when implemented
    102102
     103        std::array<int, 3> arr4{1, 2, 3};
     104        auto [a, b, c] = arr4;
     105        test_eq("structured binding part 1", a, 1);
     106        test_eq("structured binding part 2", b, 2);
     107        test_eq("structured binding part 3", c, 3);
     108
    103109        return end();
    104110    }
  • uspace/lib/cpp/src/internal/test/vector.cpp

    rc06328da rd93f01a6  
    121121
    122122        // TODO: move assignment when implemented
     123        std::vector<int> vec10{};
     124        vec10 = std::move(vec9);
     125        test_eq(
     126            "move assignment",
     127            vec10.begin(), vec10.end(),
     128            vec8.begin(), vec8.end()
     129        );
     130
     131        test_eq("move assignment origin empty", vec9.size(), 0);
    123132    }
    124133
Note: See TracChangeset for help on using the changeset viewer.