Search in sources :

Example 71 with Property

use of com.pholser.junit.quickcheck.Property in project beam by apache.

the class BeamDDLNestedTypesTest method supportsPrimitiveTypes.

@Property
public void supportsPrimitiveTypes(@From(PrimitiveTypes.class) FieldType fieldType) throws SqlParseException {
    String fieldTypeDeclaration = unparse(fieldType);
    Table table = executeCreateTableWith(fieldTypeDeclaration);
    Schema expectedSchema = newSimpleSchemaWith(fieldType);
    assertEquals(expectedSchema, table.getSchema());
}
Also used : Table(org.apache.beam.sdk.extensions.sql.meta.Table) Schema(org.apache.beam.sdk.schemas.Schema) Property(com.pholser.junit.quickcheck.Property)

Example 72 with Property

use of com.pholser.junit.quickcheck.Property in project beam by apache.

the class BeamDDLNestedTypesTest method supportsNestedTypes.

@Property
public void supportsNestedTypes(@From(AnyFieldType.class) FieldType generatedFieldType) throws SqlParseException {
    String fieldTypeDeclaration = unparse(generatedFieldType);
    Table table = executeCreateTableWith(fieldTypeDeclaration);
    Schema expectedSchema = newSimpleSchemaWith(generatedFieldType);
    assertEquals(expectedSchema, table.getSchema());
}
Also used : Table(org.apache.beam.sdk.extensions.sql.meta.Table) Schema(org.apache.beam.sdk.schemas.Schema) Property(com.pholser.junit.quickcheck.Property)

Example 73 with Property

use of com.pholser.junit.quickcheck.Property in project emuRox by rossdrew.

the class Ricoh2C02Properties method testSetControlRegister.

@Property(trials = 10)
public void testSetControlRegister(@InRange(min = "0", max = "255") int byteValue) {
    final Memory vRam = new SimpleMemory();
    final Memory sprRam = mock(Memory.class);
    final Memory cpuRam = mock(Memory.class);
    final Ricoh2C02 ppu = new Ricoh2C02(vRam, sprRam, cpuRam);
    for (Ricoh2C02Registers.Register register : Ricoh2C02Registers.Register.values()) {
        ppu.setRegister(register, byteValue);
        verify(cpuRam, times(1)).setByteAt(register.getMemoryMappedLocation(), byteValue);
    }
}
Also used : SimpleMemory(com.rox.emu.mem.SimpleMemory) Memory(com.rox.emu.mem.Memory) SimpleMemory(com.rox.emu.mem.SimpleMemory) Property(com.pholser.junit.quickcheck.Property)

Example 74 with Property

use of com.pholser.junit.quickcheck.Property in project emuRox by rossdrew.

the class Ricoh2C02Properties method testGetControlRegister.

@Property(trials = 10)
public void testGetControlRegister(@InRange(min = "0", max = "255") int byteValue) {
    final Memory vRam = new SimpleMemory();
    final Memory sprRam = mock(Memory.class);
    final Memory cpuRam = mock(Memory.class);
    final Ricoh2C02 ppu = new Ricoh2C02(vRam, sprRam, cpuRam);
    for (Ricoh2C02Registers.Register register : Ricoh2C02Registers.Register.values()) {
        when(cpuRam.getByte(register.getMemoryMappedLocation())).thenReturn(byteValue);
        assertEquals(byteValue, ppu.getRegister(register));
    }
}
Also used : SimpleMemory(com.rox.emu.mem.SimpleMemory) Memory(com.rox.emu.mem.Memory) SimpleMemory(com.rox.emu.mem.SimpleMemory) Property(com.pholser.junit.quickcheck.Property)

Example 75 with Property

use of com.pholser.junit.quickcheck.Property in project emuRox by rossdrew.

the class Mos6502CompilerTest method testAbsoluteYInstructions.

@Property
public void testAbsoluteYInstructions(@InRange(min = "256", max = "65535") int wordValue) {
    final String hexWord = Integer.toHexString(wordValue);
    final int highByte = (wordValue >> 8) & 0xFF;
    final int lowByte = wordValue & 0xFF;
    OpCode.streamOf(AddressingMode.ABSOLUTE_Y).forEach((opcode) -> {
        final Mos6502Compiler compiler = new Mos6502Compiler(opcode.getOpCodeName() + " " + VALUE_PREFIX + hexWord + ",Y");
        Program program = compiler.compileProgram();
        int[] bytes = program.getProgramAsByteArray();
        assertArrayEquals("Output for '" + opcode.toString() + " 0x" + hexWord + "' was wrong.", new int[] { opcode.getByteValue(), highByte, lowByte }, bytes);
    });
}
Also used : Program(com.rox.emu.processor.mos6502.util.Program) Mos6502Compiler(com.rox.emu.processor.mos6502.util.Mos6502Compiler) Property(com.pholser.junit.quickcheck.Property)

Aggregations

Property (com.pholser.junit.quickcheck.Property)82 Matchers.hasProperty (org.hamcrest.Matchers.hasProperty)15 Program (com.rox.emu.processor.mos6502.util.Program)12 Role (ai.grakn.concept.Role)11 Label (ai.grakn.concept.Label)10 MetaSchema.isMetaLabel (ai.grakn.util.Schema.MetaSchema.isMetaLabel)10 Mos6502Compiler (com.rox.emu.processor.mos6502.util.Mos6502Compiler)10 SchemaConcept (ai.grakn.concept.SchemaConcept)9 RelationshipType (ai.grakn.concept.RelationshipType)8 AttributeType (ai.grakn.concept.AttributeType)7 VarProperty (ai.grakn.graql.admin.VarProperty)5 Ignore (org.junit.Ignore)5 Relationship (ai.grakn.concept.Relationship)4 Calendar (java.util.Calendar)4 Schema (org.apache.beam.sdk.schemas.Schema)4 ConceptId (ai.grakn.concept.ConceptId)3 Entity (ai.grakn.concept.Entity)3 EntityType (ai.grakn.concept.EntityType)3 Type (ai.grakn.concept.Type)3 VarPatternAdmin (ai.grakn.graql.admin.VarPatternAdmin)3