version 1.0.0-rc.24
This commit is contained in:
24
tests/AutoIncrVectorTest.cpp
Normal file
24
tests/AutoIncrVectorTest.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
// Copyright (2019-2024) Paul Scherrer Institute
|
||||
|
||||
#include <catch2/catch_all.hpp>
|
||||
#include "../common/AutoIncrVector.h"
|
||||
|
||||
TEST_CASE("AutoIncrVector","[AutoIncrVector]") {
|
||||
AutoIncrVector<int64_t> aiv;
|
||||
|
||||
REQUIRE(aiv.size() == 0);
|
||||
|
||||
REQUIRE_NOTHROW(aiv.reserve(500));
|
||||
REQUIRE_THROWS(aiv.reserve(-5));
|
||||
|
||||
REQUIRE_THROWS(aiv[-5] = 1);
|
||||
REQUIRE_NOTHROW(aiv[5] = 1);
|
||||
REQUIRE(aiv.size() == 6);
|
||||
REQUIRE(aiv[4] == 0);
|
||||
REQUIRE(aiv[5] == 1);
|
||||
|
||||
const auto &ref = aiv;
|
||||
|
||||
REQUIRE(ref[5] == 1);
|
||||
REQUIRE_THROWS(ref[6]);
|
||||
}
|
||||
Reference in New Issue
Block a user