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

Side by Side Diff: courgette/image_utils_unittest.cc

Issue 1543643002: Switch to standard integer types in courgette/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 12 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 | « courgette/image_utils.h ('k') | courgette/label_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "courgette/image_utils.h" 5 #include "courgette/image_utils.h"
6 6
7 #include <stdint.h>
8
7 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
8 10
9 namespace courgette { 11 namespace courgette {
10 12
11 namespace { 13 namespace {
12 14
13 TEST(ImageUtilsTest, Read) { 15 TEST(ImageUtilsTest, Read) {
14 uint8 test_data[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, 00}; 16 uint8_t test_data[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, 00};
15 EXPECT_EQ(0x2301U, Read16LittleEndian(test_data)); 17 EXPECT_EQ(0x2301U, Read16LittleEndian(test_data));
16 EXPECT_EQ(0x67452301U, Read32LittleEndian(test_data)); 18 EXPECT_EQ(0x67452301U, Read32LittleEndian(test_data));
17 EXPECT_EQ(0xEFCDAB8967452301ULL, Read64LittleEndian(test_data)); 19 EXPECT_EQ(0xEFCDAB8967452301ULL, Read64LittleEndian(test_data));
18 20
19 // These will break big-endian architectures, which we don't yet support. 21 // These will break big-endian architectures, which we don't yet support.
20 EXPECT_EQ(0x2301U, ReadU16(test_data, 0)); 22 EXPECT_EQ(0x2301U, ReadU16(test_data, 0));
21 EXPECT_EQ(0x4523U, ReadU16(test_data, 1)); 23 EXPECT_EQ(0x4523U, ReadU16(test_data, 1));
22 EXPECT_EQ(0x67452301U, ReadU32(test_data, 0)); 24 EXPECT_EQ(0x67452301U, ReadU32(test_data, 0));
23 EXPECT_EQ(0x89674523U, ReadU32(test_data, 1)); 25 EXPECT_EQ(0x89674523U, ReadU32(test_data, 1));
24 EXPECT_EQ(0xEFCDAB8967452301ULL, ReadU64(test_data, 0)); 26 EXPECT_EQ(0xEFCDAB8967452301ULL, ReadU64(test_data, 0));
25 EXPECT_EQ(0x00EFCDAB89674523ULL, ReadU64(test_data, 1)); 27 EXPECT_EQ(0x00EFCDAB89674523ULL, ReadU64(test_data, 1));
26 } 28 }
27 29
28 } // namespace 30 } // namespace
29 31
30 } // namespace courgette 32 } // namespace courgette
OLDNEW
« no previous file with comments | « courgette/image_utils.h ('k') | courgette/label_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698