Commit 3ecfb2f1 authored by Sebastian Hans's avatar Sebastian Hans
Browse files

CR 42 SCP(21)000127r2/SCPTEST(21)069002r1

-Clarification of the test case 5.1.1.3 [test case 16]
parent 303a4243
Loading
Loading
Loading
Loading
+47 −73
Original line number Diff line number Diff line
@@ -32,15 +32,15 @@ public class Api_1_Fvw_Incr_1 extends TestToolkitApplet implements UICCConstants
            (byte)0x2F,(byte)0x06,(byte)0x01,            // Value - Security attribute (EF Arr, record nb)
            (byte)0x80,(byte)0x02,(byte)0x00,(byte)0x00, // Tag, Length, value - File size (0 bytes => no record)
            (byte)0x88,(byte)0x00};                      // Tag, Length - SFI (no SFI)
    private byte [] abCreateEF_2CFD = {
    private byte [] abCreateEF_2C7F = {
            (byte)0x82,(byte)0x04,                       // Tag, Length - File descriptor
            (byte)0x46,(byte)0x21,(byte)0x00,(byte)0xFD, // Value - File descriptor (Cyclic) and record length (0xFD)
            (byte)0x46,(byte)0x21,(byte)0x00,(byte)0x7F, // Value - File descriptor (Cyclic) and record length (0x7F)
            (byte)0x83,(byte)0x02,                       // Tag, Length - File Id
            (byte)0x2C,(byte)0xFD,                       // Value - File Id
            (byte)0x2C,(byte)0x7F,                       // Value - File Id
            (byte)0x8A,(byte)0x01,(byte)0x05,            // Tag, Length, Value - LCSI (Activated)
            (byte)0x8B,(byte)0x03,                       // Tag, Length - Security attribute
            (byte)0x2F,(byte)0x06,(byte)0x01,            // Value - Security attribute (EF Arr, record nb)
            (byte)0x80,(byte)0x02,(byte)0x00,(byte)0xFD, // Tag, Length, value - File size (0 bytes => no record)
            (byte)0x80,(byte)0x02,(byte)0x00,(byte)7F, // Tag, Length, value - File size (0 bytes => no record)
            (byte)0x88,(byte)0x00};                      // Tag, Length - SFI (no SFI)
    byte testCaseNb = (byte) 0x00;
    byte incr[] = null;
@@ -518,7 +518,6 @@ public class Api_1_Fvw_Incr_1 extends TestToolkitApplet implements UICCConstants
            // Set records to 55 55 55
            Util.arrayFillNonAtomic(data, (short)0, (short)data.length, (byte)0x55);
            UiccFileView.updateRecord((short)0, REC_ACC_MODE_PREVIOUS, (short)0, data, (short)0, (short)data.length);

            bRes &= true;
        }
        catch (Exception e)
