|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __TEST_DECLS_H__ |
|
19 #define __TEST_DECLS_H__ |
|
20 |
|
21 #include <assert.h> |
|
22 #include <stdio.h> |
|
23 |
|
24 inline void log_stat(const char* funcName, const char* fileName, int line, const char* expr, int status) |
|
25 { |
|
26 FILE* file = fopen("c:\\logs\\libstdcpp_runtime_tests.log", "a+"); |
|
27 fprintf(file, "%s %s %d %s ::",fileName, funcName, line, expr); |
|
28 if(status == 0) |
|
29 fprintf(file, "%s", "PASSED\n"); |
|
30 else if(status == 1) |
|
31 fprintf(file, "%s", "FAILED\n"); |
|
32 else |
|
33 fprintf(file, "%s","IGNORED\n"); |
|
34 |
|
35 fclose (file); |
|
36 } |
|
37 |
|
38 inline void log_success(const char* funcName, const char* fileName, int line, const char* expr) |
|
39 { |
|
40 log_stat(funcName, fileName, line, expr, 0); |
|
41 } |
|
42 |
|
43 inline void log_failure(const char* funcName, const char* fileName, int line, const char* expr) |
|
44 { |
|
45 log_stat(funcName, fileName, line, expr, 1); |
|
46 } |
|
47 |
|
48 #define CPP_TESTS_ASSERT_ALLWAYS(expr) ( (expr) ? log_success(__PRETTY_FUNCTION__, __FILE__,\ |
|
49 __LINE__, #expr) : \ |
|
50 log_failure(__PRETTY_FUNCTION__, __FILE__, \ |
|
51 __LINE__, #expr)) |
|
52 |
|
53 #endif //__TEST_DECLS_H__ |