OLD | NEW |
(Empty) | |
| 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 * Use of this source code is governed by a BSD-style license that can be |
| 3 * found in the LICENSE file. |
| 4 * |
| 5 * Common functions used by tests. |
| 6 */ |
| 7 |
| 8 #include "test_common.h" |
| 9 |
| 10 #include <stdio.h> |
| 11 |
| 12 /* ANSI Color coding sequences. */ |
| 13 #define COL_GREEN "\e[1;32m" |
| 14 #define COL_RED "\e[0;31m]" |
| 15 #define COL_STOP "\e[m" |
| 16 |
| 17 /* Global test success flag. */ |
| 18 int gTestSuccess = 1; |
| 19 |
| 20 int TEST_EQ(int result, int expected_result, char* testname) { |
| 21 if (result == expected_result) { |
| 22 fprintf(stderr, "%s Test " COL_GREEN " PASSED\n" COL_STOP, testname); |
| 23 return 1; |
| 24 } |
| 25 else { |
| 26 fprintf(stderr, "%s Test " COL_RED " FAILED\n" COL_STOP, testname); |
| 27 gTestSuccess = 0; |
| 28 return 0; |
| 29 } |
| 30 } |
OLD | NEW |