Package org.axsl.ps

Examples of org.axsl.ps.PsInput


     * @throws PsOperatorException For PostScript operator errors.
     */
    @Test
    public void testCount01() throws PsInterpreterException4a, PsOperatorException {
        /* First example from the PSLRM, 2nd ed. */
        PsInput input = new PsStringInput("clear count");
        PsInterpreter4a interpreter = new PsInterpreter4a(input, null);
        interpreter.process();
        PsObject object = interpreter.getOperandStack().pop();
        assertTrue(object instanceof PsInteger);
        PsInteger psInteger = (PsInteger) object;
View Full Code Here


     * @throws PsOperatorException For PostScript operator errors.
     */
    @Test
    public void testEq01() throws PsInterpreterException4a, PsOperatorException {
        /* First example from the PSLRM, 2nd ed. */
        PsInput input = new PsStringInput("4.0 4 eq");
        PsInterpreter4a interpreter = new PsInterpreter4a(input, null);
        interpreter.process();
        PsObject object = interpreter.getOperandStack().pop();
        assertTrue(object instanceof PsBoolean);
        PsBoolean psBoolean = (PsBoolean) object;
View Full Code Here

     * @throws PsOperatorException For PostScript operator errors.
     */
    @Test
    public void testNe01() throws PsInterpreterException4a, PsOperatorException {
        /* First example (for "eq") from the PSLRM, 2nd ed. */
        PsInput input = new PsStringInput("4.0 4 ne");
        PsInterpreter4a interpreter = new PsInterpreter4a(input, null);
        interpreter.process();
        PsObject object = interpreter.getOperandStack().pop();
        assertTrue(object instanceof PsBoolean);
        PsBoolean psBoolean = (PsBoolean) object;
View Full Code Here

     * @throws PsOperatorException For PostScript operator errors.
     */
    @Test
    public void testMatrix01() throws PsInterpreterException4a, PsOperatorException {
        /* First example from the PSLRM, 2nd ed. */
        final PsInput input = new PsStringInput("matrix");
        final PsInterpreter4a interpreter = new PsInterpreter4a(input, null);
        interpreter.process();
        final PsObject object = interpreter.getOperandStack().pop();
        assertTrue(object instanceof PsMatrix);
        final PsMatrix matrix = (PsMatrix) object;
View Full Code Here

     */
    private void generalComparisonTest(final String comparisonOperation, final boolean isLessThan,
            final boolean isEqualTo, final boolean isGreaterThan) throws PsInterpreterException4a,
            PsOperatorException {
        /* Test number that is less. */
        PsInput input = new PsStringInput("2 3 " + comparisonOperation);
        PsInterpreter4a interpreter = new PsInterpreter4a(input, null);
        interpreter.process();
        assertEquals(1, interpreter.getOperandStack().size());
        PsObject object = interpreter.getOperandStack().pop();
        assertTrue(object instanceof PsBoolean);
View Full Code Here

     * @throws PsInterpreterException4a For PostScript errors.
     * @throws PsOperatorException For PostScript operator errors.
     */
    private void generalBooleanTest(final String testString, final boolean expectedResult)
            throws PsInterpreterException4a, PsOperatorException {
        final PsInput input = new PsStringInput(testString);
        final PsInterpreter4a interpreter = new PsInterpreter4a(input, null);
        interpreter.process();
        final PsObject object = interpreter.getOperandStack().pop();
        assertTrue(object instanceof PsBoolean);
        assertEquals(expectedResult, ((PsBoolean) object).getValue());
View Full Code Here

     * @throws PsInterpreterException4a For PostScript errors.
     * @throws PsOperatorException For PostScript operator errors.
     */
    @Test
    public void testVersion01() throws PsInterpreterException4a, PsOperatorException {
        final PsInput input = new PsStringInput("version");
        final PsInterpreter4a interpreter = new PsInterpreter4a(input, null);
        interpreter.process();
        assertEquals(1, interpreter.getOperandStack().size());
        final PsObject object = interpreter.getOperandStack().pop();
        assertTrue(object instanceof PsString);
View Full Code Here

     * @throws PsOperatorException For PostScript operator errors.
     */
    @Test
    public void testCvr01() throws PsInterpreterException4a, PsOperatorException {
        /* Test a real. */
        PsInput input = new PsStringInput("9.2");
        PsInterpreter4a interpreter = new PsInterpreter4a(input, null);
        interpreter.process();
        PsObject object1 = interpreter.getOperandStack().peek();
        assertTrue(object1 instanceof PsReal);
        input = new PsStringInput("cvr");
View Full Code Here

     * @throws PsInterpreterException4a For PostScript errors.
     * @throws PsOperatorException For PostScript operator errors.
     */
    @Test
    public void testClear01() throws PsInterpreterException4a, PsOperatorException {
        final PsInput input = new PsStringInput("1 2 3 clear");
        final PsInterpreter4a interpreter = new PsInterpreter4a(input, null);
        interpreter.process();
        assertEquals(0, interpreter.getOperandStack().size());
    }
View Full Code Here

TOP

Related Classes of org.axsl.ps.PsInput

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.