Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unit tests to fuzz serializer on dictionary types #103

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion FSharpLu.Tests/JsonTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ type 'a Wrapper = { WrappedField : 'a }
type NestedStructure = { subField : int }
type NestedOptionStructure = { field : NestedStructure option }

type SomeTupleType = int * string list * int * int64 * OptionOfDu * Color * int Tree
type SomeTupleType = int * string list * int * int64 * OptionOfDu * Color * int Tree

type TypeWithDict = { ThisIsADictionaryField : System.Collections.Generic.IDictionary<string,int> }

/// Test cases for possible ambiguity between option types and other DU or records with a 'Some' field.
module SomeAmbiguity =
Expand Down Expand Up @@ -114,6 +116,7 @@ type ReciprocalityCompact () =
static member x24 = reciprocal<SomeAmbiguity.Ambiguous3> Compact.serialize Compact.deserialize
static member x25 = reciprocal<int list> Compact.serialize Compact.deserialize
static member x26 = reciprocal<SomeTupleType> Compact.serialize Compact.deserialize
static member x27 = reciprocal<TypeWithDict> Compact.serialize Compact.deserialize

type ReciprocalityCamelCase () =
static member x1 = reciprocal<ComplexDu> CamelCaseSerializer.serialize CamelCaseSerializer.deserialize
Expand Down Expand Up @@ -142,6 +145,7 @@ type ReciprocalityCamelCase () =
static member x24 = reciprocal<SomeAmbiguity.Ambiguous3> CamelCaseSerializer.serialize CamelCaseSerializer.deserialize
static member x25 = reciprocal<int list> CamelCaseSerializer.serialize CamelCaseSerializer.deserialize
static member x26 = reciprocal<SomeTupleType> CamelCaseSerializer.serialize CamelCaseSerializer.deserialize
static member x27 = reciprocal<TypeWithDict> CamelCaseSerializer.serialize CamelCaseSerializer.deserialize

type CoincidesWithJsonNetOnDeserialization () =
static member x1 = coincidesWithDefault<ComplexDu>
Expand Down Expand Up @@ -170,6 +174,7 @@ type CoincidesWithJsonNetOnDeserialization () =
static member x24 = coincidesWithDefault<SomeAmbiguity.Ambiguous3>
static member x25 = coincidesWithDefault<int list>
static member x26 = coincidesWithDefault<SomeTupleType>
static member x27 = coincidesWithDefault<TypeWithDict>


type BackwardCompatibility () =
Expand Down Expand Up @@ -199,6 +204,7 @@ type BackwardCompatibility () =
static member x24 = backwardCompatibleWithDefault<SomeAmbiguity.Ambiguous3>
static member x25 = backwardCompatibleWithDefault<int list>
static member x26 = backwardCompatibleWithDefault<SomeTupleType>
static member x27 = backwardCompatibleWithDefault<TypeWithDict>


let inline ``Run using all serializers``< ^T when ^T:equality> (test: (^T->string)->(string-> ^T)-> ^T->unit) (input: ^T) =
Expand Down