@@ -528,87 +527,61 @@ public class Api_1_Fvw_Incr_1 extends TestToolkitApplet implements UICCConstants
        reportTestOutcome(testCaseNb, bRes);

        // -----------------------------------------------------------------
        // Test Case 15 : Void
        // Note: this means that baTestsResults will contain '00' for this test case, indicating Void in this case
        // Test Case 15 : Record not found
        //

        // -----------------------------------------------------------------
        // Test Case 16 : incrLength out of range
        // -----------------------------------------------------------------
        testCaseNb = 16;
        testCaseNb = 15;
        try
        {
            // Create EF 0x2CFD
            incr = new byte[128];
            resp = new byte[0xFF];
            comp = new byte[0xFF];
            createEFCmd = HandlerBuilder.buildTLVHandler(HandlerBuilder.EDIT_HANDLER, (short)abCreateEF_2CFD.length, abCreateEF_2CFD, (short)0x00, (short)abCreateEF_2CFD.length);
        	incr = new byte[3];
        	resp = new byte[3];
        	createEFCmd = HandlerBuilder.buildTLVHandler(HandlerBuilder.EDIT_HANDLER, (short)abCreateEF_2C00.length, abCreateEF_2C00, (short)0x00, (short)abCreateEF_2C00.length);
            UiccAdminFileView.createFile(createEFCmd);
            UiccAdminFileView.select((short)0x2CFD);
            UiccAdminFileView.select((short)0x2C00);
            
            Util.arrayFillNonAtomic(comp, (short)0, (short)126, (byte)0x00);
            Util.arrayFillNonAtomic(comp, (short)126, (short)(0xFD-126), (byte)0xFF);
            UiccAdminFileView.updateRecord((short)0, REC_ACC_MODE_PREVIOUS, (short)0, comp, (short)0, (short)0xFD);
            // increase
            Util.arrayFillNonAtomic(incr, (short)0, (short)incr.length, (byte)0);
            Util.arrayFillNonAtomic(resp, (short)0, (short)resp.length, (byte)0);
            Util.arrayFillNonAtomic(comp, (short)0, (short)resp.length, (byte)0);
            incr[127] = (byte)0x01;
            comp[125] = (byte)0x01;
            incrOffset = 1;
            incrLength = 127;
            incrOffset = 0;
            incrLength = 3;
            respOffset = 0;
            respLength = UiccAdminFileView.increase(incr, incrOffset, incrLength, resp, respOffset);
            // Check result
            if ((respLength == (short)0xFD) &&
                (Util.arrayCompare(resp, (short)0, comp, (short)0, respLength) == 0))
                bRes = true;
            else
                bRes = false;
        }
        catch (Exception e)
        {
            
            respLength = UiccFileView.increase(incr, incrOffset, incrLength, resp, respOffset);
            bRes = false;
        }
        try 
        catch (UICCException e)
        {
            // increase
            incrOffset = 0;
            incrLength = 128;
            respOffset = 0;
            respLength = UiccAdminFileView.increase(incr, incrOffset, incrLength, resp, respOffset);
            if (e.getReason() == UICCException.RECORD_NOT_FOUND)
                bRes = true;
            else
                bRes = false;
        }
        catch(Exception e)
        {
            bRes &= true;
        	bRes = false;
        }
        
        UiccAdminFileView.deleteFile((short)0x2C00);
        reportTestOutcome(testCaseNb, bRes);
        UiccAdminFileView.deleteFile((short)0x2CFD);
    }
}
        
/*
        // -----------------------------------------------------------------
        // Test Case 16 : incrLength out of range
        // -----------------------------------------------------------------
        testCaseNb = 16;
        try 
        {
    // Create EF 0x2CFD
            // Create EF 0x2C7F
            incr = new byte[128];
    resp = new byte[0xFF];
            resp = new byte[127];
            comp = new byte[0xFF];
    createEFCmd = HandlerBuilder.buildTLVHandler(HandlerBuilder.EDIT_HANDLER, (short)abCreateEF.length, abCreateEF, (short)0x00, (short)abCreateEF.length);
            createEFCmd = HandlerBuilder.buildTLVHandler(HandlerBuilder.EDIT_HANDLER, (short)abCreateEF_2C7F.length, abCreateEF_2C7F, (short)0x00, (short)abCreateEF_2C7F.length);
            UiccAdminFileView.createFile(createEFCmd);
            UiccAdminFileView.select((short)0x2C7F);

    Util.arrayFillNonAtomic(comp, (short)0, (short)127, (byte)0xFF);
    comp[0] = (byte)0x00;
    UiccAdminFileView.updateRecord((short)0, REC_ACC_MODE_PREVIOUS, (short)0, comp, (short)0, (short)127);
            Util.arrayFillNonAtomic(comp, (short)0, (short)127, (byte)0x00);
            UiccAdminFileView.updateRecord((short)0, REC_ACC_MODE_PREVIOUS, (short)0, comp, (short)0, (short)0x7F);
            // increase
            Util.arrayFillNonAtomic(incr, (short)0, (short)incr.length, (byte)0);
            Util.arrayFillNonAtomic(resp, (short)0, (short)resp.length, (byte)0);
    Util.arrayFillNonAtomic(comp, (short)0, (short)resp.length, (byte)0);
            Util.arrayFillNonAtomic(comp, (short)0, (short)comp.length, (byte)0);
            incr[127] = (byte)0x01;
    comp[0] = (byte)0x01;
            comp[126] = (byte)0x01;
            incrOffset = 1;
            incrLength = 127;
            respOffset = 0;
@@ -639,4 +612,5 @@ catch (Exception e)
        }
        reportTestOutcome(testCaseNb, bRes);
        UiccAdminFileView.deleteFile((short)0x2C7F);
*/
 No newline at end of file
    }
}