| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "gate/tests.hpp" | ||
| 2 | #include "gate/hashes.hpp" | ||
| 3 | #include "gate/guids.hpp" | ||
| 4 | #include "gate/times.hpp" | ||
| 5 | |||
| 6 | using namespace gate; | ||
| 7 | |||
| 8 | |||
| 9 | template<class T> | ||
| 10 | 28 | void checkTypeHash(T const& instance) | |
| 11 | { | ||
| 12 |
1/2✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
|
56 | TypeHash<T> generator; |
| 13 | 28 | hash_code_t code = 0; | |
| 14 |
3/12✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 14 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 14 times.
✗ Branch 9 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
|
28 | GATEXX_TEST_CHECK_NOTHROW(code = generator(instance)); |
| 15 |
4/12✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 14 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 14 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 14 times.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
|
28 | GATEXX_TEST_CHECK(code != 0); |
| 16 | 28 | } | |
| 17 | |||
| 18 | template<class T> | ||
| 19 | 18 | void checkNumTypeHash() | |
| 20 | { | ||
| 21 | 18 | T instance = static_cast<T>(123); | |
| 22 |
1/2✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
|
18 | checkTypeHash<T>(instance); |
| 23 | 18 | } | |
| 24 | |||
| 25 | |||
| 26 |
2/7✓ Branch 2 taken 3 times.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
10 | GATEXX_TEST_UNIT(TypeHashes) |
| 27 | { | ||
| 28 | 2 | checkNumTypeHash<int8_t>(); | |
| 29 | 2 | checkNumTypeHash<int16_t>(); | |
| 30 | 2 | checkNumTypeHash<int32_t>(); | |
| 31 | 2 | checkNumTypeHash<int64_t>(); | |
| 32 | //checkNumTypeHash<uint8_t>(); // uchar has no type traits | ||
| 33 | 2 | checkNumTypeHash<uint16_t>(); | |
| 34 | 2 | checkNumTypeHash<uint32_t>(); | |
| 35 | 2 | checkNumTypeHash<uint64_t>(); | |
| 36 | 2 | checkNumTypeHash<real32_t>(); | |
| 37 | 2 | checkNumTypeHash<real64_t>(); | |
| 38 | |||
| 39 |
2/4✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
|
2 | checkTypeHash(*Guid::generate().c_impl()); |
| 40 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
2 | checkTypeHash(static_cast<gate_date_t const&>(Date())); |
| 41 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
2 | checkTypeHash(static_cast<gate_daytime_t const&>(DayTime())); |
| 42 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
2 | checkTypeHash(static_cast<gate_datetime_t const&>(DateTime())); |
| 43 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
2 | checkTypeHash(static_cast<gate_time_t const&>(Time())); |
| 44 | 2 | } | |
| 45 | |||
| 46 |
2/7✓ Branch 2 taken 3 times.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
10 | GATEXX_TEST_UNIT(Hashes) |
| 47 | { | ||
| 48 | 2 | int data = 42; | |
| 49 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
4 | HashGenerator hg; |
| 50 | |||
| 51 |
3/12✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
|
2 | GATEXX_TEST_CHECK_NOTHROW(hg.update(&data, sizeof(data))); |
| 52 | |||
| 53 |
3/12✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
|
2 | GATEXX_TEST_CHECK_NOTHROW(hg.finish()); |
| 54 | 2 | } | |
| 55 | |||
| 56 |