OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 TEST(BidiResolver, Basic) | 45 TEST(BidiResolver, Basic) |
46 { | 46 { |
47 bool hasStrongDirectionality; | 47 bool hasStrongDirectionality; |
48 String value("foo"); | 48 String value("foo"); |
49 TextRun run(value); | 49 TextRun run(value); |
50 BidiResolver<TextRunIterator, BidiCharacterRun> bidiResolver; | 50 BidiResolver<TextRunIterator, BidiCharacterRun> bidiResolver; |
51 bidiResolver.setStatus(BidiStatus(run.direction(), run.directionalOverride()
)); | 51 bidiResolver.setStatus(BidiStatus(run.direction(), run.directionalOverride()
)); |
52 bidiResolver.setPositionIgnoringNestedIsolates(TextRunIterator(&run, 0)); | 52 bidiResolver.setPositionIgnoringNestedIsolates(TextRunIterator(&run, 0)); |
53 TextDirection direction = bidiResolver.determineParagraphDirectionality(&has
StrongDirectionality); | 53 TextDirection direction = bidiResolver.determineParagraphDirectionality(&has
StrongDirectionality); |
54 EXPECT_TRUE(hasStrongDirectionality); | 54 EXPECT_TRUE(hasStrongDirectionality); |
55 EXPECT_EQ(direction, LTR); | 55 EXPECT_EQ(LTR, direction); |
56 } | 56 } |
57 | 57 |
58 class BidiTestRunner { | 58 class BidiTestRunner { |
59 public: | 59 public: |
60 BidiTestRunner() | 60 BidiTestRunner() |
61 : m_testsRun(0) | 61 : m_testsRun(0) |
62 , m_testsSkipped(0) | 62 , m_testsSkipped(0) |
63 , m_ignoredCharFailures(0) | 63 , m_ignoredCharFailures(0) |
64 , m_levelFailures(0) | 64 , m_levelFailures(0) |
65 , m_orderFailures(0) | 65 , m_orderFailures(0) |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 harness.parse(bidiTestFile); | 231 harness.parse(bidiTestFile); |
232 bidiTestFile.close(); | 232 bidiTestFile.close(); |
233 | 233 |
234 if (runner.m_testsSkipped) | 234 if (runner.m_testsSkipped) |
235 printf("WARNING: Skipped %zu tests.\n", runner.m_testsSkipped); | 235 printf("WARNING: Skipped %zu tests.\n", runner.m_testsSkipped); |
236 printf("Ran %zu tests: %zu level failures %zu order failures.\n", | 236 printf("Ran %zu tests: %zu level failures %zu order failures.\n", |
237 runner.m_testsRun, runner.m_levelFailures, runner.m_orderFailures); | 237 runner.m_testsRun, runner.m_levelFailures, runner.m_orderFailures); |
238 | 238 |
239 // The unittest harness only pays attention to GTest output, so we verify | 239 // The unittest harness only pays attention to GTest output, so we verify |
240 // that the tests behaved as expected: | 240 // that the tests behaved as expected: |
241 EXPECT_EQ(runner.m_testsRun, 352098u); | 241 EXPECT_EQ(352098u, runner.m_testsRun); |
242 EXPECT_EQ(runner.m_testsSkipped, 418143u); | 242 EXPECT_EQ(418143u, runner.m_testsSkipped); |
243 EXPECT_EQ(runner.m_ignoredCharFailures, 0u); | 243 EXPECT_EQ(0u, runner.m_ignoredCharFailures); |
244 EXPECT_EQ(runner.m_levelFailures, 44887u); | 244 EXPECT_EQ(44882u, runner.m_levelFailures); |
245 EXPECT_EQ(runner.m_orderFailures, 19153u); | 245 EXPECT_EQ(19151u, runner.m_orderFailures); |
246 } | 246 } |
247 | 247 |
248 } | 248 } |
OLD | NEW |