Skip to content

Commit

Permalink
Merge pull request #143 from VermaSh/update_daa_tests
Browse files Browse the repository at this point in the history
Add resoning behind comparison to -0 and +0
  • Loading branch information
llxia authored Apr 14, 2022
2 parents 1338a44 + 54d777e commit 8fc0315
Showing 1 changed file with 57 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2017, 2019 IBM Corp.
* Copyright (c) 2017, 2022 IBM Corp.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which accompanies this distribution
Expand Down Expand Up @@ -2519,6 +2519,14 @@ public void testShiftLeftInvalidPrecision()
@Test
public void testLeftOffsetOne()
{
/* Both expectedArray and expectedArray2 are needed because
* there was a behavioral change for VSRP instruction on z15
* and up. On z15 and up, if the result following the shift
* is 0, it is treated as positive. However, on prior
* hardware the 0 would retain the sign of the input packed
* decimal. For example: doing a left shift by 1 on 5D (-5)
* would result in 0D (-0) on z14; and 0C (+0) on z15 and above.
*/
byte[] inputArray = new byte[10];
byte[] outputArray = new byte[10];
byte[] expectedArray = new byte[10];
Expand Down Expand Up @@ -3449,6 +3457,14 @@ public double shiftRight(double x, int shift, boolean round)
@Test
public void testShiftLeftUnitCases()
{
/* Both expectedArray and expectedArray2 are needed because
* there was a behavioral change for VSRP instruction on z15
* and up. On z15 and up, if the result following the shift
* is 0, it is treated as positive. However, on prior
* hardware the 0 would retain the sign of the input packed
* decimal. For example: doing a left shift by 1 on 5D (-5)
* would result in 0D (-0) on z14; and 0C (+0) on z15 and above.
*/
byte[] inputArray = new byte[10];
byte[] outputArray = new byte[10];
byte[] expectedArray = new byte[10];
Expand Down Expand Up @@ -3554,6 +3570,14 @@ public void testShiftLeftUnitCases()
@Test
public void testShiftRightUnitCases()
{
/* Both expectedArray and expectedArray2 are needed because
* there was a behavioral change for VSRP instruction on z15
* and up. On z15 and up, if the result following the shift
* is 0, it is treated as positive. However, on prior
* hardware the 0 would retain the sign of the input packed
* decimal. For example: doing a left shift by 1 on 5D (-5)
* would result in 0D (-0) on z14; and 0C (+0) on z15 and above.
*/
byte[] inputArray = new byte[10];
byte[] outputArray = new byte[10];
byte[] expectedArray = new byte[10];
Expand Down Expand Up @@ -4481,6 +4505,14 @@ public void testRightShiftTopNibbleGarbage()
@Test
public void testZeroShifts1()
{
/* Both expectedArray and expectedArray2 are needed because
* there was a behavioral change for VSRP instruction on z15
* and up. On z15 and up, if the result following the shift
* is 0, it is treated as positive. However, on prior
* hardware the 0 would retain the sign of the input packed
* decimal. For example: doing a left shift by 1 on 5D (-5)
* would result in 0D (-0) on z14; and 0C (+0) on z15 and above.
*/
byte[] inputArray = new byte[10];
byte[] outputArray = new byte[10];
byte[] expectedArray = new byte[10];
Expand Down Expand Up @@ -4508,6 +4540,14 @@ public void testZeroShifts1()
@Test
public void testZeroShifts2()
{
/* Both expectedArray and expectedArray2 are needed because
* there was a behavioral change for VSRP instruction on z15
* and up. On z15 and up, if the result following the shift
* is 0, it is treated as positive. However, on prior
* hardware the 0 would retain the sign of the input packed
* decimal. For example: doing a left shift by 1 on 5D (-5)
* would result in 0D (-0) on z14; and 0C (+0) on z15 and above.
*/
byte[] inputArray = new byte[10];
byte[] outputArray = new byte[10];
byte[] expectedArray = new byte[10];
Expand All @@ -4532,6 +4572,14 @@ public void testZeroShifts2()
@Test
public void testZeroShifts3()
{
/* Both expectedArray and expectedArray2 are needed because
* there was a behavioral change for VSRP instruction on z15
* and up. On z15 and up, if the result following the shift
* is 0, it is treated as positive. However, on prior
* hardware the 0 would retain the sign of the input packed
* decimal. For example: doing a left shift by 1 on 5D (-5)
* would result in 0D (-0) on z14; and 0C (+0) on z15 and above.
*/
byte[] inputArray = new byte[10];
byte[] outputArray = new byte[10];
byte[] expectedArray = new byte[10];
Expand Down Expand Up @@ -4561,6 +4609,14 @@ public void testZeroShifts3()
@Test
public void testZeroShifts4()
{
/* Both expectedArray and expectedArray2 are needed because
* there was a behavioral change for VSRP instruction on z15
* and up. On z15 and up, if the result following the shift
* is 0, it is treated as positive. However, on prior
* hardware the 0 would retain the sign of the input packed
* decimal. For example: doing a left shift by 1 on 5D (-5)
* would result in 0D (-0) on z14; and 0C (+0) on z15 and above.
*/
byte[] inputArray = new byte[10];
byte[] outputArray = new byte[10];
byte[] expectedArray = new byte[10];
Expand Down

0 comments on commit 8fc0315

Please sign in to comment.