/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
** testll.c -- test suite for 64bit integer (longlong) operations
**
** Summary: testll [-d] | [-h]
**
** Where:
** -d set debug mode on; displays individual test failures
** -v verbose mode; displays progress in test, plus -d
** -h gives usage message.
**
** Description:
**
** Successive tests begin to depend on other LL functions working
** correctly. So, ... Do not change the order of the tests as run
** from main().
**
** Caveats:
** Do not even begin to think that this is an exhaustive test!
**
** These tests try a little of everything, but not all boundary
** conditions and limits are tested.
** You want better coverage? ... Add it.
**
** ---
** Author: Lawrence Hardiman <larryh@netscape.com>.
** ---
** Revision History:
** 01-Oct-1997. Original implementation.
**
*/
#include "nspr.h"
#include "plgetopt.h"
/* --- Local Definitions --- */
/* --- Global variables --- */
/*
** Constants used in tests.
*/
/*
** SetFailed() -- Report individual test failure
**
*/
static void
{
failedAlready = 1;
if ( debugMode )
return;
}
static void
{
if ( debugMode)
{
}
return;
}
/*
** TestAssignment() -- Test the assignment
*/
static void TestAssignment( void )
{
}
/*
** TestComparisons() -- Test the longlong comparison operations
*/
static void
TestComparisons( void )
{
ReportProgress("Testing Comparisons Operations\n");
/* test for zero */
if ( !LL_IS_ZERO( bigZero ))
if ( LL_IS_ZERO( bigOne ))
if ( LL_IS_ZERO( bigMinusOne ))
/* test equal */
/* test not equal */
/* Greater than or equal to zero */
if ( !LL_GE_ZERO( bigZero ))
if ( !LL_GE_ZERO( bigOne ))
if ( !LL_GE_ZERO( bigNumber ))
if ( LL_GE_ZERO( bigMinusOne ))
if ( LL_GE_ZERO( bigMinusNumber ))
/* Algebraic Compare two values */
/* Two positive numbers */
/* Two negative numbers */
/* One positive, one negative */
/* Bitwise Compare two numbers */
/* Two positive numbers */
/* Two negative numbers */
/* One positive, one negative */
return;
}
/*
** TestLogicalOperations() -- Tests for AND, OR, ...
**
*/
static void
TestLogicalOperations( void )
{
ReportProgress("Testing Logical Operations\n");
/* Test AND */
if ( !LL_IS_ZERO( result ))
if ( LL_IS_ZERO( result ))
if ( !LL_IS_ZERO( result ))
/* test OR */
if ( !LL_IS_ZERO( result ))
if ( LL_IS_ZERO( result ))
/* test XOR */
/* test OR2. */
/* test NOT */
/* test Negation */
return;
}
/*
** TestConversion() -- Test Conversion Operations
**
*/
static void
TestConversion( void )
{
float resultF;
ReportProgress("Testing Conversion Operations\n");
/* LL_L2I -- Convert to signed 32bit */
/* LL_L2UI -- Convert 64bit to unsigned 32bit */
/* LL_L2F -- Convert to 32bit floating point */
if ( resultF != 1.0 )
if ( resultF != -1.0 )
/* LL_L2D -- Convert to 64bit floating point */
if ( resultD != 1.0L )
if ( resultD != -1.0L )
/* LL_I2L -- Convert 32bit signed to 64bit signed */
/* LL_UI2L -- Convert 32bit unsigned to 64bit unsigned */
/* [lth.] This did not behave as expected, but it is correct
*/
/* LL_F2L -- Convert 32bit float to 64bit signed */
/* LL_D2L -- Convert 64bit Float to 64bit signed */
return;
}
static void ShiftCompileOnly()
{
/*
** This function is only compiled, never called.
** The real test is to see if it compiles w/o
** warnings. This is no small feat, by the way.
*/
} /* ShiftCompileOnly */
/*
** TestShift() -- Test Shifting Operations
**
*/
static void
TestShift( void )
{
ReportProgress("Testing Shifting Operations\n");
/* LL_SHL -- Shift left algebraic */
/* LL_SHR -- Shift right algebraic */
/* LL_USHR -- Logical shift right */
/* LL_ISHL -- Shift a 32bit integer into a 64bit result */
return;
}
/*
** TestArithmetic() -- Test arithmetic operations.
**
*/
static void
TestArithmetic( void )
{
/* Addition */
/* Subtraction */
/* Multiply */
/* LL_DIV() Division */
/* LL_MOD() Modulo Division */
/* LL_UDIVMOD */
return;
}
static void TestWellknowns(void)
{
} /* TestWellknowns */
/*
** Initialize() -- Initialize the test case
**
** Parse command line options
**
*/
static PRIntn
{
/*
** Parse command line options
*/
{
if (PL_OPT_BAD == os) continue;
{
case 'd': /* set debug mode */
break;
case 'v': /* set verbose mode */
break;
case 'h': /* user wants some guidance */
default:
return(1);
}
}
return(0);
}
{
return(1);
TestShift();
/*
** That's all folks!
*/
if ( failedAlready )
{
}
else
{
}
return failedAlready;
} /* end main() */