Inexor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Namespaces | Macros | Functions
Observe.cpp File Reference
#include <stddef.h>
#include <limits>
#include <ostream>
#include <string>
#include "gtest/gtest-message.h"
#include "gtest/gtest-test-part.h"
#include "gtest/gtest.h"
#include "inexor/network/SharedVar.hpp"
#include "inexor/test/helpers.hpp"

Namespaces

 anonymous_namespace{Observe.cpp}
 

Macros

#define act(action, _new, _ret, description)
 
#define asop_n(op, n)
 
#define asop(op)
 
#define ptest(name, type)
 

Functions

template<typename T >
void anonymous_namespace{Observe.cpp}::test_primitive (T seed, T overw)
 
 anonymous_namespace{Observe.cpp}::ptest (Char, char)
 
 anonymous_namespace{Observe.cpp}::ptest (SignedChar, signed char)
 
 anonymous_namespace{Observe.cpp}::ptest (UnsignedChar, unsigned char)
 
 anonymous_namespace{Observe.cpp}::ptest (Short, short)
 
 anonymous_namespace{Observe.cpp}::ptest (Int, int)
 
 anonymous_namespace{Observe.cpp}::ptest (SignedInt, signed int)
 
 anonymous_namespace{Observe.cpp}::ptest (UnsignedInt, unsigned int)
 
 anonymous_namespace{Observe.cpp}::ptest (SizeT, size_t)
 
 anonymous_namespace{Observe.cpp}::test (SharedVar, Boolean)
 
 anonymous_namespace{Observe.cpp}::test (SharedVar, String)
 

Macro Definition Documentation

#define act (   action,
  _new,
  _ret,
  description 
)
Value:
{ \
called = false; \
SharedVar<T> X(seed); \
X.onChange.connect(listener); \
desc = description; \
exold = seed; \
exnew = (_new); \
exret = (_ret); \
auto ret = (action); \
expectEq(exret, ret) << "Expected `" #action "`" \
" to result in " << (_ret) << ", but it " \
"returned " << ret << "with seed=" << seed; \
expect(called) << "Expected the callback to be " \
"called when " << desc << "(`" #action "`)"; \
}
#define expectEq
Definition: helpers.hpp:23
#define expect
Definition: helpers.hpp:19

Referenced by anonymous_namespace{Observe.cpp}::test_primitive().

#define asop (   op)
Value:
{ \
asop_n(op, 2); \
asop_n(op, 4); \
asop_n(op, 6); \
asop_n(op, 7); \
}
#define asop_n(op, n)

Referenced by anonymous_namespace{Observe.cpp}::test_primitive().

#define asop_n (   op,
 
)
Value:
{ \
T nu = seed; \
T re = (nu op ## = n); \
act((X op ## = n), nu, re, "using the `" #op "` operator"); \
}
#define act(action, _new, _ret, description)
#define ptest (   name,
  type 
)
Value:
test(SharedVar, name ## 0) { \
test_primitive<type>(0, 32); } \
test(SharedVar, name ## 5) { \
test_primitive<type>(5, 42); } \
test(SharedVar, name ## Min) { \
test_primitive<type>( \
test(SharedVar, name ## Max) { \
test_primitive<type>( \
const T & max(const inexor::rpc::SharedVar< T > &a, const T &b)
Definition: SharedVar.hpp:224
const T & min(const inexor::rpc::SharedVar< T > &a, const T &b)
Definition: SharedVar.hpp:210
test(StringFormatter, works)
Definition: utilTest.cpp:64
SharedVar wrapper for primitive/immutable objects.
Definition: SharedVar.hpp:55