File: test_error_verbosity.cxx

package info (click to toggle)
libpqxx 4.0.1%2Bdfsg3-8
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 16,012 kB
  • ctags: 9,469
  • sloc: sh: 11,289; cpp: 10,801; xml: 1,256; makefile: 287; ansic: 195; python: 159
file content (42 lines) | stat: -rw-r--r-- 924 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "test_helpers.hxx"

extern "C"
{
#include "libpq-fe.h"
}

using namespace PGSTD;
using namespace pqxx;

namespace
{
void test_error_verbosity(transaction_base &trans)
{
  PQXX_CHECK_EQUAL(
	int(connection_base::terse),
	int(PQERRORS_TERSE),
	"error_verbosity enum should match PGVerbosity.");
  PQXX_CHECK_EQUAL(
	int(connection_base::normal),
	int(PQERRORS_DEFAULT),
	"error_verbosity enum should match PGVerbosity.");
  PQXX_CHECK_EQUAL(
	int(connection_base::verbose),
	int(PQERRORS_VERBOSE),
	"error_verbosity enum should match PGVerbosity.");

  PQXX_CHECK_EQUAL(
	int(trans.conn().get_verbosity()),
	int(connection_base::normal),
	"Unexpected initial error verbosity.");

  trans.conn().set_verbosity(connection_base::terse);

  PQXX_CHECK_EQUAL(
	int(trans.conn().get_verbosity()),
	int(connection_base::terse),
	"Setting verbosity did not work.");
}
} // namespace

PQXX_REGISTER_TEST(test_error_verbosity)