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

Side by Side Diff: tests/PackBitsTest.cpp

Issue 800993002: Even more win64 warning fixes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: cleanup Created 6 years 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
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkPackBits.h" 8 #include "SkPackBits.h"
9 #include "Test.h" 9 #include "Test.h"
10 10
(...skipping 25 matching lines...) Expand all
36 size_t dstSize = SkPackBits::Pack16(gTests[i].fSrc, 36 size_t dstSize = SkPackBits::Pack16(gTests[i].fSrc,
37 gTests[i].fCount, dst); 37 gTests[i].fCount, dst);
38 uint16_t src[100]; 38 uint16_t src[100];
39 int srcCount = SkPackBits::Unpack16(dst, dstSize, src); 39 int srcCount = SkPackBits::Unpack16(dst, dstSize, src);
40 bool match = gTests[i].fCount == srcCount && memcmp(gTests[i].fSrc, src, 40 bool match = gTests[i].fCount == srcCount && memcmp(gTests[i].fSrc, src,
41 gTests[i].fCount * sizeof(uint16_t)) == 0; 41 gTests[i].fCount * sizeof(uint16_t)) == 0;
42 REPORTER_ASSERT(reporter, match); 42 REPORTER_ASSERT(reporter, match);
43 } 43 }
44 44
45 for (int n = 1000; n; n--) { 45 for (int n = 1000; n; n--) {
46 size_t size = 50; 46 int size = 50;
47 uint16_t src[100], src2[100]; 47 uint16_t src[100], src2[100];
48 uint8_t dst[200]; 48 uint8_t dst[200];
49 rand_fill(src, size); 49 rand_fill(src, size);
50 50
51 size_t dstSize = SkPackBits::Pack16(src, size, dst); 51 size_t dstSize = SkPackBits::Pack16(src, size, dst);
52 size_t maxSize = SkPackBits::ComputeMaxSize16(size); 52 size_t maxSize = SkPackBits::ComputeMaxSize16(size);
53 REPORTER_ASSERT(reporter, maxSize >= dstSize); 53 REPORTER_ASSERT(reporter, maxSize >= dstSize);
54 54
55 size_t srcCount = SkPackBits::Unpack16(dst, dstSize, src2); 55 size_t srcCount = SkPackBits::Unpack16(dst, dstSize, src2);
56 REPORTER_ASSERT(reporter, size == srcCount); 56 REPORTER_ASSERT(reporter, size == srcCount);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 gTests[i].fCount, dst); 89 gTests[i].fCount, dst);
90 REPORTER_ASSERT(reporter, dstSize <= maxSize); 90 REPORTER_ASSERT(reporter, dstSize <= maxSize);
91 uint8_t src[100]; 91 uint8_t src[100];
92 int srcCount = SkPackBits::Unpack8(dst, dstSize, src); 92 int srcCount = SkPackBits::Unpack8(dst, dstSize, src);
93 bool match = gTests[i].fCount == srcCount && 93 bool match = gTests[i].fCount == srcCount &&
94 memcmp(gTests[i].fSrc, src, 94 memcmp(gTests[i].fSrc, src,
95 gTests[i].fCount * sizeof(uint8_t)) == 0; 95 gTests[i].fCount * sizeof(uint8_t)) == 0;
96 REPORTER_ASSERT(reporter, match); 96 REPORTER_ASSERT(reporter, match);
97 } 97 }
98 98
99 for (size_t size = 1; size <= 512; size += 1) { 99 for (int size = 1; size <= 512; size += 1) {
100 for (int n = 100; n; n--) { 100 for (int n = 100; n; n--) {
101 uint8_t src[600], src2[600]; 101 uint8_t src[600], src2[600];
102 uint8_t dst[600]; 102 uint8_t dst[600];
103 rand_fill(src, size); 103 rand_fill(src, size);
104 104
105 size_t dstSize = SkPackBits::Pack8(src, size, dst); 105 size_t dstSize = SkPackBits::Pack8(src, size, dst);
106 size_t maxSize = SkPackBits::ComputeMaxSize8(size); 106 size_t maxSize = SkPackBits::ComputeMaxSize8(size);
107 REPORTER_ASSERT(reporter, maxSize >= dstSize); 107 REPORTER_ASSERT(reporter, maxSize >= dstSize);
108 108
109 size_t srcCount = SkPackBits::Unpack8(dst, dstSize, src2); 109 size_t srcCount = SkPackBits::Unpack8(dst, dstSize, src2);
(...skipping 12 matching lines...) Expand all
122 REPORTER_ASSERT(reporter, match); 122 REPORTER_ASSERT(reporter, match);
123 } 123 }
124 } 124 }
125 } 125 }
126 } 126 }
127 127
128 DEF_TEST(PackBits, reporter) { 128 DEF_TEST(PackBits, reporter) {
129 test_pack8(reporter); 129 test_pack8(reporter);
130 test_pack16(reporter); 130 test_pack16(reporter);
131 } 131 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698