Louis Yung-Chieh Lo | 4bbf21e | 2010-04-21 17:29:05 -0700 | [diff] [blame] | 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 | #ifndef VBOOT_REFERENCE_CGPTLIB_TESTS_CGPT_TEST_H_ |
| 6 | #define VBOOT_REFERENCE_CGPTLIB_TESTS_CGPT_TEST_H_ |
| 7 | |
| 8 | #include <stdio.h> |
| 9 | |
Louis Yung-Chieh Lo | 37f6b55 | 2010-04-22 21:22:22 -0700 | [diff] [blame^] | 10 | enum { |
| 11 | TEST_FAIL = -1, |
| 12 | TEST_OK = 0, |
| 13 | }; |
Louis Yung-Chieh Lo | 4bbf21e | 2010-04-21 17:29:05 -0700 | [diff] [blame] | 14 | |
| 15 | /* ANSI Color coding sequences. */ |
| 16 | #define COL_GREEN "\e[1;32m" |
| 17 | #define COL_RED "\e[0;31m" |
| 18 | #define COL_STOP "\e[m" |
| 19 | |
| 20 | #define EXPECT(expr) \ |
| 21 | if (!expr) { \ |
| 22 | printf(COL_RED " fail " COL_STOP "in expression %s in %s() line %d\n",\ |
| 23 | #expr, __FUNCTION__, __LINE__); \ |
| 24 | return TEST_FAIL; \ |
| 25 | } |
| 26 | |
| 27 | #endif /* VBOOT_REFERENCE_CGPTLIB_TESTS_CGPT_TEST_H_ */ |