IODA Bundle
TestFunctionTdiff.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 UnitTest.cc
12
///
13
/// @author ECMWF, July 2010
14
15
//const double EPS = 7e-6
16
17
#include "eckit/log/Timer.h"
18
#include "
odc/Select.h
"
19
20
#include "
odc/Writer.h
"
21
#include "
TestCase.h
"
22
23
using namespace
std
;
24
using namespace
eckit
;
25
using namespace
odc
;
26
27
28
29
static
void
setUp
()
30
{
31
Timer t(
"Test tdiff function"
);
32
odc::Writer<>
oda
(
"test_tdiff.odb"
);
33
34
odc::Writer<>::iterator
row =
oda
.begin();
35
row->
setNumberOfColumns
(2);
36
37
row->
setColumn
(0,
"date"
,
odc::api::INTEGER
);
38
row->
setColumn
(1,
"time"
,
odc::api::INTEGER
);
39
40
row->
writeHeader
();
41
42
(*row)[0] = 20090706.0;
43
(*row)[1] = 210109.0;
44
45
++row;
46
}
47
48
static
void
tearDown
()
49
{
50
PathName(
"test_tdiff.odb"
).unlink();
51
}
52
53
static
void
test
()
54
{
55
const
string
sql =
"select tdiff(date,time,20090707.0,0.0) from \"test_tdiff.odb\";"
;
56
57
Log::info() <<
"Executing: '"
<< sql <<
"'"
<< std::endl;
58
59
odc::Select
oda
(sql);
60
odc::Select::iterator
it =
oda
.begin();
61
62
ASSERT((*it)[0] == -10731);
//
63
64
}
65
66
67
68
SIMPLE_TEST
(FunctionTdiff)
oda
void oda
Definition:
ReaderIterator.h:27
Select.h
TestCase.h
SIMPLE_TEST
#define SIMPLE_TEST(name)
Definition:
TestCase.h:66
tearDown
static void tearDown()
Definition:
TestFunctionTdiff.cc:48
test
static void test()
Definition:
TestFunctionTdiff.cc:53
setUp
static void setUp()
Definition:
TestFunctionTdiff.cc:29
Writer.h
odc::IteratorProxy
Definition:
IteratorProxy.h:123
odc::Row_::writeHeader
void writeHeader()
Definition:
IteratorProxy.h:109
odc::Row_::setNumberOfColumns
void setNumberOfColumns(size_t n)
Definition:
IteratorProxy.h:95
odc::Row_::setColumn
int setColumn(size_t index, const std::string &name, api::ColumnType type)
Definition:
IteratorProxy.h:101
odc::Select
Definition:
Select.h:34
odc::Writer
Definition:
Writer.h:31
eckit
Definition:
DistributionUtils.h:15
odc::api::INTEGER
@ INTEGER
Definition:
ColumnType.h:24
odc
Definition:
ColumnInfo.h:23
std
Definition:
encode.cc:30
odc
src
odc
tools
TestFunctionTdiff.cc
Generated on Fri Aug 20 2021 11:49:12 for IODA Bundle by
1.9.1