Skip to content

Latest commit

 

History

History
126 lines (94 loc) · 3.82 KB

DOCS.md

File metadata and controls

126 lines (94 loc) · 3.82 KB

Smtc

This is a Smtc class. It's a "S"tate "M"achine "T"est "C"ase generator inspired by https://note.com/yumotsuyo/n/nd3099b40dc1f Overall flow is the following

  • setContents(file)
  • initialize()
  • _flattenStates()
  • nSwitchCoverage(switch)
  • printTransitions();
  • printNSwitch(nSwitchCoverage);
  • printNSwitchMatrix(nSwitchCoverage);
  • printDiagram();

Kind: global class

new Smtc(smcat)

this._clean()

Param Type Description
smcat state-machine-cat

this is for webapp

smtc.setContents(contents) ⇒ Smtc

fill this.contents from outside of this instance

Kind: instance method of Smtc
Returns: Smtc -

this This object

Param Type Description
contents string

Target Contents

smtc.initialize() ⇒ Smtc

In this method, it aims to fill the following parameters

  • this.states
  • this.events
  • this.transitions
  • this.matrix

Kind: instance method of Smtc
Returns: Smtc -

this This object


Access: public

smtc.nSwitchCoverage() ⇒ Array

nSwitchCoverage = this.matrix x (n-1)SwitchCoverage

Kind: instance method of Smtc
Returns: Array -

nSwitch culculated coverage


Access: public
Params: Array matrix

smtc.printDiagram()

print diagram

Kind: instance method of Smtc
Access: public

smtc.printTransitions()

print transitions

Kind: instance method of Smtc
Access: public

smtc.printNSwitch(nSwitchCoverage)

print n switch cases

Kind: instance method of Smtc
Access: public

Param Type Description
nSwitchCoverage Array

n switch coverage (default: this.matrix)

smtc.printNSwitchMatrix(nSwitchCoverage)

print n switch matrix

Kind: instance method of Smtc
Access: public

Param Type Description
nSwitchCoverage Array

one switch coverage

smtc._clean()

PRIVATE:clean up all parameters

Kind: instance method of Smtc

smtc._flattenStates() ⇒ Array

sometimes the states are nested, so we detect all nested and non-nested states.

Kind: instance method of Smtc
Returns: Array -

states flatten the state and fill in this.json.transitions as needed.