tests/att/read_by_group_type_tests.cpp
BOOST_FIXTURE_TEST_CASE( different_attribute_data_size_without_gap, server_with_16bit_characteristics_in_the_middle_100 )
{
    l2cap_input( { 0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28 } );

    static const std::uint8_t expected_result_1[] = {
        0x11, 0x14,                 // response code, size
        0x01, 0x00, 0x03, 0x00,     // handle 0x0001 - 0x0003
        0x2A, 0xD9, 0x91, 0x11,     // service_uuid global_temperature_service
        0xAB, 0x5B, 0x58, 0xB0,
        0x3B, 0x4F, 0x50, 0x44,
        0x52, 0x6E, 0x42, 0xF0,
    };

    BOOST_CHECK_EQUAL_COLLECTIONS( &response[ 0 ], &response[ response_size ], std::begin( expected_result_1 ), std::end( expected_result_1 ) );

    l2cap_input( { 0x10, 0x04, 0x00, 0xff, 0xff, 0x00, 0x28 } );

    static const std::uint8_t expected_result_2[] = {
        0x11, 0x6,                  // response code, size
        0x04, 0x00, 0x08, 0x00,     // handle 0x0004 - 0x000A
        0x16, 0x18                  // Cycling Speed and Cadence
    };

    BOOST_CHECK_EQUAL_COLLECTIONS( &response[ 0 ], &response[ response_size ], std::begin( expected_result_2 ), std::end( expected_result_2 ) );

    l2cap_input( { 0x10, 0x09, 0x00, 0xff, 0xff, 0x00, 0x28 } );

    static const std::uint8_t expected_result_3[] = {
        0x11, 0x14,                 // response code, size
        0x09, 0x00, 0x0F, 0x00,     // handle 0x0001 - 0x0003
        0xA9, 0x3C, 0xC7, 0x5B,     // 128 bit UUID
        0xED, 0x4E, 0x8A, 0xA2,
        0x9F, 0x49, 0xE2, 0x0D,
        0x94, 0x40, 0x8B, 0x8C
    };

    BOOST_CHECK_EQUAL_COLLECTIONS( &response[ 0 ], &response[ response_size ], std::begin( expected_result_3 ), std::end( expected_result_3 ) );

    l2cap_input( { 0x10, 0x10, 0x00, 0xff, 0xff, 0x00, 0x28 } );

    static const std::uint8_t expected_result_4[] = {
        0x01,                       // Error Response
        0x10,                       // request opcode
        0x10, 0x00,                 // request handle
        0x0A                        // «Attribute Not Found»
    };

    BOOST_CHECK_EQUAL_COLLECTIONS( &response[ 0 ], &response[ response_size ], std::begin( expected_result_4 ), std::end( expected_result_4 ) );
}
/**
 * #53 Read by Group Type Request should not return lists that contain gaps
 *
 * In order for the GATT Discover All Primary Services procedure to work correctly,
 * Read by Group Type Request should not return lists that contains gaps.
 * Group Type Request is used to discover services, and can return only services of
 * the same UUID length. If the server contains mixed 16-bit and 128-bit UUIDs,
 * the server shall not assemble lists where two services are contain,
 * where a service of the other kind would be in the middle.
 *
 * For example, a server containing a 16-bit UUID service, followed by a 128-bit UUID service,
 * followed by a 16-bit UUID service again, the server should not put both 16-bit UUID
 * services into one Read by Group Type Response.
 */
#53 Read by Group Type Request should not return lists that contain gaps
In order for the GATT Discover All Primary Services procedure to work correctly,
Read by Group Type Request should not return lists that contains gaps.
Group Type Request is used to discover services, and can return only services of
the same UUID length. If the server contains mixed 16-bit and 128-bit UUIDs,
the server shall not assemble lists where two services are contain,
where a service of the other kind would be in the middle.

