michaeldickens / Typing

https://github.com/michaeldickens/Typing
69 stars 18 forks source link

Does a test suite exist? #12

Open FrankDMartinez opened 11 years ago

FrankDMartinez commented 11 years ago

Hi, I was wondering if a test suite exists to verify program performance accuracy.

Thanks.

michaeldickens commented 11 years ago

There does not. I'll add it to my list of to dos. Did you have any particular sorts of tests in mind?

FrankDMartinez commented 11 years ago

Thanks for the thought. Basically, what springs to Mind is a sequence of test keyboard which, based on a "pen-and-paper" calculation of the algorithm, has a known fitness score, for example. This way, if I were to attempt a tweak and found, "Oops the fitness is now A when it is used to be B," I can make sure I did not break anything.

michaeldickens commented 11 years ago

That could be useful, although it would have to be changed every time the fitness variables change. I can't think of an easy way to do that off the top of my head.

On 2/12/13 8:33 AM, FrankDMartinez wrote:

Thanks for the thought. Basically, what springs to Mind is a sequence of test keyboard which, based on a "pen-and-paper" calculation of the algorithm, has a known fitness score, for example. This way, if I were to attempt a tweak and found, "Oops the fitness is now A when it is used to be B," I can make sure I did not break anything.

— Reply to this email directly or view it on GitHub https://github.com/MTGandP/Typing/issues/12#issuecomment-13441340.

FrankDMartinez commented 11 years ago

One system I have set up for another project utilizes "create" and "compare" setting. The "create" setting simply takes in test case information, produces output, and stores it in a specifically named file. The "compare" setting does the same except, instead of storing it in the specifically named file, it results in the output dumping to a temporary file which is then 'cmp'-ed with the named file. [Note: the setup uses a wrapper script to handle all of this, as opposed to having the testing built into the application.]

To illustrate "create" mode, calling "create-test input-file-name":

./application [whatever settings are required] input-file-name > input-file-name.out

To illustrate "compare" mode, calling "compare-1-test input-file-name":

rm temp-file
./application [same settings as require for "create" mode] input-file-name > temp-file
cmp input-file-name.out temp-file
if [$? -gt 0]; then
    <launch Your favorite diff-ing program to show where the changes are> input-file-name.out temp-file
fi

To handle multiple test files, another wrapper script, "compare-tests", simply invokes:

compare-1-test a
compare-1-test b
compare-1-test c
compare-1-test d
...
michaeldickens commented 11 years ago

Certainly don't feel like you have to, but if you want to set up some tests to demonstrate that with the Typing program, I'd like to see it.

On 2/12/13 9:46 AM, FrankDMartinez wrote:

One system I have set up for another project utilizes "create" and "compare" setting. The "create" setting simply takes in test case information, produces output, and stores it in a specifically named file. The "compare" setting does the same except, instead of storing it in the specifically named file, it results in the output dumping to a temporary file which is then 'cmp'-ed with the named file. [Note: the setup uses a wrapper script to handle all of this, as opposed to having the testing built into the application.]

To illustrate "create" mode, calling "create-test input-file-name": ./application [whatever settings are required] input-file-name > input-file-name.out

To illustrate "compare" mode, calling "compare-1-test input-file-name": rm temp-file ./application [same settings as require for "create" mode] input-file-name > temp-file cmp input-file-name.out temp-file if [$? -gt 0]; then input-file-name.out temp-file fi

To handle multiple test files, another wrapper script, "compare-tests", simple invokes: compare-1-test a compare-1-test b compare-1-test c compare-1-test d ...

— Reply to this email directly or view it on GitHub https://github.com/MTGandP/Typing/issues/12#issuecomment-13445421.

FrankDMartinez commented 11 years ago

If You could point Me in the direction of the an english version of the fitness calculation algorithm(s), I will see what I can do.

michaeldickens commented 11 years ago

It's fairly simple. Every digraph has an associated number that indicates the relative frequency of the digraph. calcFitness() calls a series of functions to calculate the fitness and then multiplies by the digraph's relative frequency. Each individual function used by calcFitness() is described in the Fitness file.