First public contribution.
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Name : exc_interwork.cpp
15 // Part of : standard c++ tests.
19 #include <stdcpp_support.h>
22 #include "test_decls.h"
24 // Test that the Symbian error codes are converted into propoer
33 TranslateSymErrorToCppException(KErrNoMemory);
35 catch(std::bad_alloc a) {
39 CPP_TESTS_ASSERT_ALLWAYS(0);
43 TranslateSymErrorToCppException(KErrArgument);
45 catch(std::invalid_argument ia) {
49 CPP_TESTS_ASSERT_ALLWAYS(0);
54 TranslateSymErrorToCppException(KErrOverflow);
56 catch(std::overflow_error oe) {
60 CPP_TESTS_ASSERT_ALLWAYS(0);
65 TranslateSymErrorToCppException(KErrUnderflow);
67 catch(std::underflow_error ue) {
71 CPP_TESTS_ASSERT_ALLWAYS(0);
76 TranslateSymErrorToCppException(1);
78 catch(Symbian_error e) {
82 CPP_TESTS_ASSERT_ALLWAYS(0);
85 CPP_TESTS_ASSERT_ALLWAYS(TotalCases == aPass);
88 // Test that the exception is converted to proper Symbian error code
92 int x = TranslateCppExceptionToSymError(a);
93 CPP_TESTS_ASSERT_ALLWAYS(x == KErrNoMemory);
98 int *ptr = new int(1);