You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1022 B
33 lines
1022 B
#include "gtest/gtest.h"
|
|
#include "storm-config.h"
|
|
#include "src/storage/BitVector.h"
|
|
#include "src/utility/vector.h"
|
|
|
|
TEST(VectorTest, sum_if) {
|
|
std::vector<double> a = {1.0, 2.0, 4.0, 8.0, 16.0};
|
|
storm::storage::BitVector f1(5, {2,4});
|
|
storm::storage::BitVector f2(5, {3,4});
|
|
|
|
ASSERT_EQ(20.0, storm::utility::vector::sum_if(a, f1));
|
|
ASSERT_EQ(24.0, storm::utility::vector::sum_if(a, f2));
|
|
|
|
}
|
|
|
|
TEST(VectorTest, max_if) {
|
|
std::vector<double> a = {1.0, 2.0, 34.0, 8.0, 16.0};
|
|
storm::storage::BitVector f1(5, {2,4});
|
|
storm::storage::BitVector f2(5, {3,4});
|
|
|
|
ASSERT_EQ(34.0, storm::utility::vector::max_if(a, f1));
|
|
ASSERT_EQ(16.0, storm::utility::vector::max_if(a, f2));
|
|
}
|
|
|
|
|
|
TEST(VectorTest, min_if) {
|
|
std::vector<double> a = {1.0, 2.0, 34.0, 8.0, 16.0};
|
|
storm::storage::BitVector f1(5, {2,4});
|
|
storm::storage::BitVector f2(5, {3,4});
|
|
|
|
ASSERT_EQ(16.0, storm::utility::vector::min_if(a, f1));
|
|
ASSERT_EQ(8.0, storm::utility::vector::min_if(a, f2));
|
|
}
|