Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
hybi_util.cpp File Reference
#include <boost/test/unit_test.hpp>
#include <iostream>
#include "../../src/processors/hybi_util.hpp"
#include "../../src/network_utilities.hpp"
Include dependency graph for hybi_util.cpp:

Go to the source code of this file.

Macros

#define BOOST_TEST_MODULE   hybi_util
 

Functions

 BOOST_AUTO_TEST_CASE (circshift_0)
 
 BOOST_AUTO_TEST_CASE (circshift_1)
 
 BOOST_AUTO_TEST_CASE (circshift_2)
 
 BOOST_AUTO_TEST_CASE (circshift_3)
 

Macro Definition Documentation

◆ BOOST_TEST_MODULE

#define BOOST_TEST_MODULE   hybi_util

Definition at line 28 of file hybi_util.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/4]

BOOST_AUTO_TEST_CASE ( circshift_0 )

Definition at line 36 of file hybi_util.cpp.

36 {
37 if (sizeof(size_t) == 8) {
38 size_t test = 0x0123456789abcdef;
39
40 test = websocketpp::processor::hybi_util::circshift_prepared_key(test,0);
41
42 BOOST_CHECK( test == 0x0123456789abcdef);
43 } else {
44 size_t test = 0x01234567;
45
46 test = websocketpp::processor::hybi_util::circshift_prepared_key(test,0);
47
48 BOOST_CHECK( test == 0x01234567);
49 }
50}
@ test
Unit testing utility error code.
Definition error.hpp:96

◆ BOOST_AUTO_TEST_CASE() [2/4]

BOOST_AUTO_TEST_CASE ( circshift_1 )

Definition at line 52 of file hybi_util.cpp.

52 {
53 if (sizeof(size_t) == 8) {
54 size_t test = 0x0123456789abcdef;
55
56 test = websocketpp::processor::hybi_util::circshift_prepared_key(test,1);
57
58 BOOST_CHECK( test == 0xef0123456789abcd);
59 } else {
60 size_t test = 0x01234567;
61
62 test = websocketpp::processor::hybi_util::circshift_prepared_key(test,1);
63
64 BOOST_CHECK( test == 0x67012345);
65 }
66}

◆ BOOST_AUTO_TEST_CASE() [3/4]

BOOST_AUTO_TEST_CASE ( circshift_2 )

Definition at line 68 of file hybi_util.cpp.

68 {
69 if (sizeof(size_t) == 8) {
70 size_t test = 0x0123456789abcdef;
71
72 test = websocketpp::processor::hybi_util::circshift_prepared_key(test,2);
73
74 BOOST_CHECK( test == 0xcdef0123456789ab);
75 } else {
76 size_t test = 0x01234567;
77
78 test = websocketpp::processor::hybi_util::circshift_prepared_key(test,2);
79
80 BOOST_CHECK( test == 0x45670123);
81 }
82}

◆ BOOST_AUTO_TEST_CASE() [4/4]

BOOST_AUTO_TEST_CASE ( circshift_3 )

Definition at line 84 of file hybi_util.cpp.

84 {
85 if (sizeof(size_t) == 8) {
86 size_t test = 0x0123456789abcdef;
87
88 test = websocketpp::processor::hybi_util::circshift_prepared_key(test,3);
89
90 BOOST_CHECK( test == 0xabcdef0123456789);
91 } else {
92 size_t test = 0x01234567;
93
94 test = websocketpp::processor::hybi_util::circshift_prepared_key(test,3);
95
96 BOOST_CHECK( test == 0x23456701);
97 }
98}