| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/assert.h" | 5 #include "platform/assert.h" |
| 6 #include "vm/unit_test.h" | 6 #include "vm/unit_test.h" |
| 7 | 7 |
| 8 | |
| 9 VM_UNIT_TEST_CASE(Assert) { | 8 VM_UNIT_TEST_CASE(Assert) { |
| 10 ASSERT(true); | 9 ASSERT(true); |
| 11 ASSERT(87 == 87); | 10 ASSERT(87 == 87); |
| 12 ASSERT(42 != 87); | 11 ASSERT(42 != 87); |
| 13 } | 12 } |
| 14 | 13 |
| 15 | |
| 16 VM_UNIT_TEST_CASE(Expect) { | 14 VM_UNIT_TEST_CASE(Expect) { |
| 17 EXPECT(true); | 15 EXPECT(true); |
| 18 EXPECT(87 == 87); | 16 EXPECT(87 == 87); |
| 19 EXPECT(42 != 87); | 17 EXPECT(42 != 87); |
| 20 | 18 |
| 21 EXPECT_EQ(0, 0); | 19 EXPECT_EQ(0, 0); |
| 22 EXPECT_EQ(42, 42); | 20 EXPECT_EQ(42, 42); |
| 23 EXPECT_EQ(true, true); | 21 EXPECT_EQ(true, true); |
| 24 void* pointer = reinterpret_cast<void*>(42); | 22 void* pointer = reinterpret_cast<void*>(42); |
| 25 EXPECT_EQ(pointer, pointer); | 23 EXPECT_EQ(pointer, pointer); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 40 EXPECT_GT(2.3, 2.2229); | 38 EXPECT_GT(2.3, 2.2229); |
| 41 | 39 |
| 42 EXPECT_GE(4, 4); | 40 EXPECT_GE(4, 4); |
| 43 EXPECT_GE(15.3, 15.3); | 41 EXPECT_GE(15.3, 15.3); |
| 44 EXPECT_GE(5, 3); | 42 EXPECT_GE(5, 3); |
| 45 | 43 |
| 46 EXPECT_FLOAT_EQ(15.43, 15.44, 0.01); | 44 EXPECT_FLOAT_EQ(15.43, 15.44, 0.01); |
| 47 EXPECT_FLOAT_EQ(1.43, 1.43, 0.00); | 45 EXPECT_FLOAT_EQ(1.43, 1.43, 0.00); |
| 48 } | 46 } |
| 49 | 47 |
| 50 | |
| 51 VM_UNIT_TEST_CASE(Fail0) { | 48 VM_UNIT_TEST_CASE(Fail0) { |
| 52 FAIL("This test fails"); | 49 FAIL("This test fails"); |
| 53 } | 50 } |
| 54 | 51 |
| 55 | |
| 56 VM_UNIT_TEST_CASE(Fail1) { | 52 VM_UNIT_TEST_CASE(Fail1) { |
| 57 FAIL1("This test fails with one argument: %d", 4); | 53 FAIL1("This test fails with one argument: %d", 4); |
| 58 } | 54 } |
| 59 | 55 |
| 60 | |
| 61 VM_UNIT_TEST_CASE(Fail2) { | 56 VM_UNIT_TEST_CASE(Fail2) { |
| 62 FAIL2("This test fails with two arguments: %d, %d", -100, 42); | 57 FAIL2("This test fails with two arguments: %d, %d", -100, 42); |
| 63 } | 58 } |
| OLD | NEW |