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/incoming_ssn_reset_request_parameter.h"
11
12 #include <cstdint>
13 #include <type_traits>
14 #include <vector>
15
16 #include "api/array_view.h"
17 #include "net/dcsctp/testing/testing_macros.h"
18 #include "rtc_base/gunit.h"
19 #include "test/gmock.h"
20
21 namespace dcsctp {
22 namespace {
23 using ::testing::ElementsAre;
24
TEST(IncomingSSNResetRequestParameterTest,SerializeAndDeserialize)25 TEST(IncomingSSNResetRequestParameterTest, SerializeAndDeserialize) {
26 IncomingSSNResetRequestParameter parameter(
27 ReconfigRequestSN(1), {StreamID(2), StreamID(3), StreamID(4)});
28
29 std::vector<uint8_t> serialized;
30 parameter.SerializeTo(serialized);
31
32 ASSERT_HAS_VALUE_AND_ASSIGN(
33 IncomingSSNResetRequestParameter deserialized,
34 IncomingSSNResetRequestParameter::Parse(serialized));
35
36 EXPECT_EQ(*deserialized.request_sequence_number(), 1u);
37 EXPECT_THAT(deserialized.stream_ids(),
38 ElementsAre(StreamID(2), StreamID(3), StreamID(4)));
39 }
40
41 } // namespace
42 } // namespace dcsctp
43