IODA Bundle
TestAggregateFunctions3.cc
Go to the documentation of this file.
1
/*
2
* (C) Copyright 1996-2012 ECMWF.
3
*
4
* This software is licensed under the terms of the Apache Licence Version 2.0
5
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6
* In applying this licence, ECMWF does not waive the privileges and immunities
7
* granted to it by virtue of its status as an intergovernmental organisation nor
8
* does it submit to any jurisdiction.
9
*/
10
11
/// \file TestAggregateFunctions3.h
12
///
13
/// @author Piotr Kuchta, ECMWF, September 2010
14
15
#include "eckit/io/FileHandle.h"
16
17
#include "
odc/Select.h
"
18
19
#include "
odc/api/Odb.h
"
20
#include "
TestCase.h
"
21
22
using namespace
std
;
23
using namespace
eckit
;
24
using namespace
odc
;
25
26
static
void
test
()
27
{
28
string
sql =
"select sum(a) from \"TestAggregateFunctions3.odb\";"
;
29
30
Log::info() <<
"Executing: '"
<< sql <<
"'"
<< std::endl;
31
32
odc::Select
sel(sql);
33
odc::Select::iterator
it2 = sel.
begin
();
34
odc::Select::iterator
end2 = sel.
end
();
35
36
ASSERT( (*it2)[0] == 55);
37
}
38
39
static
void
setUp
()
40
{
41
stringstream s;
42
s <<
"a:REAL"
<< std::endl;
43
for
(
size_t
i
= 1;
i
<= 10; ++
i
)
44
s <<
i
<< std::endl;
45
FileHandle dh(
"TestAggregateFunctions3.odb"
);
46
dh.openForWrite(0);
47
AutoClose close(dh);
48
odc::api::odbFromCSV
(s, dh);
49
}
50
51
52
static
void
tearDown
(){}
53
54
SIMPLE_TEST
(AggregateFunctions3)
Odb.h
Select.h
tearDown
static void tearDown()
Definition:
TestAggregateFunctions3.cc:52
test
static void test()
Definition:
TestAggregateFunctions3.cc:26
setUp
static void setUp()
Definition:
TestAggregateFunctions3.cc:39
TestCase.h
SIMPLE_TEST
#define SIMPLE_TEST(name)
Definition:
TestCase.h:66
odc::IteratorProxy< SelectIterator, Select, const double >
odc::Select
Definition:
Select.h:34
odc::Select::end
const iterator end()
Definition:
Select.cc:77
odc::Select::begin
iterator begin()
Definition:
Select.cc:81
eckit
Definition:
DistributionUtils.h:15
odc::api::odbFromCSV
size_t odbFromCSV(DataHandle &dh_in, DataHandle &dh_out, const std::string &delimiter)
odbFromCSV returns number of lines imported
Definition:
Odb.cc:375
odc
Definition:
ColumnInfo.h:23
proc_gsi_ncdiag.i
i
Definition:
proc_gsi_ncdiag.py:155
std
Definition:
encode.cc:30
odc
src
odc
tools
TestAggregateFunctions3.cc
Generated on Fri Aug 20 2021 11:49:11 for IODA Bundle by
1.9.1