1 /*
2  * Copyright (c) 2017 Helmut Neemann
3  * Use of this source code is governed by the GPL v3 license
4  * that can be found in the LICENSE file.
5  */
6 package de.neemann.digital.core;
7 
8 import de.neemann.digital.core.io.InValue;
9 import junit.framework.TestCase;
10 
11 public class ValueTest extends TestCase {
12 
testSize()13     public void testSize() {
14         assertEquals(3, new Value(-1, 2).getValue());
15         assertEquals(1, new Value(1, 2).getValue());
16         assertEquals(-1, new Value(-1, 2).getValueSigned());
17         assertEquals(-1, new Value(3, 2).getValueSigned());
18     }
19 
testFromInValue()20     public void testFromInValue() throws Bits.NumberFormatException {
21         assertEquals("5", new Value(new InValue("5"), 4).toString());
22         assertEquals("Z", new Value(new InValue("z"), 4).toString());
23         assertEquals("Z", IntFormat.HEX_FORMATTER.formatToEdit(new Value(new InValue("z"), 4)));
24     }
25 }
26