00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 #include <iostream>
00027 
00028 #include <mln/value/builtin/integers.hh>
00029 
00030 #include <mln/accu/tuple.hh>
00031 
00032 #include <mln/accu/math/count.hh>
00033 #include <mln/accu/stat/max.hh>
00034 #include <mln/accu/stat/min.hh>
00035 #include <mln/accu/stat/mean.hh>
00036 
00037 
00038 int main()
00039 {
00040   using namespace mln;
00041 
00042   typedef accu::tuple<int, 4, accu::math::count<int>, accu::stat::max<int>, accu::stat::min<int>, accu::stat::mean<int> > teratuple;
00043 
00044   teratuple tuple1;
00045   teratuple tuple2;
00046 
00047   int i1 = 7;
00048   int i2 = 1;
00049   int i3 = 12;
00050   int i4 = -5;
00051   int i5 = -7;
00052   int i6 = 14;
00053 
00054   tuple1.take_as_init(i1);
00055   tuple1.take(i2);
00056   tuple1.take(i3);
00057   tuple1.take(i4);
00058 
00059   tuple2.take_as_init(i5);
00060   tuple2.take(i6);
00061 
00062   tuple1.take(tuple2);
00063   boost::tuple<unsigned, int, int, float> res1 = tuple1.to_result();
00064 
00065   mln_assertion(6 == res1.get<0>());
00066   mln_assertion(14 == res1.get<1>());
00067   mln_assertion(-7 == res1.get<2>());
00068   mln_assertion(res1.get<3>() - 3.66 < 0.1);
00069 }