1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/genericopenlibs/cppstdlib/test/include/test_decls.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,53 @@
1.4 +/*
1.5 +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +#ifndef __TEST_DECLS_H__
1.22 +#define __TEST_DECLS_H__
1.23 +
1.24 +#include <assert.h>
1.25 +#include <stdio.h>
1.26 +
1.27 +inline void log_stat(const char* funcName, const char* fileName, int line, const char* expr, int status)
1.28 +{
1.29 + FILE* file = fopen("c:\\logs\\libstdcpp_runtime_tests.log", "a+");
1.30 + fprintf(file, "%s %s %d %s ::",fileName, funcName, line, expr);
1.31 + if(status == 0)
1.32 + fprintf(file, "%s", "PASSED\n");
1.33 + else if(status == 1)
1.34 + fprintf(file, "%s", "FAILED\n");
1.35 + else
1.36 + fprintf(file, "%s","IGNORED\n");
1.37 +
1.38 + fclose (file);
1.39 +}
1.40 +
1.41 +inline void log_success(const char* funcName, const char* fileName, int line, const char* expr)
1.42 +{
1.43 + log_stat(funcName, fileName, line, expr, 0);
1.44 +}
1.45 +
1.46 +inline void log_failure(const char* funcName, const char* fileName, int line, const char* expr)
1.47 +{
1.48 + log_stat(funcName, fileName, line, expr, 1);
1.49 +}
1.50 +
1.51 +#define CPP_TESTS_ASSERT_ALLWAYS(expr) ( (expr) ? log_success(__PRETTY_FUNCTION__, __FILE__,\
1.52 + __LINE__, #expr) : \
1.53 + log_failure(__PRETTY_FUNCTION__, __FILE__, \
1.54 + __LINE__, #expr))
1.55 +
1.56 +#endif //__TEST_DECLS_H__
1.57 \ No newline at end of file