|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnz.ac.waikato.modeljunit.examples.gsm.GSM11Impl
public class GSM11Impl
This is a simple Java implementation of the GSM 11.11 standard. This class pretends to be the SIM card within a mobile phone. That is, tt manages the security and the contents of the various files and directories stored within a typical SIM card.
It handles only a very small subset of the files and directories that a real SIM would, supports only CHV1 security, and has many other limitations and omissions. The goal of this class is to illustrate how we can use model-based testing to test such an implementation, and mutation-testing (see jumble.sourceforge.net) to measure the quality of the generated tests.
For example, executing a sequence of 100,000 randomly-generated test steps from the SimCard model takes only about 1 second, but gives 95.2% code coverage of this class and (a more demanding metric) covers 84% of the 298 mutations generated by Jumble 1.0 for this class. (Done with generate(100000), with setResetProbability(0.01), and with all Jumble mutations turned on, except for mutation of class pool constants).
Field Summary | |
---|---|
static int |
MF
|
static int |
PERM_ADM
|
static int |
PERM_ALWAYS
Constants for file access permissions |
static int |
PERM_CHV1
|
static int |
PERM_NEVER
|
Constructor Summary | |
---|---|
GSM11Impl()
|
Method Summary | |
---|---|
byte[] |
cmd(byte[] apdu)
This corresponds to sending a command to the SIM. |
protected boolean |
equalsChv(byte[] chv1,
byte[] chv2,
int pos2)
True if chv1[0..7] equals chv2[pos2..pos2+7]. |
protected int |
getByte(byte[] buf,
int pos)
Reads one unsigned bytes from buf[pos]. |
protected int |
getWord(byte[] buf,
int pos)
Reads a two-byte word from buf[pos..pos+1]. |
protected void |
setWord(byte[] buf,
int pos,
int value)
Writes a two-byte word into buf[pos..pos+1]. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MF
public static final int PERM_ALWAYS
public static final int PERM_CHV1
public static final int PERM_ADM
public static final int PERM_NEVER
Constructor Detail |
---|
public GSM11Impl()
Method Detail |
---|
public byte[] cmd(byte[] apdu)
apdu
- Bytes 1..4 determine the command and its parameters
protected int getWord(byte[] buf, int pos)
protected int getByte(byte[] buf, int pos)
protected void setWord(byte[] buf, int pos, int value)
protected boolean equalsChv(byte[] chv1, byte[] chv2, int pos2)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |