1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "flutter/fml/hex_codec.h"
6
7#include <iostream>
8
9#include "gtest/gtest.h"
10
11TEST(HexCodecTest, CanEncode) {
12 {
13 auto result = fml::HexEncode(input: "hello");
14 ASSERT_EQ(result, "68656c6c6f");
15 }
16
17 {
18 auto result = fml::HexEncode(input: "");
19 ASSERT_EQ(result, "");
20 }
21
22 {
23 auto result = fml::HexEncode(input: "1");
24 ASSERT_EQ(result, "31");
25 }
26
27 {
28 auto result = fml::HexEncode(input: std::string_view("\xFF\xFE\x00\x01", 4));
29 ASSERT_EQ(result, "fffe0001");
30 }
31}
32

source code of flutter_engine/flutter/fml/hex_codec_unittest.cc