1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 22:31:36 +03:00
Commit Graph

252 Commits

Author SHA1 Message Date
Rob Rix
9d61286d81 Take only maxLength elements for keyed nodes. 2015-12-14 15:18:56 -05:00
Rob Rix
32d460bce7 Rename n to maxDepth. 2015-12-14 15:18:16 -05:00
Rob Rix
686325bf4c Rename m to maxLength. 2015-12-14 15:17:26 -05:00
Rob Rix
5c90ecde8e Use the cube of the max length, not the square.
I.e. shrink the produces lists.
2015-12-14 15:15:56 -05:00
Rob Rix
33c0dacd55 Take m, not n. 2015-12-14 15:13:32 -05:00
Rob Rix
2f726d4ba6 🔥 ArbitraryDiff. 2015-12-14 15:12:07 -05:00
Rob Rix
a93908a5f8 Test the reflexivity of Diff equality by generating a pair of terms and diffing them. 2015-12-14 15:11:59 -05:00
Rob Rix
2e5d85748b Capture the construction of strictly smaller terms in the where clause. 2015-12-14 15:08:32 -05:00
Rob Rix
3e22121d66 Test that the offset is applied. 2015-12-14 12:53:14 -05:00
Rob Rix
48464ac552 Test that we skip whitespace at the end. 2015-12-14 12:52:37 -05:00
Rob Rix
bfdf388b5c Test that we skip whitespace at the start. 2015-12-14 12:52:01 -05:00
Rob Rix
7bf7d22d8e Test that multiple whitespace characters are skipped. 2015-12-14 12:51:23 -05:00
Rob Rix
1bdfa51702 Test that multiple words → multiple ranges. 2015-12-14 12:49:01 -05:00
Rob Rix
da6995ae54 Test that a single word string is covered by the returned range. 2015-12-14 12:48:04 -05:00
Rob Rix
fca022109c Uh, ok. 2015-12-14 12:47:51 -05:00
Rob Rix
ce5854e019 Test that the empty string doesn’t have any word ranges in it. 2015-12-14 12:46:53 -05:00
Rob Rix
8951bebfa7 Test that rangesOfWordsFrom doesn’t produce words for whitespace. 2015-12-14 12:46:20 -05:00
Rob Rix
7bc4c62151 Increase the probability of leaves as a cheap way speed up the tests. 2015-12-11 16:11:10 -05:00
Rob Rix
14e861da35 Test that diffing a term against itself produces a zero-cost diff. 2015-12-11 16:10:22 -05:00
Rob Rix
3bb9e704bf Remove the Arbitrary instance for Diff. 2015-12-11 16:07:11 -05:00
Rob Rix
0aa3154434 Test properties over ArbitraryDiff. 2015-12-11 16:07:06 -05:00
Rob Rix
c79113c18c ArbitraryDiff is Arbitrary. 2015-12-11 16:06:14 -05:00
Rob Rix
86d95d1d86 unDiff interprets diffs. 2015-12-11 16:04:41 -05:00
Rob Rix
21b2d7fdfd Stub in an ArbitraryDiff type. 2015-12-11 16:03:04 -05:00
Rob Rix
fa4e5011ac Test diff equality reflexivity. 2015-12-11 16:02:08 -05:00
Rob Rix
f9a72f75e1 Add a silly Arbitrary instance for Diff. 2015-12-11 16:02:02 -05:00
Rob Rix
d07cd36e40 CategorySet is Arbitrary. 2015-12-11 16:01:46 -05:00
Rob Rix
64c4787d81 CategorySet is Categorizable. 2015-12-11 16:01:40 -05:00
Rob Rix
90b3da2291 Add a fixed-member CategorySet type. 2015-12-11 16:01:28 -05:00
Rob Rix
f667109c28 Test _Term_ equality, not ArbitraryTerm equality. 2015-12-11 15:51:25 -05:00
Rob Rix
97ff45bd28 Remove an obsolete import. 2015-12-11 15:50:35 -05:00
Rob Rix
066e0511d1 🔥 arbitraryBounded. 2015-12-11 15:47:43 -05:00
Rob Rix
50090dd73a Make leaves likelier. 2015-12-11 15:47:23 -05:00
Rob Rix
91317207fe Resume generating arbitrary keyed nodes. 2015-12-11 15:47:19 -05:00
Rob Rix
9ece0af975 Bound depth by the cube root of the size parameter, and length by the square root. 2015-12-11 15:41:35 -05:00
Rob Rix
d9bb395f2c Remove the Arbitrary instance for Syntax. 2015-12-11 15:03:30 -05:00
Rob Rix
2646ebf4ae We need this import for liftM. 2015-12-11 15:03:19 -05:00
Rob Rix
77c9970f25 Don’t bind a variable for n. 2015-12-11 15:03:03 -05:00
Rob Rix
3efa6e6ff4 Recur into arbitrary, and produce arbitrary Keyed nodes. 2015-12-11 15:02:29 -05:00
Rob Rix
76f78234aa Define shrink by case analysis. 2015-12-11 15:01:44 -05:00
Rob Rix
2e97bf44fc Generate arbitrary Fixed terms with bounds &c. 2015-12-11 14:40:29 -05:00
Rob Rix
c4326d54a0 Composition 🎉 2015-12-11 14:39:56 -05:00
Rob Rix
2764c34b8d Generate arbitrary terms using frequency & sized bounds. 2015-12-11 14:38:57 -05:00
Rob Rix
046c3d1813 Try to simplify syntax shrinking in terms. 2015-12-11 14:38:52 -05:00
Rob Rix
ed929f07a0 Bind in the opposite direction. 2015-12-11 14:17:04 -05:00
Rob Rix
02c19d1d93 Shrink Keyed syntax values to subsequences. 2015-12-11 14:14:58 -05:00
Rob Rix
b643e9ce5a Shrink indexed/fixed nodes to subsequences. 2015-12-11 14:07:31 -05:00
Rob Rix
68bf2cecfc Add an Arbitrary instance for Syntax. 2015-12-11 14:05:59 -05:00
Rob Rix
913d484a67 Hide Fixed. 2015-12-11 14:05:46 -05:00
Rob Rix
46dfff2b7c Derive the genericity of ArbitraryTerm. 2015-12-11 13:37:42 -05:00
Rob Rix
f983ec0cc3 Shrink Keyed subterms recursively. 2015-12-11 11:19:13 -05:00
Rob Rix
e1161b46db Shrink Fixed subterms recursively. 2015-12-11 11:17:51 -05:00
Rob Rix
39cfe5f96f Remove a redundant permutation of Fixed terms. 2015-12-11 11:17:39 -05:00
Rob Rix
d5041aaf5e Shrink subterms recursively. 2015-12-11 11:17:20 -05:00
Rob Rix
65bd8b19c8 Remove a redundant variation. 2015-12-11 11:16:52 -05:00
Rob Rix
1cb56f5eb3 Make sure never to shrink to the argument. 2015-12-11 11:16:02 -05:00
Rob Rix
6383404fc4 Shrink subsequences of Fixed terms. 2015-12-11 11:15:39 -05:00
Rob Rix
dacb2dba48 Shrink subsequences of Indexed terms. 2015-12-11 11:15:21 -05:00
Rob Rix
8d0272bdac Implement shrinking over ArbitraryTerm. 2015-12-11 11:14:33 -05:00
Rob Rix
7dd4631053 Remove ArbitrarySyntax. 2015-12-11 11:00:52 -05:00
Rob Rix
40eafd315d Remove the arbitrary instance for ArbitrarySyntax. 2015-12-11 11:00:26 -05:00
Rob Rix
dbbada55da Construct bounded terms. 2015-12-11 11:00:18 -05:00
Rob Rix
e6bddf1cf1 Bound arbitrary Keyed nodes.
I really hope we can clean this up.
2015-12-11 11:00:06 -05:00
Rob Rix
a7c959db6c Use the ordinary ArbitraryTerm constructor. 2015-12-11 10:34:43 -05:00
Rob Rix
2cbe8959fe We don’t need to use ArbitrarySyntax for this. 2015-12-11 10:33:46 -05:00
Rob Rix
fd0c1e7abe Attempt to define the selection of an arbitrary bounded term. 2015-12-11 10:32:31 -05:00
Rob Rix
fda61b074f ArbitraryTerm → Term eliminator. 2015-12-11 09:14:54 -05:00
Rob Rix
bc47d2743f Represent ArbitraryTerm as an annotation/Term pair.
Capturing the recursive structure in `ArbitraryTerm` instead of
deferring it to `Term` allows us to simplify construction of arbitrary
inhabitants.
2015-12-11 09:14:43 -05:00
Rob Rix
6799d5eba1 Use record notation to unwrap ArbitrarySyntax. 2015-12-11 09:12:49 -05:00
Rob Rix
0c23f11d01 Abstract ArbitraryTerm over its annotation type. 2015-12-11 00:35:00 -05:00
Rob Rix
de9aa14da4 ArbitraryTerm is parameterized by its leaf type. 2015-12-11 00:33:43 -05:00
Rob Rix
2f744cd769 ArbitrarySyntax is Arbitrary. 2015-12-11 00:32:59 -05:00
Rob Rix
c7dbd6e79b Add an ArbitrarySyntax type. 2015-12-11 00:32:46 -05:00
Rob Rix
a71a4d2e36 Adjoining onto no rows is also identity. 2015-12-11 00:24:37 -05:00
Rob Rix
de75e838d0 Test that adjoining onto empty rows is identity. 2015-12-11 00:23:57 -05:00
Rob Rix
390fa5ee73 Test that adjoining mempty is idempotent. 2015-12-11 00:22:21 -05:00
Rob Rix
9d71aefd04 Add an Arbitrary instance for Row. 2015-12-11 00:20:25 -05:00
Rob Rix
91140aa8fa Add an Arbitrary instance for Line. 2015-12-11 00:19:48 -05:00
Rob Rix
e84d8804bf Add an Arbitrary instance for HTML. 2015-12-11 00:19:07 -05:00
Rob Rix
06d9a7ef04 mempty! 2015-12-11 00:13:17 -05:00
Rob Rix
23d11c1cc8 adjoin2 is idempotent for additions of and onto empty rows. 2015-12-11 00:12:28 -05:00
Rob Rix
bec2f01f02 Reflexivity requires a == a. 2015-12-11 00:05:23 -05:00
Rob Rix
873441efde Generate an arbitrary leaf. 2015-12-11 00:05:01 -05:00
Rob Rix
f59f92e1d4 Use the prop shorthand. 2015-12-10 23:59:19 -05:00
Rob Rix
9b2fda2a49 Test that equality is reflexive. 2015-12-10 23:55:31 -05:00
Rob Rix
aa9f1d6b23 Derive Show and Eq. 2015-12-10 23:55:21 -05:00
Rob Rix
9589264745 ArbitraryTerm is an instance of Arbitrary. 2015-12-10 23:45:14 -05:00
Rob Rix
54166e7662 Add an ArbitraryTerm newtype. 2015-12-10 23:45:05 -05:00
Rob Rix
60791ffc15 import QuickCheck. 2015-12-10 23:40:42 -05:00
Rob Rix
a9bb3583e7 Fix a faulty test. 2015-12-10 16:47:10 -05:00
Rob Rix
85d141e924 Test that openLine returns Nothing for closed lines. 2015-12-10 16:31:00 -05:00
Rob Rix
d9e63c0331 Clarify a test name. 2015-12-10 16:30:52 -05:00
Rob Rix
6a73248a46 Test that openLine will produce open lines. 2015-12-10 16:29:18 -05:00
Rob Rix
15f27c5faa We have a leaf for the purposes of this test. 2015-12-10 15:48:23 -05:00
Rob Rix
9619d2fa7f That is not how any of this works. 2015-12-10 15:47:34 -05:00
Rob Rix
46bd5bc545 Test that termToLines produces complete lines. 2015-12-10 15:41:02 -05:00
Rob Rix
325d6e6a73 Add a test of multi-line patches. 2015-12-10 15:11:56 -05:00
joshvera
1b370a059d rename some tests 2015-12-10 14:26:49 -05:00
joshvera
2b0c9dc4e2 Fix some of the tests 2015-12-10 14:21:52 -05:00
Rob Rix
0c9308b6ae Use Break to represent newlines. 2015-12-10 11:35:46 -05:00
joshvera
eecfd4ff6d promotes HTML through empty lines 2015-12-09 17:38:40 -05:00
joshvera
a05f03dd92 add some test combinators 2015-12-09 17:29:25 -05:00
joshvera
f3381509b7 remove adjoinRows tests 2015-12-09 17:29:11 -05:00
joshvera
5a252911a2 Fix incorrect index in test 2015-12-09 15:54:31 -05:00
Rob Rix
99bc580df2 Correct a fixture. 2015-12-09 15:28:42 -05:00
Rob Rix
4585545eab Test that we don’t promote newlines through empty lines. 2015-12-09 14:56:33 -05:00
Rob Rix
6dc5a65ae8 Use the newLine definition a bit. 2015-12-09 14:56:26 -05:00
Rob Rix
b97b989803 Add a newLine definition. 2015-12-09 14:56:15 -05:00
Rob Rix
d527a03ca3 Test that adjoining newlines does not append. 2015-12-09 14:50:57 -05:00
Rob Rix
0010bb0c77 Spacing. 2015-12-09 14:47:10 -05:00
joshvera
c67ff8f2e5 working through adjoin2 2015-12-08 19:52:38 -05:00
joshvera
bcb935c49b add maybeFirstNewLine to look in Uls for new lines 2015-12-08 18:09:45 -05:00
joshvera
51be1f341a Fix tests 2015-12-08 12:35:40 -05:00
Rob Rix
19d92de3e0 Revert "Correct the tests."
This reverts commit 6f9d76f3e37b075c34e5901860015cc5d7361c37.
2015-12-07 16:28:16 -05:00
Rob Rix
1ff87605e8 Correct the tests. 2015-12-07 16:02:57 -05:00
Rob Rix
c4600cdc1c More branches. 2015-12-07 14:40:16 -05:00
Rob Rix
119bab2843 Prefix the branch classes. 2015-12-07 14:39:04 -05:00
Rob Rix
90418e3310 Prefix the leaf class with category-. 2015-12-07 14:39:00 -05:00
joshvera
0d6ac00101 Test two-line formatted indexed nodes 2015-12-04 14:18:53 -05:00
joshvera
a37e199f11 format tests 2015-12-04 14:18:41 -05:00
joshvera
f6a6ddb4d3 test two unchanged lines 2015-12-04 12:02:41 -05:00
joshvera
195272faaa Test different formatting 2015-12-04 11:37:01 -05:00
Rob Rix
6aef6bc474 Nest the ranges in the expectations. 2015-12-04 10:49:53 -05:00
Rob Rix
ba5e5f5b9e Correct the expected ranges. 2015-12-04 10:27:03 -05:00
Rob Rix
d4ea7a04cc Offset the ends of ranges too. 2015-12-04 10:26:15 -05:00
Rob Rix
d3c5db105d Test the rows computed for non-empty unchanged branches. 2015-12-04 10:19:19 -05:00
Rob Rix
72eea0c2f5 Use the span convenience. 2015-12-04 10:17:39 -05:00
Rob Rix
3efbc70622 Add a span convenience. 2015-12-04 10:17:33 -05:00
Rob Rix
1814806980 Add API to offset ranges in Info and Annotated. 2015-12-04 10:12:47 -05:00
Rob Rix
357a1aa16c Expect text nodes. 2015-12-04 10:07:38 -05:00
Rob Rix
e60379300f Remove the unused one line unchanged indexed source/range bindings. 2015-12-04 09:50:12 -05:00
Rob Rix
35c573e00b Test the rows generated for single line empty unchanged indexed nodes. 2015-12-04 09:49:34 -05:00
Rob Rix
89afcac011 Use the unchanged API. 2015-12-04 09:46:58 -05:00
Rob Rix
b5bb6c952b Add a convenience for constructing unchanged Annotated terms. 2015-12-04 09:46:24 -05:00
Rob Rix
b5c8f82e52 Remove lineRange & cats. 2015-12-04 09:45:00 -05:00
Rob Rix
d91e5c36ea Use the info convenience. 2015-12-04 09:44:54 -05:00
Rob Rix
1902822257 Add a convenience for constructing info. 2015-12-04 09:44:09 -05:00
Rob Rix
0d9298418e Use the convenience in the single-line unchanged leaves test. 2015-12-04 09:42:57 -05:00
Rob Rix
3a8f02f163 Add a convenience for the categories. 2015-12-04 09:42:42 -05:00
Rob Rix
43691b9473 Add source/range for a single line indexed string. 2015-12-04 09:41:11 -05:00
Rob Rix
d3c9c2ce89 Rename the line range variable. 2015-12-04 09:40:38 -05:00
Rob Rix
ec210b13f7 Test annotatedRows output for single-line leaves. 2015-12-04 09:16:23 -05:00
Rob Rix
4ccaa65f82 Describe adjoinRows. 2015-12-04 09:00:40 -05:00
Rob Rix
4697f87a88 Migrate the tests to adjoinRows. 2015-12-03 16:24:35 -05:00
Rob Rix
ea58415617 Test the multiple line cases. 2015-12-03 12:07:03 -05:00
Rob Rix
b1c593173f Test that empty lines are the left unit with multiple lines. 2015-12-03 11:58:34 -05:00
Rob Rix
8324f3b066 Test that single lines are concatenated. 2015-12-03 11:52:46 -05:00
Rob Rix
14911bf272 Test that empty lines are the left unit. 2015-12-03 11:47:51 -05:00
Rob Rix
aa1db29cc7 Stub in a test test of adjoinLines. 2015-12-03 11:44:42 -05:00
Rob Rix
0c34de972b This has to be named Main for now. 2015-12-03 11:44:28 -05:00