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
1.0 KiB

  1. #include "gtest/gtest.h"
  2. #include "storm-config.h"
  3. #include "src/storage/BitVector.h"
  4. #include "src/utility/vector.h"
  5. TEST(VectorTest, sum_if) {
  6. std::vector<double> a = {1.0, 2.0, 4.0, 8.0, 16.0};
  7. storm::storage::BitVector f1(5, {2,4});
  8. storm::storage::BitVector f2(5, {3,4});
  9. ASSERT_EQ(20.0, storm::utility::vector::sum_if(a, f1));
  10. ASSERT_EQ(24.0, storm::utility::vector::sum_if(a, f2));
  11. }
  12. TEST(VectorTest, max_if) {
  13. std::vector<double> a = {1.0, 2.0, 34.0, 8.0, 16.0};
  14. storm::storage::BitVector f1(5, {2,4});
  15. storm::storage::BitVector f2(5, {3,4});
  16. ASSERT_EQ(34.0, storm::utility::vector::max_if(a,f1,0.0));
  17. ASSERT_EQ(16.0, storm::utility::vector::max_if(a,f2,0.0));
  18. }
  19. TEST(VectorTest, min_if) {
  20. std::vector<double> a = {1.0, 2.0, 34.0, 8.0, 16.0};
  21. storm::storage::BitVector f1(5, {2,4});
  22. storm::storage::BitVector f2(5, {3,4});
  23. ASSERT_EQ(16.0, storm::utility::vector::min_if(a,f1,100.0));
  24. ASSERT_EQ(8.0, storm::utility::vector::min_if(a,f2,100.0));
  25. }