/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ca.mcmaster.cas.matlab2smt;

import org.junit.Test;
import static org.junit.Assert.*;

/**
 *
 * @author matthew
 */
public class FixedPointVariableTypeTest {
    /**
     * Test of constructor in class FixedPointType.
     */
    @Test
    public void testConstructor() {
        FixedPointVariableType instance = new FixedPointVariableType(true, 19, 9);
        assertEquals(true, instance.isSigned());
        assertEquals(19, instance.digits());
        assertEquals(9, instance.fractionPart());
    }
    /**
     * Test of getCVC3Definition method, of class FixedPointType.
     */
    @Test
    public void testGetCVC3Definition() {
        CVC3Generator generator = new CVC3Generator();
        FixedPointVariableType instance = new FixedPointVariableType(true, 16, 8);
        assertEquals("BITVECTOR(16)", generator.GenerateVariableType(instance));
    }

    /**
     * Test of canCastToType method, of class FixedPointType.
     */
    @Test
    public void testCanCastToType() {
        FixedPointVariableType instance = new FixedPointVariableType(true, 16, 8);
        assertFalse(instance.canCastToType(new RealVariableType()));
    }

    /**
     * Test of equals method, of class FixedPointType.
     */
    @Test
    public void testEquals() {
        FixedPointVariableType instance = new FixedPointVariableType(true, 16, 8);
        assertEquals(new FixedPointVariableType(true, 16, 8), instance);
        assertFalse(instance.equals(new FixedPointVariableType(false, 16, 8)));
        assertFalse(instance.equals(new FixedPointVariableType(true, 15, 8)));
        assertFalse(instance.equals(new FixedPointVariableType(true, 16, 7)));
    }
}
