History

astyle all

huili2 committed 12 years ago

Commit dc3fae41 parent 101265385 files · +4906 −4701Browse files

Showing the changes to test/api/decoder_test.cpp (1 of 85 files). Show all

Unified · Split

test/api/decoder_test.cpp+16−16
@@ -2,10 +2,10 @@ · 1 unmodified line
2#include "utils/HashFunctions.h"2#include "utils/HashFunctions.h"
3#include "BaseDecoderTest.h"3#include "BaseDecoderTest.h"
4 4
5static void UpdateHashFromPlane(SHA1Context* ctx, const uint8_t* plane,5static void UpdateHashFromPlane (SHA1Context* ctx, const uint8_t* plane,
6 int width, int height, int stride) {6 int width, int height, int stride) {
7 for (int i = 0; i < height; i++) {7 for (int i = 0; i < height; i++) {
8 SHA1Input(ctx, plane, width);8 SHA1Input (ctx, plane, width);
9 plane += stride;9 plane += stride;
10 }10 }
11}11}
@@ -21,7 +21,7 @@ class DecoderInitTest : public ::testing::Test, public BaseDecoderTest { · 9 unmodified lines
21 }21 }
22};22};
23 23
24TEST_F(DecoderInitTest, JustInit) {}24TEST_F (DecoderInitTest, JustInit) {}
25 25
26struct FileParam {26struct FileParam {
27 const char* fileName;27 const char* fileName;
@@ -29,35 +29,35 @@ struct FileParam { · 1 unmodified line
29};29};
30 30
31class DecoderOutputTest : public ::testing::WithParamInterface<FileParam>,31class DecoderOutputTest : public ::testing::WithParamInterface<FileParam>,
32 public DecoderInitTest, public BaseDecoderTest::Callback {32 public DecoderInitTest, public BaseDecoderTest::Callback {
33 public:33 public:
34 virtual void SetUp() {34 virtual void SetUp() {
35 DecoderInitTest::SetUp();35 DecoderInitTest::SetUp();
36 if (HasFatalFailure()) {36 if (HasFatalFailure()) {
37 return;37 return;
38 }38 }
39 SHA1Reset(&ctx_);39 SHA1Reset (&ctx_);
40 }40 }
41 virtual void onDecodeFrame(const Frame& frame) {41 virtual void onDecodeFrame (const Frame& frame) {
42 const Plane& y = frame.y;42 const Plane& y = frame.y;
43 const Plane& u = frame.u;43 const Plane& u = frame.u;
44 const Plane& v = frame.v;44 const Plane& v = frame.v;
45 UpdateHashFromPlane(&ctx_, y.data, y.width, y.height, y.stride);45 UpdateHashFromPlane (&ctx_, y.data, y.width, y.height, y.stride);
46 UpdateHashFromPlane(&ctx_, u.data, u.width, u.height, u.stride);46 UpdateHashFromPlane (&ctx_, u.data, u.width, u.height, u.stride);
47 UpdateHashFromPlane(&ctx_, v.data, v.width, v.height, v.stride);47 UpdateHashFromPlane (&ctx_, v.data, v.width, v.height, v.stride);
48 }48 }
49 protected:49 protected:
50 SHA1Context ctx_;50 SHA1Context ctx_;
51};51};
52 52
53TEST_P(DecoderOutputTest, CompareOutput) {53TEST_P (DecoderOutputTest, CompareOutput) {
54 FileParam p = GetParam();54 FileParam p = GetParam();
55 DecodeFile(p.fileName, this);55 DecodeFile (p.fileName, this);
56 56
57 unsigned char digest[SHA_DIGEST_LENGTH];57 unsigned char digest[SHA_DIGEST_LENGTH];
58 SHA1Result(&ctx_, digest);58 SHA1Result (&ctx_, digest);
59 if (!HasFatalFailure()) {59 if (!HasFatalFailure()) {
60 CompareHash(digest, p.hashStr);60 CompareHash (digest, p.hashStr);
61 }61 }
62}62}
63 63
@@ -96,5 +96,5 @@ static const FileParam kFileParamArray[] = { · 32 unmodified lines
96 {"res/SVA_NL2_E.264", "70453ef8097c94dd190d6d2d1d5cb83c67e66238"}96 {"res/SVA_NL2_E.264", "70453ef8097c94dd190d6d2d1d5cb83c67e66238"}
97};97};
98 98
99INSTANTIATE_TEST_CASE_P(DecodeFile, DecoderOutputTest,99INSTANTIATE_TEST_CASE_P (DecodeFile, DecoderOutputTest,
100 ::testing::ValuesIn(kFileParamArray));100 ::testing::ValuesIn (kFileParamArray));

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t