1 /*
2  * Copyright (C) 1998-2018 ALPS Collaboration. See COPYRIGHT.TXT
3  * All rights reserved. Use is subject to license terms. See LICENSE.TXT
4  * For use in publications, see ACKNOWLEDGE.TXT
5  */
6 
7 #include <alps/config.hpp>
8 #include <alps/accumulators.hpp>
9 #include <iostream>
10 #include "gtest/gtest.h"
11 
TEST(accumulator,nonexistent_acc)12 TEST(accumulator, nonexistent_acc){
13 
14 	alps::accumulators::accumulator_set measurements;
15 	measurements << alps::accumulators::MeanAccumulator<double>("scalar");
16 
17         const alps::accumulators::accumulator_wrapper& null_acc=measurements["this_acc_doesnt_exist"];
18         EXPECT_THROW(null_acc.result(), std::runtime_error);
19         EXPECT_THROW(null_acc.reset(), std::runtime_error);
20         EXPECT_THROW(null_acc.count(), std::runtime_error);
21         EXPECT_THROW(null_acc.mean<double>(), std::runtime_error);
22         EXPECT_THROW(null_acc.error<double>(), std::runtime_error);
23         EXPECT_THROW(null_acc.print(std::cout), std::runtime_error);
24 }
25