npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

smtc

v1.0.1

Published

A test case generator from state machine diagram

Downloads

5

Readme

Node.js CInpm version

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

Try it in your browser! TRY IT NOW

Document is here

install

$ npm i -g smtc

Usage

command line

# -h:help
# <file>:inputscript
# -s : switch
# -t : output type t:transition/m:matrix/c:testcases/d:diagram
smtc [-h] <file> [-s <0|1|2... (0:default)>] [-t <t|m|c|d (t:default)>]

sample data

alt text

$ cat __tests__/testData.txt
initial                  => "Accepting reservations" ;
"Accepting reservations" => "Reservation accepted"   : reserve ;
"Reservation accepted"   => "Reserved"               : approve;
"Reserved"               => "Reservation accepted"   : cancel approval;
"Reservation accepted"   => "Accepting reservations" : reject;
"Reservation accepted"   => "Accepting reservations" : cancel of reservation;
"Reserved"               => "Accepting reservations" : cancel;
"Reserved"               => final                    : car delivered;

Transition matrix

$ smtc __tests__/testData.txt

||[None]|reserve|approve|cancel approval|reject|cancel of reservation|cancel|car delivered| |:--|:--|:--|:--|:--|:--|:--|:--|:--| |initial|Accepting reservations|||||||| |Accepting reservations||Reservation accepted||||||| |Reservation accepted|||Reserved||Accepting reservations|Accepting reservations||| |Reserved||||Reservation accepted|||Accepting reservations|final| |final|||||||||

zero switch cases

$ smtc __tests__/testData.txt -t c

|#|State#1|Event#1|State#2| |:--|:--|:--|:--| |0|initial|[None]|Accepting reservations| |1|Accepting reservations|reserve|Reservation accepted| |2|Reservation accepted|reject|Accepting reservations| |3|Reservation accepted|cancel of reservation|Accepting reservations| |4|Reservation accepted|approve|Reserved| |5|Reserved|cancel|Accepting reservations| |6|Reserved|cancel approval|Reservation accepted| |7|Reserved|car delivered|final|

zero switch matrix

$ smtc __tests__/testData.txt -t m

||initial|Accepting reservations|Reservation accepted|Reserved|final| |:--|:--|:--|:--|:--|:--| |initial||[None]|||| |Accepting reservations|||reserve||| |Reservation accepted||reject,cancel of reservation||approve|| |Reserved||cancel|cancel approval||car delivered| |final||||||

one switch cases

$ smtc __tests__/testData.txt -t c -s 1

|#|State#1|Event#1|State#2|Event#2|State#3| |:--|:--|:--|:--|:--|:--| |0|initial|[None]|Accepting reservations|reserve|Reservation accepted| |1|Accepting reservations|reserve|Reservation accepted|reject|Accepting reservations| |2|Accepting reservations|reserve|Reservation accepted|cancel of reservation|Accepting reservations| |3|Accepting reservations|reserve|Reservation accepted|approve|Reserved| |4|Reservation accepted|approve|Reserved|cancel|Accepting reservations| |5|Reservation accepted|reject|Accepting reservations|reserve|Reservation accepted| |6|Reservation accepted|cancel of reservation|Accepting reservations|reserve|Reservation accepted| |7|Reservation accepted|approve|Reserved|cancel approval|Reservation accepted| |8|Reservation accepted|approve|Reserved|car delivered|final| |9|Reserved|cancel approval|Reservation accepted|reject|Accepting reservations| |10|Reserved|cancel approval|Reservation accepted|cancel of reservation|Accepting reservations| |11|Reserved|cancel|Accepting reservations|reserve|Reservation accepted| |12|Reserved|cancel approval|Reservation accepted|approve|Reserved|

one switch matrix

$ smtc __tests__/testData.txt -t m -s 1

||initial|Accepting reservations|Reservation accepted|Reserved|final| |:--|:--|:--|:--|:--|:--| |initial|||[None] -> reserve||| |Accepting reservations||reserve -> reject,reserve -> cancel of reservation||reserve -> approve|| |Reservation accepted||approve -> cancel|reject -> reserve,cancel of reservation -> reserve,approve -> cancel approval||approve -> car delivered| |Reserved||cancel approval -> reject,cancel approval -> cancel of reservation|cancel -> reserve|cancel approval -> approve|| |final||||||

{% include form.html %}