For example, a server containing a 16-bit UUID service, followed by a 128-bit UUID service,
followed by a 16-bit UUID service again, the server should not put both 16-bit UUID
services into one Read by Group Type Response.
#53 Read by Group Type Request should not return lists that contain gaps In order for the GATT Discover All Primary Services procedure to work correctly Read by Group Type Request should not return lists that contains gaps . Group Type Request is used to discover services and can return only services of the same UUID length . If the server contains mixed 16 - bit and 128 - bit UUIDs the server shall not assemble lists where two services are contain where a service of the other kind would be in the middle . For example a server containing a 16 - bit UUID service followed by a 128 - bit UUID service followed by a 16 - bit UUID service again the server should not put both 16 - bit UUID services into one Read by Group Type Response .
BOOST_FIXTURE_TEST_CASE( different_attribute_data_size_without_gap, server_with_16bit_characteristics_in_the_middle_100 )
{
    l2cap_input( { 0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28 } );
    static const std::uint8_t expected_result_1[] = {
        0x11, 0x14,                 
        0x01, 0x00, 0x03, 0x00,     
        0x2A, 0xD9, 0x91, 0x11,     
        0xAB, 0x5B, 0x58, 0xB0,
        0x3B, 0x4F, 0x50, 0x44,
        0x52, 0x6E, 0x42, 0xF0,
    };
    BOOST_CHECK_EQUAL_COLLECTIONS( &response[ 0 ], &response[ response_size ], std::begin( expected_result_1 ), std::end( expected_result_1 ) );
    l2cap_input( { 0x10, 0x04, 0x00, 0xff, 0xff, 0x00, 0x28 } );
    static const std::uint8_t expected_result_2[] = {
        0x11, 0x6,                  
        0x04, 0x00, 0x08, 0x00,     
        0x16, 0x18                  
    };
    BOOST_CHECK_EQUAL_COLLECTIONS( &response[ 0 ], &response[ response_size ], std::begin( expected_result_2 ), std::end( expected_result_2 ) );
    l2cap_input( { 0x10, 0x09, 0x00, 0xff, 0xff, 0x00, 0x28 } );
    static const std::uint8_t expected_result_3[] = {
        0x11, 0x14,                 
        0x09, 0x00, 0x0F, 0x00,     
        0xA9, 0x3C, 0xC7, 0x5B,     
        0xED, 0x4E, 0x8A, 0xA2,
        0x9F, 0x49, 0xE2, 0x0D,
        0x94, 0x40, 0x8B, 0x8C
    };
    BOOST_CHECK_EQUAL_COLLECTIONS( &response[ 0 ], &response[ response_size ], std::begin( expected_result_3 ), std::end( expected_result_3 ) );
    l2cap_input( { 0x10, 0x10, 0x00, 0xff, 0xff, 0x00, 0x28 } );
    static const std::uint8_t expected_result_4[] = {
        0x01,                       
        0x10,                       
        0x10, 0x00,                 
        0x0A                        
    };
    BOOST_CHECK_EQUAL_COLLECTIONS( &response[ 0 ], &response[ response_size ], std::begin( expected_result_4 ), std::end( expected_result_4 ) );
}
BOOST_FIXTURE_TEST_CASE ( different_attribute_data_size_without_gap , server_with_16bit_characteristics_in_the_middle_100 ) { l2cap_input ( { 0x10 , 0x01 , 0x00 , 0xff , 0xff , 0x00 , 0x28 } ) ; static const std :: uint8_t expected_result_1 [ ] = { 0x11 , 0x14 , 0x01 , 0x00 , 0x03 , 0x00 , 0x2A , 0xD9 , 0x91 , 0x11 , 0xAB , 0x5B , 0x58 , 0xB0 , 0x3B , 0x4F , 0x50 , 0x44 , 0x52 , 0x6E , 0x42 , 0xF0 , } ; BOOST_CHECK_EQUAL_COLLECTIONS ( & response [ 0 ] , & response [ response_size ] , std :: begin ( expected_result_1 ) , std :: end ( expected_result_1 ) ) ; l2cap_input ( { 0x10 , 0x04 , 0x00 , 0xff , 0xff , 0x00 , 0x28 } ) ; static const std :: uint8_t expected_result_2 [ ] = { 0x11 , 0x6 , 0x04 , 0x00 , 0x08 , 0x00 , 0x16 , 0x18 } ; BOOST_CHECK_EQUAL_COLLECTIONS ( & response [ 0 ] , & response [ response_size ] , std :: begin ( expected_result_2 ) , std :: end ( expected_result_2 ) ) ; l2cap_input ( { 0x10 , 0x09 , 0x00 , 0xff , 0xff , 0x00 , 0x28 } ) ; static const std :: uint8_t expected_result_3 [ ] = { 0x11 , 0x14 , 0x09 , 0x00 , 0x0F , 0x00 , 0xA9 , 0x3C , 0xC7 , 0x5B , 0xED , 0x4E , 0x8A , 0xA2 , 0x9F , 0x49 , 0xE2 , 0x0D , 0x94 , 0x40 , 0x8B , 0x8C } ; BOOST_CHECK_EQUAL_COLLECTIONS ( & response [ 0 ] , & response [ response_size ] , std :: begin ( expected_result_3 ) , std :: end ( expected_result_3 ) ) ; l2cap_input ( { 0x10 , 0x10 , 0x00 , 0xff , 0xff , 0x00 , 0x28 } ) ; static const std :: uint8_t expected_result_4 [ ] = { 0x01 , 0x10 , 0x10 , 0x00 , 0x0A } ; BOOST_CHECK_EQUAL_COLLECTIONS ( & response [ 0 ] , & response [ response_size ] , std :: begin ( expected_result_4 ) , std :: end ( expected_result_4 ) ) ; }
#53 Read by Group Type Request should not return lists that contain gaps
 In order for the GATT Discover All Primary Services procedure to work correctly,
 Read by Group Type Request should not return lists that contains gaps.
#53 Read by Group Type Request should not return lists that contain gaps In order for the GATT Discover All Primary Services procedure to work correctly Read by Group Type Request should not return lists that contains gaps .
// response code, size // handle 0x0001 - 0x0003 // service_uuid global_temperature_service // response code, size // handle 0x0004 - 0x000A // Cycling Speed and Cadence // response code, size // handle 0x0001 - 0x0003 // 128 bit UUID // Error Response // request opcode // request handle // «Attribute Not Found»