Posts Tagged ‘regression testing’

As mentioned in a previous post, I’ve been working on a unit testing program and in that process decided to tackle the coupling issues in the FyreVM engine. There were two, the channel order and layout as well as the output filtering (turning text into markup for HTML or XAML).

Both of these things are now removed from the open source version of FyreVM. The latest extension for FyreVM for Inform 7 6F95 is checked into the sourceforge.net site as well as FyreVMOS itself.

The channel layout is now dynamic. If you add a channel in your code, FyreVM will automatically allocate space for its output and return it to your calling program. In .NET this comes through as a Dictionary<channel, data> where channel is a 4 byte mnemonic and data is the text for that channel.

The extension contains the current definitions (in Inform 6 syntax):


! **** Channel IO Layout ****
!
! Each channel constant is a 4 byte integer packed with 4 upper case letters.
!
! Required Channels for FY_CHANNEL.
!
Constant FYC_MAIN = ('M' * $1000000) + ('A' * $10000) + ('I' * $100) + 'N';   ! MAIN
Constant FYC_PROMPT = ('P' * $1000000) + ('R' * $10000) + ('P' * $100) + 'T';   ! PRPT
Constant FYC_LOCATION = ('L' * $1000000) + ('O' * $10000) + ('C' * $100) + 'N';  ! LOCN
Constant FYC_SCORE = ('S' * $1000000) + ('C' * $10000) + ('O' * $100) + 'R';   ! SCOR
Constant FYC_TIME = ('T' * $1000000) + ('I' * $10000) + ('M' * $100) + 'E';    ! TIME
Constant FYC_DEATH = ('D' * $1000000) + ('E' * $10000) + ('A' * $100) + 'D';   ! DEAD

! Game specific channels for FY_CHANNEL
Constant FYC_TITLE = ('T' * $1000000) + ('I' * $10000) + ('T' * $100) + 'L';    ! TITL
Constant FYC_CREDITS = ('C' * $1000000) + ('R' * $10000) + ('E' * $100) + 'D';   ! CRED
Constant FYC_PROLOGUE = ('P' * $1000000) + ('L' * $10000) + ('O' * $100) + 'G';  ! PLOG
Constant FYC_TURN = ('T' * $1000000) + ('U' * $10000) + ('R' * $100) + 'N';   ! TURN
Constant FYC_HINT = ('H' * $1000000) + ('I' * $10000) + ('N' * $100) + 'T';    ! HINT
Constant FYC_HELP = ('H' * $1000000) + ('E' * $10000) + ('L' * $100) + 'P';    ! HELP
Constant FYC_MAP = ('M' * $1000000) + ('A' * $10000) + ('P' * $100) + ' ';    ! MAP
Constant FYC_SOUND = ('S' * $1000000) + ('O' * $10000) + ('N' * $100) + 'D';   ! SOND
Constant FYC_CHAPTER = ('C' * $1000000) + ('H' * $10000) + ('A' * $100) + 'P';  ! CHAP
Constant FYC_ACHIEVEMENT = ('A' * $1000000) + ('C' * $10000) + ('H' * $100) + 'V'; ! ACHV
Constant FYC_TIPS = ('T' * $1000000) + ('I' * $10000) + ('P' * $100) + 'S';    ! TIPS
Constant FYC_VERSION = ('V' * $1000000) + ('R' * $10000) + ('S' * $100) + 'N';   ! VRSN

I’m aware that the required math in each constant definition may seem a little daunting to non-programmers, but if you follow the pattern, you should be able to easily add your own channel definitions.

The Inform 7 code to direct output to a channel is defined as such:

To Select the Main Channel:
        (- if (is_fyrevm) FyreCall(FY_CHANNEL, FYC_MAIN); -).

Note the constant FYC_MAIN is used here to select the main channel. All of the channels above are defined and some have additional code for easy channel access, like the chapter channel’s phrase:

To Set the Chapter to (T - text):
        Select the Chapter Channel;
        say T;
        Select the Main Channel.

Which allows you to: set the chapter to “Chapter 1 – The Trap”.

Next post will be about regression testing.