FC18: Moved NAN to last for better bit pattern layout
This commit is contained in:
parent
49150be3b1
commit
37992ce50a
3 changed files with 163 additions and 17 deletions
|
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.fc18.zion7.flame4;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Tests four corner freman suite fittings
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Se[ 5, 2025
|
||||
*/
|
||||
public class FCFlameFremanSuitTest {
|
||||
|
||||
@Test
|
||||
public void testDataSize() throws Exception {
|
||||
Assertions.assertEquals(768, FCFlameFremanChocoBase8.CHOCO_2304.octals());
|
||||
Assertions.assertEquals(6, FCFlameFremanLegoBase8.LEGO_0018.octals());
|
||||
Assertions.assertEquals(8, FCFlameFremanSignedBase2.SIGNED_0064.bytes());
|
||||
Assertions.assertEquals(2, FCFlameFremanLegoBase2.LEGO_0016.bytes());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuitChocoBase8() throws Exception {
|
||||
Arrays.asList(FCFlameFremanChocoBase8.values()).forEach(v -> checkSuite(v));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuitLegoBase8() throws Exception {
|
||||
Arrays.asList(FCFlameFremanLegoBase8.values()).forEach(v -> checkSuite(v));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuitSignedBase2() throws Exception {
|
||||
Arrays.asList(FCFlameFremanSignedBase2.values()).forEach(v -> checkSuite(v));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuitLegoBase2() throws Exception {
|
||||
Arrays.asList(FCFlameFremanLegoBase2.values()).forEach(v -> checkSuite(v));
|
||||
}
|
||||
|
||||
|
||||
private void checkSuite(FCFlameFremanSuit suit) {
|
||||
Assertions.assertTrue(suit.cakeOffsetSel0() > 0);
|
||||
Assertions.assertFalse(suit.cakeOffsetSel0() < 0);
|
||||
Assertions.assertTrue(suit.cakeOffsetBank() > 0);
|
||||
Assertions.assertFalse(suit.cakeOffsetBank() < 0);
|
||||
Assertions.assertNotEquals(BigInteger.ZERO, suit.maxWaterLevel());
|
||||
Assertions.assertNotEquals(BigInteger.ONE, suit.maxWaterLevel());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.fc18.zion7.flame4;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Tests four corner number taste logic.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Se[ 5, 2025
|
||||
*/
|
||||
public class FCFlameNumberTasteTest {
|
||||
|
||||
@Test
|
||||
public void testChocoSign() throws Exception {
|
||||
FCFlameNumberTaste taste = FCFlameNumberTaste.NUMBER_POSITIVE;
|
||||
Assertions.assertTrue(taste.statusSignPositive());
|
||||
Assertions.assertFalse(taste.statusSignNegative());
|
||||
|
||||
taste = FCFlameNumberTaste.INFINITY_NEGATIVE_CARRY;
|
||||
Assertions.assertFalse(taste.statusSignPositive());
|
||||
Assertions.assertTrue(taste.statusSignNegative());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMeltCycle() throws Exception {
|
||||
FCFlameNumberTaste taste = FCFlameNumberTaste.NUMBER_POSITIVE;
|
||||
FCFlameNumberTaste tasteNew = taste.chocoRemeltDown();
|
||||
Assertions.assertEquals(taste, tasteNew);
|
||||
tasteNew = tasteNew.chocoRemeltUp();
|
||||
Assertions.assertEquals(FCFlameNumberTaste.NUMBER_POSITIVE_CARRY, tasteNew);
|
||||
tasteNew = tasteNew.chocoRemeltUp();
|
||||
Assertions.assertEquals(FCFlameNumberTaste.INFINITY_POSITIVE, tasteNew);
|
||||
tasteNew = tasteNew.chocoRemeltUp();
|
||||
Assertions.assertEquals(FCFlameNumberTaste.INFINITY_POSITIVE_CARRY, tasteNew);
|
||||
tasteNew = tasteNew.chocoRemeltUp();
|
||||
Assertions.assertEquals(FCFlameNumberTaste.FLAG_ROUNDED, tasteNew);
|
||||
tasteNew = tasteNew.chocoRemeltUp();
|
||||
Assertions.assertEquals(FCFlameNumberTaste.FLAG_NAN, tasteNew);
|
||||
tasteNew = tasteNew.chocoRemeltUp();
|
||||
Assertions.assertEquals(FCFlameNumberTaste.FLAG_NAN, tasteNew);
|
||||
tasteNew = tasteNew.chocoRemeltUp();
|
||||
Assertions.assertEquals(FCFlameNumberTaste.FLAG_NAN, tasteNew);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue