The Battle for Wesnoth  1.15.3+dev
TruncationTest.cpp
Go to the documentation of this file.
1 //
2 // M A R I A D B + +
3 //
4 // Copyright The ViaDuck Project 2016 - 2018.
5 // Distributed under the Boost Software License, Version 1.0.
6 // (See accompanying file LICENSE or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
8 
9 #include "TruncationTest.h"
10 
11 TEST_F(TruncationTest, testUInt) {
12  uint32_t max = std::numeric_limits<uint32_t>::max();
13 
14  // insert max uint
15  m_con->execute("INSERT INTO " + m_table_name + " VALUES (" + std::to_string(max) + ");");
16 
17  // query directly
18  result_set_ref res = m_con->query("SELECT * FROM " + m_table_name + ";");
19 
20  ASSERT_TRUE(!!res);
21  ASSERT_TRUE(res->next());
22  ASSERT_EQ(max, res->get_unsigned32(0));
23 
24  // query as statement
25  statement_ref stmt = m_con->create_statement("SELECT * FROM " + m_table_name + ";");
26  result_set_ref stmt_res = stmt->query();
27 
28  ASSERT_TRUE(!!stmt_res);
29  ASSERT_TRUE(stmt_res->next());
30  ASSERT_EQ(max, stmt_res->get_unsigned32(0));
31 }
std::shared_ptr< result_set > result_set_ref
Definition: result_set.hpp:219
std::shared_ptr< statement > statement_ref
Definition: statement.hpp:109
TEST_F(TruncationTest, testUInt)