Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

typo #1

Closed
wants to merge 4 commits into from

2 participants

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 24, 2012
  1. @speg

    typo

    speg authored
  2. @speg

    small edits

    speg authored
  3. @speg

    Update jscheck.html

    speg authored
Commits on Apr 25, 2012
  1. @speg

    plural

    speg authored
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 4 deletions.
  1. +4 −4 jscheck.html
View
8 jscheck.html
@@ -59,13 +59,13 @@
<h3>name</h3>
<p>The name is descriptive text that will be used in making the report.</p>
<h3>predicate</h3>
-<p>The predicate is a function that will return true of the claim holds. The predicate will do something with the system in question, perhaps examining its result examining the consistency of its data structures. If you are testing functions that do encoding and decoding, the predicate can assert things like</p>
+<p>The predicate is a function that will return true if the claim holds. The predicate will do something with the system in question, perhaps examining its result, or examining the consistency of its data structures. If you are testing functions that do encoding and decoding, the predicate can assert things like</p>
<pre>return value === decode(encode(value))</pre>
<p>You won't need to select the <code>value</code>. JSCheck will generate random values for you.</p>
<h3>specifiers</h3>
<p>An array of specifiers describe the types of the predicate's arguments. (From a procedural perspective, specifiers are generators, but JavaScript may get a new generator feature which is very different, so avoid confusion, we will take a declarative view.)</p>
-<p>JSCheck provides a small library of specifiers which you can use in your claim. For example, <code>JSC.integer(10)</code> declares that a parameter should an integer between 1 and 10. <code>JSC.one_of(['Curly, 'Larry', 'Moe'])</code> declares that a parameter can be one of three string. Some of the specifiers can be combined, so <code>JSC.array(JSC.integer(10), JSC.character('a', 'z'))</code> declares that a parameter can be an array of 1 to 10 lowercase letters.</p>
-<p>An array of specifiers can also contain constants (such as string, numbers, or objects), so you can pass anything you need to into the predicate. If you need to pass in a function, then you must to wrap the function value with the <code>JSC.literal</code> specifier.</p>
+<p>JSCheck provides a small library of specifiers which you can use in your claim. For example, <code>JSC.integer(10)</code> declares that a parameter should an integer between 1 and 10. <code>JSC.one_of(['Curly, 'Larry', 'Moe'])</code> declares that a parameter can be one of three strings. Some of the specifiers can be combined, so <code>JSC.array(JSC.integer(10), JSC.character('a', 'z'))</code> declares that a parameter can be an array of 1 to 10 lowercase letters.</p>
+<p>An array of specifiers can also contain constants (such as strings, numbers, or objects), so you can pass anything you need to into the predicate. If you need to pass in a function, then you must to wrap the function value with the <code>JSC.literal</code> specifier.</p>
<p>You can also create your own specifiers.</p>
<h3>classifier</h3>
<p>You can optionally pass a classifier function as part of the claim. The classifier will receive the same arguments as the predicate. A classifier can do two things:</p>
@@ -313,7 +313,7 @@
<h2>Using JSCheck</h2>
<p>Since JSCheck performs a useful specification and description function as well as a testing function, it is recommended that claims be inserted into the relevant source code, and not in separate source files. <a href="https://github.com/douglascrockford/JSDev">JSDev</a> can make this easier to manage, so that claims can easily be removed from production code. All of the calls to JSC can be hidden in special comments, which are activated during development, and removed by minification in production.</p>
<h2>Writing specifiers</h2>
-<p>JSCheck provides a small set of specifier that can be combined in many ways. But for some purposes, you may need to create your own specifiers.</p>
+<p>JSCheck provides a small set of specifiers that can be combined in many ways. But for some purposes, you may need to create your own specifiers.</p>
<p>It is easy to do. A specifier is a function that returns a function. The function that is returned will be stored in the specifiers array, and will be called for each value that needs to be generated. Its arguments might be other specifiers, so if an argument is a function, use the result of calling the function.</p>
<h2>Demonstration</h2>
<p>One difficulty in demonstrating testing systems is that the exposition of the system to be tested is usually significantly more complex than the testing tool being demonstrated. So in this case, we will be testing a trivial function. We will make an incorrect claim. JSCheck will help us to find the error in the claim. It might seem counter productive to demonstrate bad claim making, but it turns out that it is as important to get the claims right as it is to get the program right.</p>
Something went wrong with that request. Please try again.