update dev300-m58
[ooovba.git] / sal / qa / rtl / math / rtl_old_testint64.cxx
blob229450e1c3257f96f4fffea1053c1ce43ac26010
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: rtl_old_testint64.cxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sal.hxx"
34 // LLA:
35 // this file is converted to use with testshl2
36 // original was placed in sal/test/textenc.cxx
38 // fndef _OSL_DIAGNOSE_H_
39 // nclude <osl/diagnose.h>
40 // #endif
42 #include <sal/types.h>
44 #define TEST_ENSURE(c, m) CPPUNIT_ASSERT_MESSAGE((m), (c))
46 // #if OSL_DEBUG_LEVEL > 0
47 // #define TEST_ENSURE(c, m) OSL_ENSURE(c, m)
48 // #else
49 // #define TEST_ENSURE(c, m) OSL_VERIFY(c)
50 // #endif
52 #include <cppunit/simpleheader.hxx>
54 // -----------------------------------------------------------------------------
55 namespace rtl_math
57 class int64 : public CppUnit::TestFixture
59 public:
60 void test_int64();
62 CPPUNIT_TEST_SUITE( int64 );
63 CPPUNIT_TEST( test_int64 );
64 CPPUNIT_TEST_SUITE_END( );
67 void int64::test_int64()
69 #ifndef SAL_INT64_IS_STRUCT
70 #ifdef UNX
71 sal_Int64 i1 = -3223372036854775807LL;
72 sal_uInt64 u1 = 5223372036854775807ULL;
73 #else
74 sal_Int64 i1 = -3223372036854775807;
75 sal_uInt64 u1 = 5223372036854775807;
76 #endif
77 sal_Int64 i2 = 0;
78 sal_uInt64 u2 = 0;
79 #else
80 sal_Int64 i1;
81 sal_setInt64(&i1, 3965190145L, -750499787L);
83 sal_Int64 i2 = { 0, 0 };
85 sal_uInt64 u1;
86 sal_setUInt64(&u1, 1651507199UL, 1216161073UL);
88 sal_uInt64 u2 = {0, 0 };
90 #endif
91 sal_uInt32 low = 0;
92 sal_Int32 high = 0;
94 sal_getInt64(i1, &low, &high);
95 sal_setInt64(&i2, low, high);
97 sal_uInt32 ulow = 0;
98 sal_uInt32 uhigh = 0;
100 sal_getUInt64(u1, &ulow, &uhigh);
101 sal_setUInt64(&u2, ulow, uhigh);
103 #ifndef SAL_INT64_IS_STRUCT
104 TEST_ENSURE( i1 == i2, "test_int64 error 1");
106 TEST_ENSURE( u1 == u2, "test_int64 error 2");
107 #else
108 TEST_ENSURE( (i1.Part1 == i2.Part1) && (i1.Part2 == i2.Part2),
109 "test_int64 error 1");
111 TEST_ENSURE( (u1.Part1 == u2.Part1) && (u1.Part2 == u2.Part2),
112 "test_int64 error 2");
113 #endif
114 return;
117 } // namespace rtl_math
119 // -----------------------------------------------------------------------------
120 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( rtl_math::int64, "rtl_math" );
122 // -----------------------------------------------------------------------------
123 NOADDITIONAL;