1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: rtl_old_testint64.cxx,v $
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"
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>
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)
49 // #define TEST_ENSURE(c, m) OSL_VERIFY(c)
52 #include <cppunit/simpleheader.hxx>
54 // -----------------------------------------------------------------------------
57 class int64
: public CppUnit::TestFixture
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
71 sal_Int64 i1
= -3223372036854775807LL;
72 sal_uInt64 u1
= 5223372036854775807ULL;
74 sal_Int64 i1
= -3223372036854775807;
75 sal_uInt64 u1
= 5223372036854775807;
81 sal_setInt64(&i1
, 3965190145L, -750499787L);
83 sal_Int64 i2
= { 0, 0 };
86 sal_setUInt64(&u1
, 1651507199UL, 1216161073UL);
88 sal_uInt64 u2
= {0, 0 };
94 sal_getInt64(i1
, &low
, &high
);
95 sal_setInt64(&i2
, low
, high
);
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");
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");
117 } // namespace rtl_math
119 // -----------------------------------------------------------------------------
120 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( rtl_math::int64
, "rtl_math" );
122 // -----------------------------------------------------------------------------