remove trailing whitespace

This commit is contained in:
Peter Thorson
2013-07-21 07:49:15 -05:00
parent df828914c7
commit c017331959
143 changed files with 3602 additions and 3602 deletions

View File

@@ -11,10 +11,10 @@
* * Neither the name of the WebSocket++ Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL PETER THORSON BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
@@ -22,7 +22,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
*/
//#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE frame
@@ -39,7 +39,7 @@ using namespace websocketpp;
BOOST_AUTO_TEST_CASE( basic_bits ) {
frame::basic_header h1(0x00,0x00); // all false
frame::basic_header h2(0xF0,0x80); // all true
// Read Values
BOOST_CHECK( frame::get_fin(h1) == false );
BOOST_CHECK( frame::get_rsv1(h1) == false );
@@ -52,20 +52,20 @@ BOOST_AUTO_TEST_CASE( basic_bits ) {
BOOST_CHECK( frame::get_rsv2(h2) == true );
BOOST_CHECK( frame::get_rsv3(h2) == true );
BOOST_CHECK( frame::get_masked(h2) == true );
// Set Values
frame::set_fin(h1,true);
BOOST_CHECK( h1.b0 == 0x80 );
frame::set_rsv1(h1,true);
BOOST_CHECK( h1.b0 == 0xC0 );
frame::set_rsv2(h1,true);
BOOST_CHECK( h1.b0 == 0xE0 );
frame::set_rsv3(h1,true);
BOOST_CHECK( h1.b0 == 0xF0 );
frame::set_masked(h1,true);
BOOST_CHECK( h1.b1 == 0x80 );
}
@@ -105,19 +105,19 @@ BOOST_AUTO_TEST_CASE( basic_size ) {
BOOST_CHECK( frame::get_basic_size(h4) == 126 );
BOOST_CHECK( frame::get_basic_size(h5) == 127 );
BOOST_CHECK( frame::get_basic_size(h6) == 0 );
/*frame::set_basic_size(h1,1);
BOOST_CHECK( h1.b1 == 0x01 );
frame::set_basic_size(h1,125);
BOOST_CHECK( h1.b1 == 0x7D );
frame::set_basic_size(h1,126);
BOOST_CHECK( h1.b1 == 0x7E );
frame::set_basic_size(h1,127);
BOOST_CHECK( h1.b1 == 0x7F );
frame::set_basic_size(h1,0);
BOOST_CHECK( h1.b1 == 0x00 );*/
}
@@ -140,7 +140,7 @@ BOOST_AUTO_TEST_CASE( basic_header_length ) {
BOOST_AUTO_TEST_CASE( basic_opcode ) {
frame::basic_header h1(0x00,0x00);
BOOST_CHECK( is_control(frame::opcode::CONTINUATION) == false);
BOOST_CHECK( is_control(frame::opcode::TEXT) == false);
BOOST_CHECK( is_control(frame::opcode::BINARY) == false);
@@ -155,7 +155,7 @@ BOOST_AUTO_TEST_CASE( extended_header_basics ) {
frame::extended_header h1;
uint8_t h1_solution[12] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
frame::extended_header h2(uint16_t(255));
uint8_t h2_solution[12] = {0x00, 0xFF, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
@@ -193,7 +193,7 @@ BOOST_AUTO_TEST_CASE( extended_header_extractors ) {
BOOST_CHECK( get_payload_size(h2,e2) == 0x0807060504030201LL );
BOOST_CHECK( get_masking_key_offset(h2) == 8 );
BOOST_CHECK( get_masking_key(h2,e2).i == 0 );
frame::basic_header h3(0x00,0xFE);
frame::extended_header e3(uint16_t(255),0x08040201);
BOOST_CHECK( get_extended_size(e3) == 255 );
@@ -217,25 +217,25 @@ BOOST_AUTO_TEST_CASE( header_preparation ) {
frame::basic_header h1(0x81,0xFF); //
frame::extended_header e1(uint64_t(0xFFFFFLL),htonl(0xD5FB70EE));
std::string p1 = prepare_header(h1, e1);
uint8_t s1[14] = {0x81, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF,
uint8_t s1[14] = {0x81, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF,
0xD5, 0xFB, 0x70, 0xEE};
BOOST_CHECK( p1.size() == 14);
BOOST_CHECK( std::equal(p1.begin(),p1.end(),reinterpret_cast<char*>(s1)) );
frame::basic_header h2(0x81,0x7E); //
frame::extended_header e2(uint16_t(255));
std::string p2 = prepare_header(h2, e2);
uint8_t s2[4] = {0x81, 0x7E, 0x00, 0xFF};
BOOST_CHECK( p2.size() == 4);
BOOST_CHECK( std::equal(p2.begin(),p2.end(),reinterpret_cast<char*>(s2)) );
}
BOOST_AUTO_TEST_CASE( prepare_masking_key ) {
frame::masking_key_type key;
key.i = htonl(0x12345678);
if (sizeof(size_t) == 8) {
@@ -266,14 +266,14 @@ BOOST_AUTO_TEST_CASE( prepare_masking_key2 ) {
BOOST_AUTO_TEST_CASE( circshift ) {
/*if (sizeof(size_t) == 8) {
size_t test = 0x0123456789abcdef;
BOOST_CHECK( frame::circshift_prepared_key(test,0) == 0x0123456789abcdef);
BOOST_CHECK( frame::circshift_prepared_key(test,1) == 0xef0123456789abcd);
BOOST_CHECK( frame::circshift_prepared_key(test,2) == 0xcdef0123456789ab);
BOOST_CHECK( frame::circshift_prepared_key(test,3) == 0xabcdef0123456789);
} else {
size_t test = 0x01234567;
BOOST_CHECK( frame::circshift_prepared_key(test,0) == 0x01234567);
BOOST_CHECK( frame::circshift_prepared_key(test,1) == 0x67012345);
BOOST_CHECK( frame::circshift_prepared_key(test,2) == 0x45670123);
@@ -282,13 +282,13 @@ BOOST_AUTO_TEST_CASE( circshift ) {
}
BOOST_AUTO_TEST_CASE( block_byte_mask ) {
uint8_t input[15] = {0x00, 0x00, 0x00, 0x00,
uint8_t input[15] = {0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00};
uint8_t output[15];
uint8_t masked[15] = {0x00, 0x01, 0x02, 0x03,
0x00, 0x01, 0x02, 0x03,
0x00, 0x01, 0x02, 0x03,
@@ -299,18 +299,18 @@ BOOST_AUTO_TEST_CASE( block_byte_mask ) {
key.c[1] = 0x01;
key.c[2] = 0x02;
key.c[3] = 0x03;
byte_mask(input,input+15,output,key);
BOOST_CHECK( std::equal(output,output+15,masked) );
}
BOOST_AUTO_TEST_CASE( block_byte_mask_inplace ) {
uint8_t buffer[15] = {0x00, 0x00, 0x00, 0x00,
uint8_t buffer[15] = {0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00};
uint8_t masked[15] = {0x00, 0x01, 0x02, 0x03,
0x00, 0x01, 0x02, 0x03,
0x00, 0x01, 0x02, 0x03,
@@ -321,20 +321,20 @@ BOOST_AUTO_TEST_CASE( block_byte_mask_inplace ) {
key.c[1] = 0x01;
key.c[2] = 0x02;
key.c[3] = 0x03;
byte_mask(buffer,buffer+15,key);
BOOST_CHECK( std::equal(buffer,buffer+15,masked) );
}
BOOST_AUTO_TEST_CASE( block_word_mask ) {
uint8_t input[15] = {0x00, 0x00, 0x00, 0x00,
uint8_t input[15] = {0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00};
uint8_t output[15];
uint8_t masked[15] = {0x00, 0x01, 0x02, 0x03,
0x00, 0x01, 0x02, 0x03,
0x00, 0x01, 0x02, 0x03,
@@ -345,18 +345,18 @@ BOOST_AUTO_TEST_CASE( block_word_mask ) {
key.c[1] = 0x01;
key.c[2] = 0x02;
key.c[3] = 0x03;
word_mask_exact(input,output,15,key);
BOOST_CHECK( std::equal(output,output+15,masked) );
}
BOOST_AUTO_TEST_CASE( block_word_mask_inplace ) {
uint8_t buffer[15] = {0x00, 0x00, 0x00, 0x00,
uint8_t buffer[15] = {0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00};
uint8_t masked[15] = {0x00, 0x01, 0x02, 0x03,
0x00, 0x01, 0x02, 0x03,
0x00, 0x01, 0x02, 0x03,
@@ -367,7 +367,7 @@ BOOST_AUTO_TEST_CASE( block_word_mask_inplace ) {
key.c[1] = 0x01;
key.c[2] = 0x02;
key.c[3] = 0x03;
word_mask_exact(buffer,15,key);
BOOST_CHECK( std::equal(buffer,buffer+15,masked) );
@@ -376,7 +376,7 @@ BOOST_AUTO_TEST_CASE( block_word_mask_inplace ) {
BOOST_AUTO_TEST_CASE( continuous_word_mask ) {
uint8_t input[16];
uint8_t output[16];
uint8_t masked[16] = {0x00, 0x01, 0x02, 0x03,
0x00, 0x01, 0x02, 0x03,
0x00, 0x01, 0x02, 0x03,
@@ -400,7 +400,7 @@ BOOST_AUTO_TEST_CASE( continuous_word_mask ) {
pkey = frame::prepare_masking_key(key);
std::fill_n(input,16,0x00);
std::fill_n(output,16,0x00);
pkey_temp = frame::word_mask_circ(input,output,7,pkey);
BOOST_CHECK( std::equal(output,output+7,masked) );
BOOST_CHECK( pkey_temp == frame::circshift_prepared_key(pkey,3) );
@@ -413,7 +413,7 @@ BOOST_AUTO_TEST_CASE( continuous_word_mask ) {
BOOST_AUTO_TEST_CASE( continuous_byte_mask ) {
uint8_t input[16];
uint8_t output[16];
uint8_t masked[16] = {0x00, 0x01, 0x02, 0x03,
0x00, 0x01, 0x02, 0x03,
0x00, 0x01, 0x02, 0x03,
@@ -437,7 +437,7 @@ BOOST_AUTO_TEST_CASE( continuous_byte_mask ) {
pkey = frame::prepare_masking_key(key);
std::fill_n(input,16,0x00);
std::fill_n(output,16,0x00);
pkey_temp = frame::byte_mask_circ(input,output,7,pkey);
BOOST_CHECK( std::equal(output,output+7,masked) );
BOOST_CHECK( pkey_temp == frame::circshift_prepared_key(pkey,3) );
@@ -449,7 +449,7 @@ BOOST_AUTO_TEST_CASE( continuous_byte_mask ) {
BOOST_AUTO_TEST_CASE( continuous_word_mask_inplace ) {
uint8_t buffer[16];
uint8_t masked[16] = {0x00, 0x01, 0x02, 0x03,
0x00, 0x01, 0x02, 0x03,
0x00, 0x01, 0x02, 0x03,
@@ -471,7 +471,7 @@ BOOST_AUTO_TEST_CASE( continuous_word_mask_inplace ) {
// calls not split on word boundaries
pkey = frame::prepare_masking_key(key);
std::fill_n(buffer,16,0x00);
pkey_temp = frame::word_mask_circ(buffer,7,pkey);
BOOST_CHECK( std::equal(buffer,buffer+7,masked) );
BOOST_CHECK_EQUAL( pkey_temp, frame::circshift_prepared_key(pkey,3) );
@@ -483,7 +483,7 @@ BOOST_AUTO_TEST_CASE( continuous_word_mask_inplace ) {
BOOST_AUTO_TEST_CASE( continuous_byte_mask_inplace ) {
uint8_t buffer[16];
uint8_t masked[16] = {0x00, 0x01, 0x02, 0x03,
0x00, 0x01, 0x02, 0x03,
0x00, 0x01, 0x02, 0x03,
@@ -505,7 +505,7 @@ BOOST_AUTO_TEST_CASE( continuous_byte_mask_inplace ) {
// calls not split on word boundaries
pkey = frame::prepare_masking_key(key);
std::fill_n(buffer,16,0x00);
pkey_temp = frame::byte_mask_circ(buffer,7,pkey);
BOOST_CHECK( std::equal(buffer,buffer+7,masked) );
BOOST_CHECK_EQUAL( pkey_temp, frame::circshift_prepared_key(pkey,3) );
@@ -515,11 +515,11 @@ BOOST_AUTO_TEST_CASE( continuous_byte_mask_inplace ) {
BOOST_CHECK_EQUAL( pkey_temp, frame::circshift_prepared_key(pkey,3) );
}
BOOST_AUTO_TEST_CASE( continuous_word_mask2 ) {
BOOST_AUTO_TEST_CASE( continuous_word_mask2 ) {
uint8_t buffer[12] = {0xA6, 0x15, 0x97, 0xB9,
0x81, 0x50, 0xAC, 0xBA,
0x9C, 0x1C, 0x9F, 0xF4};
uint8_t unmasked[12] = {0x48, 0x65, 0x6C, 0x6C,
0x6F, 0x20, 0x57, 0x6F,
0x72, 0x6C, 0x64, 0x21};