3module DataFamilies.Properties (tests) where
8import DataFamilies.Encoders
9import DataFamilies.Instances ()
10import Properties hiding (tests)
12import Test.Framework (Test, testGroup)
13import Test.Framework.Providers.QuickCheck2 (testProperty)
15--------------------------------------------------------------------------------
18tests = testGroup "data families" [
19 testGroup "template-haskell" [
22 testProperty "string" (isString . thNullaryToJSONString)
23 , testProperty "2ElemArray" (is2ElemArray . thNullaryToJSON2ElemArray)
24 , testProperty "TaggedObject" (isNullaryTaggedObject . thNullaryToJSONTaggedObject)
25 , testProperty "ObjectWithSingleField" (isObjectWithSingleField . thNullaryToJSONObjectWithSingleField)
26 , testGroup "roundTrip" [
27 testProperty "string" (toParseJSON thNullaryParseJSONString thNullaryToJSONString)
28 , testProperty "2ElemArray" (toParseJSON thNullaryParseJSON2ElemArray thNullaryToJSON2ElemArray)
29 , testProperty "TaggedObject" (toParseJSON thNullaryParseJSONTaggedObject thNullaryToJSONTaggedObject)
30 , testProperty "ObjectWithSingleField" (toParseJSON thNullaryParseJSONObjectWithSingleField thNullaryToJSONObjectWithSingleField)
33 , testGroup "SomeType" [
34 testProperty "2ElemArray" (is2ElemArray . thSomeTypeToJSON2ElemArray)
35 , testProperty "TaggedObject" (isTaggedObject . thSomeTypeToJSONTaggedObject)
36 , testProperty "ObjectWithSingleField" (isObjectWithSingleField . thSomeTypeToJSONObjectWithSingleField)
37 , testGroup "roundTrip" [
38 testProperty "2ElemArray" (toParseJSON thSomeTypeParseJSON2ElemArray thSomeTypeToJSON2ElemArray)
39 , testProperty "TaggedObject" (toParseJSON thSomeTypeParseJSONTaggedObject thSomeTypeToJSONTaggedObject)
40 , testProperty "ObjectWithSingleField" (toParseJSON thSomeTypeParseJSONObjectWithSingleField thSomeTypeToJSONObjectWithSingleField)
43 , testGroup "Approx" [
44 testProperty "string" (isString . thApproxToJSONUnwrap)
45 , testProperty "ObjectWithSingleField" (isObjectWithSingleField . thApproxToJSONDefault)
46 , testGroup "roundTrip" [
47 testProperty "string" (toParseJSON thApproxParseJSONUnwrap thApproxToJSONUnwrap)
48 , testProperty "ObjectWithSingleField" (toParseJSON thApproxParseJSONDefault thApproxToJSONDefault)
52 testProperty "string" (isString . thGADTToJSONUnwrap)
53 , testProperty "ObjectWithSingleField" (isObjectWithSingleField . thGADTToJSONDefault)
54 , testGroup "roundTrip" [
55 testProperty "string" (toParseJSON thGADTParseJSONUnwrap thGADTToJSONUnwrap)
56 , testProperty "ObjectWithSingleField" (toParseJSON thGADTParseJSONDefault thGADTToJSONDefault)
60 , testGroup "toEncoding" [
61 testProperty "NullaryString" $
62 thNullaryToJSONString `sameAs` thNullaryToEncodingString
63 , testProperty "Nullary2ElemArray" $
64 thNullaryToJSON2ElemArray `sameAs` thNullaryToEncoding2ElemArray
65 , testProperty "NullaryTaggedObject" $
66 thNullaryToJSONTaggedObject `sameAs` thNullaryToEncodingTaggedObject
67 , testProperty "NullaryObjectWithSingleField" $
68 thNullaryToJSONObjectWithSingleField `sameAs`
69 thNullaryToEncodingObjectWithSingleField
70 , testProperty "ApproxUnwrap" $
71 thApproxToJSONUnwrap `sameAs` thApproxToEncodingUnwrap
72 , testProperty "ApproxDefault" $
73 thApproxToJSONDefault `sameAs` thApproxToEncodingDefault
74 , testProperty "SomeType2ElemArray" $
75 thSomeTypeToJSON2ElemArray `sameAs` thSomeTypeToEncoding2ElemArray
76 , testProperty "SomeTypeTaggedObject" $
77 thSomeTypeToJSONTaggedObject `sameAs` thSomeTypeToEncodingTaggedObject
78 , testProperty "SomeTypeObjectWithSingleField" $
79 thSomeTypeToJSONObjectWithSingleField `sameAs`
80 thSomeTypeToEncodingObjectWithSingleField
84 , testGroup "generics" [
87 testProperty "string" (isString . gNullaryToJSONString)
88 , testProperty "2ElemArray" (is2ElemArray . gNullaryToJSON2ElemArray)
89 , testProperty "TaggedObject" (isNullaryTaggedObject . gNullaryToJSONTaggedObject)
90 , testProperty "ObjectWithSingleField" (isObjectWithSingleField . gNullaryToJSONObjectWithSingleField)
91 , testGroup "roundTrip" [
92 testProperty "string" (toParseJSON gNullaryParseJSONString gNullaryToJSONString)
93 , testProperty "2ElemArray" (toParseJSON gNullaryParseJSON2ElemArray gNullaryToJSON2ElemArray)
94 , testProperty "TaggedObject" (toParseJSON gNullaryParseJSONTaggedObject gNullaryToJSONTaggedObject)
95 , testProperty "ObjectWithSingleField" (toParseJSON gNullaryParseJSONObjectWithSingleField gNullaryToJSONObjectWithSingleField)
98 , testGroup "SomeType" [
99 testProperty "2ElemArray" (is2ElemArray . gSomeTypeToJSON2ElemArray)
100 , testProperty "TaggedObject" (isTaggedObject . gSomeTypeToJSONTaggedObject)
101 , testProperty "ObjectWithSingleField" (isObjectWithSingleField . gSomeTypeToJSONObjectWithSingleField)
102 , testGroup "roundTrip" [
103 testProperty "2ElemArray" (toParseJSON gSomeTypeParseJSON2ElemArray gSomeTypeToJSON2ElemArray)
104 , testProperty "TaggedObject" (toParseJSON gSomeTypeParseJSONTaggedObject gSomeTypeToJSONTaggedObject)
105 , testProperty "ObjectWithSingleField" (toParseJSON gSomeTypeParseJSONObjectWithSingleField gSomeTypeToJSONObjectWithSingleField)
108 , testGroup "Approx" [
109 testProperty "string" (isString . gApproxToJSONUnwrap)
110 , testProperty "ObjectWithSingleField" (isObjectWithSingleField . gApproxToJSONDefault)
111 , testGroup "roundTrip" [
112 testProperty "string" (toParseJSON gApproxParseJSONUnwrap gApproxToJSONUnwrap)
113 , testProperty "ObjectWithSingleField" (toParseJSON gApproxParseJSONDefault gApproxToJSONDefault)
117 , testGroup "toEncoding" [
118 testProperty "NullaryString" $
119 gNullaryToJSONString `sameAs` gNullaryToEncodingString
120 , testProperty "Nullary2ElemArray" $
121 gNullaryToJSON2ElemArray `sameAs` gNullaryToEncoding2ElemArray
122 , testProperty "NullaryTaggedObject" $
123 gNullaryToJSONTaggedObject `sameAs` gNullaryToEncodingTaggedObject
124 , testProperty "NullaryObjectWithSingleField" $
125 gNullaryToJSONObjectWithSingleField `sameAs`
126 gNullaryToEncodingObjectWithSingleField
127 , testProperty "ApproxUnwrap" $
128 gApproxToJSONUnwrap `sameAs` gApproxToEncodingUnwrap
129 , testProperty "ApproxDefault" $
130 gApproxToJSONDefault `sameAs` gApproxToEncodingDefault
131 , testProperty "SomeType2ElemArray" $
132 gSomeTypeToJSON2ElemArray `sameAs` gSomeTypeToEncoding2ElemArray
133 , testProperty "SomeTypeTaggedObject" $
134 gSomeTypeToJSONTaggedObject `sameAs` gSomeTypeToEncodingTaggedObject
135 , testProperty "SomeTypeObjectWithSingleField" $
136 gSomeTypeToJSONObjectWithSingleField `sameAs`
137 gSomeTypeToEncodingObjectWithSingleField
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list