1
1
mirror of https://github.com/github/semantic.git synced 2024-12-18 12:21:57 +03:00
Commit Graph

423 Commits

Author SHA1 Message Date
Rob Rix
adb84e33f4 Use the state nodes to indicate that we’ve advanced past nodes.. 2017-08-03 13:13:37 -04:00
Rob Rix
d041dad599 Fix some missing imports. 2017-08-03 12:06:03 -04:00
Rob Rix
2529288f87 Merge branch 'master' into requiem-for-a-protolude 2017-08-03 11:51:09 -04:00
Rob Rix
c82bf8f033 Test that error call stacks point at the failing assignments. 2017-08-02 12:21:56 -04:00
Rob Rix
19850efea1 Add callstacks to the spec rules. 2017-08-02 12:11:14 -04:00
Rob Rix
8e8d1a1794 🔥 a redundant import. 2017-07-28 14:46:56 -04:00
Rob Rix
7da8799e08 🔥 Prologue & protolude. 2017-07-28 14:37:02 -04:00
Rob Rix
aa15a97d3e Test matching of alternations around pure. 2017-07-27 09:36:13 -04:00
Rob Rix
49449f5be2 Test that alternation distributes through committed choice & is nullable. 2017-07-26 18:42:36 -04:00
Rob Rix
a5236753e0 Test that alternation distributes through committed choice and matches single values. 2017-07-26 18:42:18 -04:00
Rob Rix
4038d4b1a3 Test that alternation distributes through committed choices and matches repeated values. 2017-07-26 18:41:24 -04:00
Rob Rix
2888a0d7f5 Test that committed choices of repetitions are nullable. 2017-07-26 18:40:19 -04:00
Rob Rix
786e6f6e60 Make sure that we match both when alternating repetitions. 2017-07-26 17:43:39 -04:00
Rob Rix
27f6d2ed25 Test that alternation distributes through children rules. 2017-07-26 12:14:12 -04:00
Rob Rix
898e119af9 Test that alternations of repetitions succeed. 2017-07-26 12:02:18 -04:00
Rob Rix
5c0d27c1a2 Test that overlapping choices match the right branch.
This currently fails due to the left-biased nature of how we merge committed choices.
2017-07-26 11:11:15 -04:00
Rob Rix
6e1be163b3 Test that overlapping choices match the left branch. 2017-07-26 11:09:52 -04:00
Rob Rix
d6beb353fa 🔥 unused imports. 2017-07-23 16:08:05 -04:00
Rob Rix
aa8ebfcd73 Remove the leaf type parameter from SyntaxTerm. 2017-07-23 15:56:08 -04:00
Rob Rix
0ba3264f32 Remove the leaf type parameter from Syntax. 2017-07-23 15:46:29 -04:00
Rob Rix
32c03be782 Rename AssignmentState to State. 2017-07-22 16:13:42 -04:00
Rob Rix
09787f5e93 Combine the Error constructors. 2017-07-22 15:43:48 -04:00
Rob Rix
a04a05cf1a Combine ErrorCause into Error. 2017-07-22 15:31:43 -04:00
Rob Rix
83a0d9c60e Swap the order of the source & assignment. 2017-07-22 14:06:07 -04:00
Rob Rix
455f912941 Swap the order of the projection & source. 2017-07-22 14:04:52 -04:00
Rob Rix
d464da8089 runAssignment is exhaustive. 2017-07-22 13:59:45 -04:00
Timothy Clem
9f20e57740 Spacing 2017-07-21 09:08:57 -07:00
Timothy Clem
2f9f9f5752 Merge remote-tracking branch 'origin/master' into remove-sourceState 2017-07-21 09:07:33 -07:00
Timothy Clem
b934b97f27 s/Palatte/Palette 2017-07-21 09:00:30 -07:00
Timothy Clem
2880052c15 Remove sourceState from AssignmentState 2017-07-20 10:23:21 -07:00
Timothy Clem
1183c0265a err no longer used in these specs 2017-07-20 09:36:41 -07:00
Timothy Clem
6b1a3b0efd Fix zero width repetitions infinite loop
Introduces a stateCounter to detect progress and accepts one and only one zero width match.

