OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 25 matching lines...) Loading... |
36 test_coefficients, | 36 test_coefficients, |
37 test_coefficients, | 37 test_coefficients, |
38 kTestCoefficientsLength, | 38 kTestCoefficientsLength, |
39 kLevels); | 39 kLevels); |
40 ASSERT_EQ(kExpectedNumberOfNodes, tree.num_nodes()); | 40 ASSERT_EQ(kExpectedNumberOfNodes, tree.num_nodes()); |
41 // Checks for NodeAt(level, index). | 41 // Checks for NodeAt(level, index). |
42 int nodes_at_level = 0; | 42 int nodes_at_level = 0; |
43 for (int level = 0; level <= kLevels; ++level) { | 43 for (int level = 0; level <= kLevels; ++level) { |
44 nodes_at_level = 1 << level; | 44 nodes_at_level = 1 << level; |
45 for (int i = 0; i < nodes_at_level; ++i) { | 45 for (int i = 0; i < nodes_at_level; ++i) { |
46 ASSERT_TRUE(NULL != tree.NodeAt(level, i)); | 46 ASSERT_TRUE(nullptr != tree.NodeAt(level, i)); |
47 } | 47 } |
48 // Out of bounds. | 48 // Out of bounds. |
49 EXPECT_EQ(NULL, tree.NodeAt(level, -1)); | 49 EXPECT_EQ(nullptr, tree.NodeAt(level, -1)); |
50 EXPECT_EQ(NULL, tree.NodeAt(level, -12)); | 50 EXPECT_EQ(nullptr, tree.NodeAt(level, -12)); |
51 EXPECT_EQ(NULL, tree.NodeAt(level, nodes_at_level)); | 51 EXPECT_EQ(nullptr, tree.NodeAt(level, nodes_at_level)); |
52 EXPECT_EQ(NULL, tree.NodeAt(level, nodes_at_level + 5)); | 52 EXPECT_EQ(nullptr, tree.NodeAt(level, nodes_at_level + 5)); |
53 } | 53 } |
54 // Out of bounds. | 54 // Out of bounds. |
55 EXPECT_EQ(NULL, tree.NodeAt(-1, 0)); | 55 EXPECT_EQ(nullptr, tree.NodeAt(-1, 0)); |
56 EXPECT_EQ(NULL, tree.NodeAt(-12, 0)); | 56 EXPECT_EQ(nullptr, tree.NodeAt(-12, 0)); |
57 EXPECT_EQ(NULL, tree.NodeAt(kLevels + 1, 0)); | 57 EXPECT_EQ(nullptr, tree.NodeAt(kLevels + 1, 0)); |
58 EXPECT_EQ(NULL, tree.NodeAt(kLevels + 5, 0)); | 58 EXPECT_EQ(nullptr, tree.NodeAt(kLevels + 5, 0)); |
59 // Checks for Update(). | 59 // Checks for Update(). |
60 EXPECT_EQ(0, tree.Update(test_buffer, kTestBufferSize)); | 60 EXPECT_EQ(0, tree.Update(test_buffer, kTestBufferSize)); |
61 EXPECT_EQ(-1, tree.Update(NULL, kTestBufferSize)); | 61 EXPECT_EQ(-1, tree.Update(nullptr, kTestBufferSize)); |
62 EXPECT_EQ(-1, tree.Update(test_buffer, kTestBufferSize - 1)); | 62 EXPECT_EQ(-1, tree.Update(test_buffer, kTestBufferSize - 1)); |
63 } | 63 } |
64 | 64 |
65 // This test is for the correctness of the tree. | 65 // This test is for the correctness of the tree. |
66 // Checks the results from the Matlab equivalent, it is done comparing the | 66 // Checks the results from the Matlab equivalent, it is done comparing the |
67 // results that are stored in the output files from Matlab. | 67 // results that are stored in the output files from Matlab. |
68 // It also writes the results in its own set of files in the out directory. | 68 // It also writes the results in its own set of files in the out directory. |
69 // Matlab and output files contain all the results in double precision (Little | 69 // Matlab and output files contain all the results in double precision (Little |
70 // endian) appended. | 70 // endian) appended. |
71 #if defined(WEBRTC_IOS) | 71 #if defined(WEBRTC_IOS) |
(...skipping 112 matching lines...) Loading... |
184 // Close all matlab and out files. | 184 // Close all matlab and out files. |
185 for (int i = 0; i < kLeaves; ++i) { | 185 for (int i = 0; i < kLeaves; ++i) { |
186 matlab_files_data[i]->CloseFile(); | 186 matlab_files_data[i]->CloseFile(); |
187 out_files_data[i]->CloseFile(); | 187 out_files_data[i]->CloseFile(); |
188 } | 188 } |
189 | 189 |
190 test_file->CloseFile(); | 190 test_file->CloseFile(); |
191 } | 191 } |
192 | 192 |
193 } // namespace webrtc | 193 } // namespace webrtc |
OLD | NEW |