1 /*
2  *  Copyright (c) 2021 The WebRTC project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 #include "net/dcsctp/packet/parameter/add_outgoing_streams_request_parameter.h"
11 
12 #include <stdint.h>
13 
14 #include <type_traits>
15 #include <vector>
16 
17 #include "net/dcsctp/testing/testing_macros.h"
18 #include "rtc_base/gunit.h"
19 
20 namespace dcsctp {
21 namespace {
22 
TEST(AddOutgoingStreamsRequestParameterTest,SerializeAndDeserialize)23 TEST(AddOutgoingStreamsRequestParameterTest, SerializeAndDeserialize) {
24   AddOutgoingStreamsRequestParameter parameter(ReconfigRequestSN(1), 2);
25 
26   std::vector<uint8_t> serialized;
27   parameter.SerializeTo(serialized);
28 
29   ASSERT_HAS_VALUE_AND_ASSIGN(
30       AddOutgoingStreamsRequestParameter deserialized,
31       AddOutgoingStreamsRequestParameter::Parse(serialized));
32 
33   EXPECT_EQ(*deserialized.request_sequence_number(), 1u);
34   EXPECT_EQ(deserialized.nbr_of_new_streams(), 2u);
35 }
36 
37 }  // namespace
38 }  // namespace dcsctp
39