Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: tools/battor_agent/serial_utils_unittest.cc

Issue 1966413002: [battor agent] Move code for stringifying bytes into a util file (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed signed/unsigned char problems Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/battor_agent/serial_utils.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium 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 "tools/battor_agent/serial_utils.h"
6
7 #include "testing/gtest/include/gtest/gtest.h"
8
9 using namespace testing;
10
11 namespace battor {
12
13 TEST(SerialUtilsTest, CharVectorToStringLengthZero) {
14 EXPECT_EQ("", CharVectorToString(std::vector<char>()));
15 }
16
17 TEST(SerialUtilsTest, CharVectorToStringLengthOne) {
18 EXPECT_EQ("0x41", CharVectorToString(std::vector<char>({'A'})));
19 }
20
21 TEST(SerialUtilsTest, CharVectorToStringLengthTwo) {
22 EXPECT_EQ("0x41 0x4a",
23 CharVectorToString(std::vector<char>({'A', 'J'})));
24 }
25
26 TEST(SerialUtilsTest, CharArrayToStringLengthOne) {
27 const char arr[] = {'A'};
28 EXPECT_EQ("0x41", CharArrayToString(arr, sizeof(arr)));
29 }
30
31 TEST(SerialUtilsTest, CharArrayToStringLengthTwo) {
32 const char arr[] = {'A', 'J'};
33 EXPECT_EQ("0x41 0x4a", CharArrayToString(arr, sizeof(arr)));
34 }
35
36 } // namespace battor
OLDNEW
« no previous file with comments | « tools/battor_agent/serial_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698