Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "mojo/public/cpp/bindings/array.h" | 5 #include "mojo/public/cpp/bindings/array.h" |
| 6 #include "mojo/public/cpp/bindings/formatting.h" | |
| 6 #include "mojo/public/cpp/bindings/lib/array_internal.h" | 7 #include "mojo/public/cpp/bindings/lib/array_internal.h" |
| 7 #include "mojo/public/cpp/bindings/lib/array_serialization.h" | 8 #include "mojo/public/cpp/bindings/lib/array_serialization.h" |
| 8 #include "mojo/public/cpp/bindings/lib/fixed_buffer.h" | 9 #include "mojo/public/cpp/bindings/lib/fixed_buffer.h" |
| 9 #include "mojo/public/cpp/bindings/tests/container_test_util.h" | 10 #include "mojo/public/cpp/bindings/tests/container_test_util.h" |
| 10 #include "mojo/public/cpp/bindings/tests/iterator_test_util.h" | 11 #include "mojo/public/cpp/bindings/tests/iterator_test_util.h" |
| 11 #include "mojo/public/cpp/environment/environment.h" | 12 #include "mojo/public/cpp/environment/environment.h" |
| 12 #include "mojo/public/interfaces/bindings/tests/test_arrays.mojom.h" | 13 #include "mojo/public/interfaces/bindings/tests/test_arrays.mojom.h" |
| 13 #include "mojo/public/interfaces/bindings/tests/test_structs.mojom.h" | 14 #include "mojo/public/interfaces/bindings/tests/test_structs.mojom.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 16 |
| (...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 821 EXPECT_EQ(-3, array3[0]->width); | 822 EXPECT_EQ(-3, array3[0]->width); |
| 822 EXPECT_EQ(-4, array3[0]->height); | 823 EXPECT_EQ(-4, array3[0]->height); |
| 823 EXPECT_FALSE(array3[1].is_null()); | 824 EXPECT_FALSE(array3[1].is_null()); |
| 824 EXPECT_EQ(1, array3[1]->x); | 825 EXPECT_EQ(1, array3[1]->x); |
| 825 EXPECT_EQ(2, array3[1]->y); | 826 EXPECT_EQ(2, array3[1]->y); |
| 826 EXPECT_EQ(3, array3[1]->width); | 827 EXPECT_EQ(3, array3[1]->width); |
| 827 EXPECT_EQ(4, array3[1]->height); | 828 EXPECT_EQ(4, array3[1]->height); |
| 828 } | 829 } |
| 829 } | 830 } |
| 830 | 831 |
| 832 TEST_F(ArrayTest, OutputFormatting) { | |
|
viettrungluu
2016/01/26 18:44:05
Could you move all these tests to a formatting_uni
jeffbrown
2016/01/26 22:57:59
Done.
| |
| 833 Array<int32_t> null_array; | |
| 834 Array<int32_t> empty_array; | |
| 835 empty_array.resize(0); | |
| 836 Array<int32_t> one_element_array; | |
| 837 one_element_array.push_back(123); | |
| 838 Array<int32_t> three_element_array; | |
| 839 three_element_array.push_back(4); | |
| 840 three_element_array.push_back(5); | |
| 841 three_element_array.push_back(6); | |
| 842 | |
| 843 std::ostringstream so; | |
| 844 so << "null_array=" << null_array << ", empty_array=" << empty_array | |
| 845 << ", one_element_array=" << one_element_array | |
| 846 << ", three_element_array=" << three_element_array; | |
| 847 | |
| 848 EXPECT_EQ( | |
| 849 "null_array=null, " | |
| 850 "empty_array=[], " | |
| 851 "one_element_array=[123], " | |
| 852 "three_element_array=[4, 5, 6]", | |
| 853 so.str()); | |
| 854 } | |
| 855 | |
| 831 } // namespace | 856 } // namespace |
| 832 } // namespace test | 857 } // namespace test |
| 833 } // namespace mojo | 858 } // namespace mojo |
| OLD | NEW |