Enable dev build with the latest repo
[platform/framework/web/chromium-efl.git] / courgette / image_utils_unittest.cc
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
3 // found in the LICENSE file.
4
5 #include "courgette/image_utils.h"
6
7 #include <stdint.h>
8
9 #include "testing/gtest/include/gtest/gtest.h"
10
11 namespace courgette {
12
13 namespace {
14
15 TEST(ImageUtilsTest, Read) {
16   uint8_t test_data[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, 00};
17   EXPECT_EQ(0x2301U, Read16LittleEndian(test_data));
18   EXPECT_EQ(0x67452301U, Read32LittleEndian(test_data));
19   EXPECT_EQ(0xEFCDAB8967452301ULL, Read64LittleEndian(test_data));
20
21   // These will break big-endian architectures, which we don't yet support.
22   EXPECT_EQ(0x2301U, ReadU16(test_data, 0));
23   EXPECT_EQ(0x4523U, ReadU16(test_data, 1));
24   EXPECT_EQ(0x67452301U, ReadU32(test_data, 0));
25   EXPECT_EQ(0x89674523U, ReadU32(test_data, 1));
26   EXPECT_EQ(0xEFCDAB8967452301ULL, ReadU64(test_data, 0));
27   EXPECT_EQ(0x00EFCDAB89674523ULL, ReadU64(test_data, 1));
28 }
29
30 }  // namespace
31
32 }  // namespace courgette