Refactored tests a bit to not assert internal state unless specifically necessary.
2017-07-20 09:32:24 -07:00
Timothy Clem
ee0fb33a94 Demonstrate infinite loop with many (pure x) 2017-07-20 09:32:24 -07:00
Timothy Clem
0b23bf901f Use const 2017-07-20 09:32:24 -07:00
Timothy Clem
4cdac77633 Test out catchError 2017-07-20 09:32:24 -07:00
Timothy Clem
64d2175f58 Fix up assignment specs 2017-07-17 14:39:08 -07:00
Rob Rix
cf5794d9cc 🔥 a redundant import. 2017-07-12 15:57:14 -04:00
Rob Rix
e050a44cf4 Define a Node type for the intermediate representation of metadata. 2017-07-12 15:55:21 -04:00
Rob Rix
a1b30f7524 Fix up the tests. 2017-07-12 14:51:38 -04:00
Rob Rix
5c44267e27 Fix the specs. 2017-06-26 12:56:56 -04:00
Rob Rix
fe29a865c3 🔥 redundant hidden symbols. 2017-06-24 17:32:18 -04:00
Rob Rix
b7ea75a9bd Define Source abstractly. 2017-06-24 11:32:04 -04:00
Rob Rix
fc09d74b73 Rename the Source module to Data.Source. 2017-06-24 09:59:41 -04:00
Rob Rix
4097d4bfc0 Rename SourceSpan to Span and SourcePos to Pos. 2017-06-24 09:30:34 -04:00
Rob Rix
eaa98912de Bounds are closed ranges. 2017-06-15 10:06:15 -04:00
Rob Rix
93f61519b7 Update the featureVectorDecorator bounds test. 2017-06-15 09:46:51 -04:00
Rob Rix
46cfee6e28 Update the RWS spec. 2017-06-15 09:44:46 -04:00
Rob Rix
b019a2b237 Correct the spec. 2017-06-07 20:17:14 -04:00
Rob Rix
84c15e3e65 Don’t specify Node in the assignment spec. 2017-06-07 14:27:01 -04:00
Rob Rix
a66a76bb01 Construct the input AST using the node constructor. 2017-06-07 14:26:21 -04:00
Rob Rix
ddc58d3f83 Rename rec to node. 2017-06-07 14:23:37 -04:00
Rob Rix
51fcf532a8 Correct the spec. 2017-06-06 08:47:17 -04:00
Rob Rix
6563d7d195 Correct the tests’ comparability relation. 2017-05-31 15:55:01 -04:00
Rick Winfrey
13077a3f9b Merge branch 'master' into python-assignment 2017-05-18 18:12:36 -07:00
Rob Rix
9c75981833 Construct well-formed nodes. 2017-05-17 15:36:53 -04:00
Rob Rix
516daa7e4f Correct the spec. 2017-05-17 15:35:15 -04:00
Rick Winfrey
fe41b97464 Fix HLint warnings 2017-05-12 09:45:07 -07:00
Rob Rix
b4face5176 Clarify one of the test descriptions. 2017-05-03 11:23:31 -04:00
Rob Rix
a96596b01c Update the tests. 2017-05-03 10:56:01 -04:00
Rob Rix
080f30c704 Test that withTokens preserves anonymous nodes. 2017-05-03 10:13:40 -04:00
Rob Rix
ad642922ec Test that anonymous nodes are not dropped after matching. 2017-05-03 10:09:31 -04:00
Rob Rix
80c3072508 Test that anonymous nodes are dropped at the start of input. 2017-05-03 10:07:53 -04:00
Rob Rix
ab1e7ac9e0 Give a list of symbol types to consider. 2017-05-03 10:03:02 -04:00
Rob Rix
7e0f13fc63 Bind the initial state to clarify the intent of the test. 2017-05-03 09:42:57 -04:00
Rob Rix
7ae74cdacc Use makeState to tidy up an expectation. 2017-05-03 09:42:18 -04:00
Rob Rix
72de8792c4 Construct Source with OverloadedStrings. 2017-05-03 09:40:52 -04:00
Rob Rix
1c968e3aab Use makeState in the assignment spec. 2017-05-03 09:39:24 -04:00
Rob Rix
bfd55c49c9 Correct a test. 2017-05-03 09:39:19 -04:00
Rob Rix
9193e91bf6 Correct some tests to only depend on the values. 2017-05-01 10:05:36 -04:00
Rob Rix
ccdb54e01e Make the tests compile. 2017-05-01 10:01:59 -04:00
Rob Rix
f991988eea Show the source of errors. 2017-04-26 14:54:29 -04:00
Rob Rix
e89ea96739 Test the specific error message we get for cascading children failures. 2017-04-26 11:45:58 -04:00
Rob Rix
447412be86 Define committed choice as a map of alternatives. 2017-04-26 11:29:13 -04:00
Rob Rix
fe1a04dc91 Differentiate between success and errors with no messages. 2017-04-26 11:27:56 -04:00
joshvera
7395e88ab0 Remove Data.RandomWalkSimilarity 2017-04-24 15:53:11 -04:00
Rob Rix
55934f656b Correct indentation. 2017-04-24 10:44:37 -04:00
Rob Rix
de0cdc98aa Add SourcePos information to the tests. 2017-04-24 10:27:45 -04:00
Rob Rix
296d9bb03d Fix the tests. 2017-04-21 16:12:56 -04:00
Rob Rix
f97ed6cc37 Rename Content to Source. 2017-04-19 16:00:44 -04:00
Rob Rix
c589e229ee Rename rule to symbol. 2017-04-19 13:11:09 -04:00
Rob Rix
ccad5c275e Update the tests. 2017-04-18 11:06:24 -04:00
Rob Rix
5ad80666ad Test that children assignments match multiple nested children. 2017-04-10 11:24:30 -04:00
Rob Rix
b1b1d2bd2f Test that assignment continues after children assignments. 2017-04-10 10:52:12 -04:00
Rob Rix
c2482a0610 Test that children assignments nest. 2017-04-10 10:35:39 -04:00
Rob Rix
c9cf3d0bb8 Tidy up the repetition test. 2017-04-10 09:01:33 -04:00
Rob Rix
72ad4e027e Generalize the ast helper over the grammar type. 2017-04-07 21:26:02 -04:00
Rob Rix
a43ff988ae Test that rule assignment does not advance the cursor. 2017-04-07 14:59:13 -04:00
Rob Rix
79454112c5 Test that content assignment advances the cursor. 2017-04-07 14:57:44 -04:00
Rob Rix
c2a2b0b32b Test that content assignment produces nodes’ content. 2017-04-07 14:57:00 -04:00
Rob Rix
0cc5c84706 Move the rule assignment tests down. 2017-04-07 14:50:57 -04:00
Rob Rix
f082473b4f Rename the test for rule assignments. 2017-04-07 14:48:02 -04:00
Rob Rix
df130daceb Group the Applicative tests together. 2017-04-07 14:47:31 -04:00
Rob Rix
806d4a702f Group the Alternative tests together. 2017-04-07 14:47:23 -04:00
Rob Rix
71c5372d17 Test that children assignment fails if the subrule fails. 2017-04-07 14:43:53 -04:00
Rob Rix
b2da4ca89a Test that children assignments match if their subrule matches. 2017-04-07 14:42:25 -04:00
Rob Rix
dfb5cff0dc Test that children advances the cursor. 2017-04-07 14:39:13 -04:00
Rob Rix
03ea4a55fc Correct the test assignments. 2017-04-07 14:37:22 -04:00
Rob Rix
c27af0034e Rename stepAssignment to runAssignment. 2017-04-07 13:31:26 -04:00
Rob Rix
3a87919d22 Simplify the tests. 2017-04-07 12:36:14 -04:00
Rob Rix
76240b1d67 Refocus the existing assignment specs. 2017-04-07 12:21:45 -04:00
Rob Rix
18cd862dc3 Parameterize rws by the approximate edit distance. 2017-02-23 16:13:42 -05:00
Rob Rix
ef2715f4f0 RWS’s comparison function takes These. 2017-02-23 14:17:52 -05:00
Rob Rix
22236ebd7e Give RWS separate functions for comparisons and determining whether a comparison should be made. 2017-02-23 14:13:13 -05:00
Rob Rix
ca134a8857 Account for vectors being in Maybe now. 2017-02-14 13:23:33 -05:00
Rob Rix
93937a1bf9 Fix the tests. 2017-02-08 11:15:37 -05:00
Rob Rix
c734ddb7aa 🔥 a redundant import. 2017-02-06 10:18:07 -05:00
Rob Rix
84a0c70a7c Use the FeatureVector type synonym. 2017-02-03 15:54:28 -05:00
Rob Rix
8e1c5706b6 Replace uses of (.:) with (:.). 2017-01-19 15:46:28 -05:00
Rob Rix
877fec5e38 Rename RNil to Nil. 2017-01-19 15:36:04 -05:00
Rob Rix
389378fbff Migrate the Mergeable property tests to leancheck. 2017-01-08 00:10:14 -05:00
Rob Rix
43faae0864 Migrate the RWS property tests to leancheck. 2017-01-07 23:27:01 -05:00
joshvera
b5ff4178e9 scope to getLabel 2016-10-13 16:16:50 -04:00
joshvera
dfe8648a11 Fix tests 2016-10-12 19:19:36 -04:00
joshvera
bfe57829d6 Merge remote-tracking branch 'origin/master' into rws-large-diffs 2016-09-27 10:34:19 -04:00
joshvera
0535744ebc more imports 2016-09-16 11:48:58 -04:00
Rob Rix
8d465b96ab Annotate the leaf type. 2016-09-15 18:34:54 -04:00
Rob Rix
97b7f27683 Give a type signature for decorate.
This fixes a problem where ghc will loop forever trying to infer the
type.
2016-09-15 18:32:57 -04:00
Rob Rix
d0395cd227 🔥 some redundant parens. 2016-09-15 18:12:32 -04:00
joshvera
d3440439dc Merge remote-tracking branch 'origin/master' into rws-large-diffs 2016-09-12 14:55:20 -04:00
joshvera
dbb687b33e Split Term and Diff into SyntaxTerm and SyntaxDiff types as well 2016-09-09 14:51:20 -04:00
Rob Rix
98637ad656 Generalize Term/TermF & Diff/DiffF over the functor. 2016-09-09 14:46:50 -04:00
Rob Rix
00689650dd Use the defaultFeatureVectorDecorator in the tests. 2016-08-18 14:03:36 -04:00
Rob Rix
d169e6fa66 Spacing. 2016-08-18 12:51:07 -04:00
Rob Rix
b14a7765e6 Copy in b. 2016-08-18 11:40:39 -04:00
Rob Rix
ecaff655c1 Extract a function to copy terms in. 2016-08-18 11:40:33 -04:00
Rob Rix
cabf1a887e Compute recursive as copies instead of replacements.
This should make us more accurate to the tests of Interpreter.
2016-08-18 11:37:55 -04:00
Rob Rix
02bb72ee0b Move compare to the where clause. 2016-08-18 11:25:21 -04:00
Rob Rix
8aa0f082a6 Bump _q_ in all of the specs.
Figure it’s best if they use the same value for the parameter.
2016-08-18 11:23:21 -04:00
Rob Rix
e820b43469 🔥 a redundant import. 2016-08-12 13:40:41 -04:00
Rob Rix
b91b305f32 Re-enable the RWS insertion bias tests. 2016-08-12 13:22:55 -04:00
Rob Rix
443df7da7c Merge branch 'unbiased-branch-diff-tests-that-actually-test-branch-diff-bias' into unbiased-branch-diffs
# Conflicts:
#	src/Diffing.hs
#	test/CorpusSpec.hs
#	tools/semantic-git-diff/test/corpus/diff-summaries.json
2016-08-12 13:04:33 -04:00
Rob Rix
d9be26396c Make the RWS test pending on #683. 2016-08-12 12:58:37 -04:00
Rob Rix
d3c333ae64 🔥 the faulty tests of unbiased insertions. 2016-08-12 11:59:44 -04:00
Rob Rix
b1e893b3f8 Add a concrete test of unbiased insertions. 2016-08-12 11:59:09 -04:00
Rob Rix
ada00d0485 The RWS unbiased tests require disjoint syntax constructors. 2016-08-12 11:44:29 -04:00
Rob Rix
5462278d0f Use the replacing combinator in the tests. 2016-08-12 11:44:23 -04:00
Rob Rix
bcaf909957 Revert "Mark the (failing) rws tests as pending for the time being."
This reverts commit a9025cacda01db216590e99dd36e867611e0f953.
2016-08-12 11:44:18 -04:00
Rob Rix
fa983e5561 Add a concrete test of unbiased deletions. 2016-08-12 11:40:30 -04:00
Rob Rix
2eead056e1 The RWS unbiased tests require disjoint syntax constructors. 2016-08-12 09:56:24 -04:00
Rob Rix
7bbbc4cbea Use the replacing combinator in the tests. 2016-08-12 09:53:16 -04:00
Rob Rix
0eb43f47a3 Use wrap in the RWS correctness test. 2016-08-12 09:46:45 -04:00
Rob Rix
df25851902 Revert "Mark the (failing) rws tests as pending for the time being."
This reverts commit a9025cacda01db216590e99dd36e867611e0f953.
2016-08-12 09:13:52 -04:00
Rob Rix
73f73fdb40 Mark the (failing) rws tests as pending for the time being. 2016-08-11 15:24:02 -04:00
Rob Rix
261e82fd21 Extract a constructor for the root terms. 2016-08-11 12:54:14 -04:00
Rob Rix
7d8eb02ec8 Strip the diff and terms in the rws correctness test. 2016-08-11 12:50:56 -04:00
Rob Rix
0aef8a8467 Use stripDiff in the RWS spec. 2016-08-11 12:44:49 -04:00
Rob Rix
544a6d3daf RWS uses category equality for its comparisons. 2016-08-11 12:31:44 -04:00
Rob Rix
e4c55a8dbd Add (failing) tests of rws’ bias. 2016-08-11 11:53:51 -04:00
Rob Rix
f7055f16e8 Extract the decorating of arbitrary terms. 2016-08-11 10:27:11 -04:00
Rob Rix
cd04fe5dd3 Move positively into a let binding. 2016-08-10 11:32:42 -04:00
Rob Rix
959f15198c 🔥 Data.Vector.Arbitrary. 2016-08-10 09:44:02 -04:00
Rob Rix
f05570dd3e The RWS specs don’t need to generate arbitrary vectors. 2016-08-10 09:38:41 -04:00
Rob Rix
1ce869b8d0 Avoid forAll/suchThat in the p/q tests.
This enables us to shrink properly.
2016-08-10 09:05:12 -04:00
Rob Rix
4b2a7eaea4 Test featureVectorDecorator directly. 2016-08-09 16:34:10 -04:00
Rob Rix
1b59d2782f Add a function to compute positive integers. 2016-08-09 16:33:54 -04:00
Rob Rix
46c2e4d8e0 Test pqGramDecorator directly. 2016-08-09 16:23:38 -04:00
Rob Rix
15f0f9c47a Label arbitrary p,q-grams with the text, not the record. 2016-08-09 16:18:45 -04:00
Rob Rix
a06dd1dc1e Move the Arbitrary instance over Vector into its own module. 2016-08-05 10:14:53 -04:00
Rob Rix
3e85be8740 Generate arbitrary non-empty vectors. 2016-08-05 09:26:21 -04:00
Rob Rix
eb81569599 🔥 the getLabel parameter to rws. 2016-08-05 09:08:17 -04:00
Rob Rix
9fc9827b34 rws requires a feature vector. 2016-08-04 21:01:54 -04:00
Rob Rix
32f9152f22 Rename a test. 2016-08-04 19:48:21 -04:00
Rob Rix
46a3aee33e Define pqGrams in terms of the decorator. 2016-08-04 19:19:03 -04:00
Rob Rix
e45185037c Merge branch 'master' into precompute-p,q-grams 2016-07-29 01:52:14 -04:00
Rob Rix
755d9877b4 pqGrams takes the label function before p and q. 2016-07-27 00:22:22 -04:00
Rob Rix
e5f9d1ed28 Test the Mergeable laws over lists. 2016-07-26 15:27:32 -04:00
Rob Rix
475ec475b6 Weaken the identity laws to be non-empty. 2016-07-26 15:27:16 -04:00
Rob Rix
dd0b0322fc Add a property demonstrating the relationship between sequenceAlt over [Maybe a] & pure . catMaybes. 2016-07-26 14:56:02 -04:00
Rob Rix
cfb7361b9c Scale the list generator. 2016-07-26 14:44:25 -04:00
Rob Rix
2ee68cc4b2 Add an identity law over merge. 2016-07-26 13:30:09 -04:00
Rob Rix
794fffbf47 Clean up the generator. 2016-07-26 13:25:16 -04:00
Rob Rix
b987a40377 sequenceAlt’s relationship with merge is the inverse of merge’s relationship with sequenceAlt. 2016-07-26 13:23:14 -04:00
Rob Rix
7ff92d968e Run the merge laws over Syntax. 2016-07-26 13:17:33 -04:00
Rob Rix
e98844e937 Run the merge laws over Identity. 2016-07-26 13:17:13 -04:00
Rob Rix
7d4d14c99b Run the merge laws over Maybe. 2016-07-26 13:16:46 -04:00
Rob Rix
8f25cbd473 🔥 some redundant constraints. 2016-07-26 13:13:45 -04:00
Rob Rix
f64164d872 Generalize a constraint away. 2016-07-26 13:12:32 -04:00
Rob Rix
a967e800bb Move the alternative instances helper down. 2016-07-26 13:12:09 -04:00
Rob Rix
be973b5bae Generalize out a helper function to validate laws against alternative instances. 2016-07-26 13:11:52 -04:00
Rob Rix
5430f45850 Verify the merge laws over []/Maybe. 2016-07-26 13:06:18 -04:00
Rob Rix
df4621622a Formulate a merge law. 2016-07-26 13:03:13 -04:00
Rob Rix
475c97190c Parallelize the Mergeable spec. 2016-07-26 12:47:38 -04:00
Rob Rix
5d6b1cd047 Test the sequenceAlt laws over Syntax. 2016-07-26 05:39:02 -04:00
Rob Rix
7af29fcf10 Define the identity law over pure. 2016-07-26 04:25:45 -04:00
Rob Rix
6806438949 Generalize the sequenceAlt laws over the inner alternative functor. 2016-07-26 04:23:03 -04:00
Rob Rix
f76b334b8c Validate the sequenceAltLaws against the Identity instance. 2016-07-26 04:16:40 -04:00
Rob Rix
a0cf6ce702 Validate the relationship between sequenceAlt and merge. 2016-07-26 04:15:56 -04:00
Rob Rix
d1bbe1c029 Validate the sequenceAltLaws against Maybe. 2016-07-26 04:08:19 -04:00
Rob Rix
88bb767ff7 Group the law invocations by functor. 2016-07-26 04:07:46 -04:00
Rob Rix
734254194c Define sequenceAltLaws to take a generator of Mergeable values. 2016-07-26 04:06:51 -04:00
Rob Rix
fa3b7d126e Factor the sequenceAlt law properties into a separate function. 2016-07-26 04:04:24 -04:00
Rob Rix
93c53ed90a Stub in a property test for the proposed identity law. 2016-07-26 04:02:52 -04:00
Rob Rix
b03f1d3b91 Stub in a spec function. 2016-07-26 03:58:14 -04:00
Rob Rix
8f15a59282 Stub in a spec for the Mergeable stuff. 2016-07-26 03:56:52 -04:00
Rob Rix
4b33b24a05 Labels are computed from the entire term. 2016-07-15 14:45:37 -04:00
Rob Rix
d6c994a852 🔥 a blank line apparently. 2016-07-12 17:19:38 -04:00
Rob Rix
2108cddff6 Test rws’ behaviour w.r.t. ordering. 2016-07-07 10:37:55 -04:00
Rob Rix
51f0995c91 🔥 DataKinds. 2016-07-05 09:56:48 -04:00
Rob Rix
4cfa993239 Move the Arbitrary gram functions into Data.RandomWalkSimilarity. 2016-07-05 09:18:53 -04:00
Rob Rix
58138d5867 Scale down the sizes by a factor of four. 2016-06-30 12:37:41 -04:00