From 8069f6aecc2425e0fdef292c693d392c087d0452 Mon Sep 17 00:00:00 2001 From: Ocean Date: Mon, 2 Sep 2024 15:25:20 +0000 Subject: [PATCH] wip --- backend/src/BuiltinExecution/Libs/Parser.fs | 162 +- backend/src/LibExecution/PackageIDs.fs | 3 + .../LibExecution/ProgramTypesToDarkTypes.fs | 4 + .../ProgramTypesToRuntimeTypes.fs | 38 +- backend/src/Prelude/Prelude.fs | 2 +- backend/src/Prelude/String.fs | 2 + .../testfiles/execution/cloud/_events.dark | 12 +- .../testfiles/execution/cloud/internal.dark | 125 +- backend/testfiles/execution/language/big.dark | 82 +- .../testfiles/execution/language/derror.dark | 69 +- .../testfiles/execution/language/dfloat.dark | 6 +- .../testfiles/execution/language/dlist.dark | 14 +- .../testfiles/execution/language/dtuple.dark | 14 +- .../testfiles/execution/language/eand.dark | 30 +- .../testfiles/execution/language/eapply.dark | 183 +- .../execution/language/econstant.dark | 164 +- .../testfiles/execution/language/edict.dark | 6 +- .../execution/language/efieldaccess.dark | 24 +- backend/testfiles/execution/language/eif.dark | 42 +- .../testfiles/execution/language/einfix.dark | 24 +- .../testfiles/execution/language/elambda.dark | 114 +- .../testfiles/execution/language/elet.dark | 137 +- .../testfiles/execution/language/ematch.dark | 794 +++--- backend/testfiles/execution/language/eor.dark | 30 +- .../testfiles/execution/language/epipe.dark | 155 +- .../testfiles/execution/language/estring.dark | 26 +- .../execution/language/evariable.dark | 5 +- .../execution/language/type-alias.dark | 124 +- .../execution/language/type-enum.dark | 200 +- .../execution/language/type-record.dark | 106 +- .../testfiles/execution/stdlib/alt-json.dark | 176 +- .../testfiles/execution/stdlib/base64.dark | 150 +- backend/testfiles/execution/stdlib/bool.dark | 52 +- backend/testfiles/execution/stdlib/bytes.dark | 15 +- backend/testfiles/execution/stdlib/char.dark | 426 ++-- .../testfiles/execution/stdlib/crypto.dark | 78 +- backend/testfiles/execution/stdlib/date.dark | 472 ++-- backend/testfiles/execution/stdlib/dict.dark | 196 +- backend/testfiles/execution/stdlib/float.dark | 278 +- backend/testfiles/execution/stdlib/html.dark | 140 +- backend/testfiles/execution/stdlib/http.dark | 50 +- .../execution/stdlib/httpclient.dark | 669 ++--- .../testfiles/execution/stdlib/int128.dark | 348 ++- backend/testfiles/execution/stdlib/int16.dark | 412 +-- backend/testfiles/execution/stdlib/int32.dark | 431 ++-- backend/testfiles/execution/stdlib/int64.dark | 684 +++-- backend/testfiles/execution/stdlib/int8.dark | 487 ++-- backend/testfiles/execution/stdlib/json.dark | 1852 +++++++------- backend/testfiles/execution/stdlib/list.dark | 649 ++--- backend/testfiles/execution/stdlib/math.dark | 69 +- .../testfiles/execution/stdlib/nomodule.dark | 672 ++--- .../testfiles/execution/stdlib/option.dark | 629 ++--- .../testfiles/execution/stdlib/parser.dark | 136 +- .../testfiles/execution/stdlib/result.dark | 517 ++-- .../stdlib/semanticTokenization.dark | 2255 ++++++++--------- .../testfiles/execution/stdlib/string.dark | 1460 ++++++----- backend/testfiles/execution/stdlib/tuple.dark | 86 +- .../testfiles/execution/stdlib/uint128.dark | 203 +- .../testfiles/execution/stdlib/uint16.dark | 342 +-- .../testfiles/execution/stdlib/uint32.dark | 332 +-- .../testfiles/execution/stdlib/uint64.dark | 325 ++- backend/testfiles/execution/stdlib/uint8.dark | 342 +-- backend/testfiles/execution/stdlib/uuid.dark | 34 +- backend/testfiles/execution/stdlib/x509.dark | 91 +- ...aders.test => simple-request-headers.test} | 3 +- backend/tests/TestUtils/TestUtils.fs | 46 + backend/tests/Tests/LibExecution.Tests.fs | 188 +- backend/tests/Tests/NewParser.Tests.fs | 8 +- .../darklang/languageTools/nameResolver.dark | 4 +- .../darklang/languageTools/parser/core.dark | 17 +- .../darklang/languageTools/parser/expr.dark | 12 +- .../languageTools/parser/matchPattern.dark | 7 +- .../languageTools/parser/pipeExpr.dark | 39 +- .../runtimeErrors/execution.dark | 2 +- .../darklang/languageTools/writtenTypes.dark | 1 + .../writtenTypesToProgramTypes.dark | 19 +- packages/internal/tests.dark | 304 ++- .../test/corpus/exhaustive/exprs/char.txt | 142 +- 78 files changed, 9885 insertions(+), 8662 deletions(-) rename backend/testfiles/httphandler/{_simple-request-headers.test => simple-request-headers.test} (92%) diff --git a/backend/src/BuiltinExecution/Libs/Parser.fs b/backend/src/BuiltinExecution/Libs/Parser.fs index 2db91dbbb4..e83a5f6e6e 100644 --- a/backend/src/BuiltinExecution/Libs/Parser.fs +++ b/backend/src/BuiltinExecution/Libs/Parser.fs @@ -3,6 +3,7 @@ module BuiltinExecution.Libs.Parser open FSharp.Control.Tasks open System.Threading.Tasks open System.Text +open System.Globalization open Prelude open LibExecution.RuntimeTypes @@ -20,6 +21,92 @@ let pointTypeName = FQTypeName.fqPackage IDs.point let rangeTypeName = FQTypeName.fqPackage IDs.range let parsedNodeTypeName = FQTypeName.fqPackage IDs.parsedNode +let parse (sourceCode : string) : Dval = + // This was added to handle EGCs correctly + let byteIndexToCharIndex (byteIndex : int) (text : string) : int = + let bytes = Encoding.UTF8.GetBytes(text) + let subText = Encoding.UTF8.GetString(bytes, 0, byteIndex) + StringInfo.ParseCombiningCharacters(subText).Length + + let processLine (line : string) (startIndex : int) (endIndex : int) = + let textElements = StringInfo.GetTextElementEnumerator(line) + let mutable result = "" + let mutable currentIndex = 0 + while textElements.MoveNext() do + if currentIndex >= startIndex && currentIndex < endIndex then + result <- result + (textElements.GetTextElement()) + currentIndex <- currentIndex + 1 + result + + let rec mapNodeAtCursor (cursor : TreeCursor) : Dval = + let mutable children = [] + + if cursor.GotoFirstChild() then + children <- children @ [ mapNodeAtCursor cursor ] + + while cursor.GotoNextSibling() do + children <- children @ [ mapNodeAtCursor cursor ] + + cursor.GotoParent() |> ignore + + let fields = + let mapPoint (point : Point) = + let pointRow = point.row + 1 + let fields = [ "row", DInt64 pointRow; "column", DInt64 point.column ] + DRecord(pointTypeName, pointTypeName, [], Map fields) + + let startPos = cursor.Current.StartPosition + let endPos = cursor.Current.EndPosition + + let range = + let fields = [ "start", mapPoint startPos; "end_", mapPoint endPos ] + DRecord(rangeTypeName, rangeTypeName, [], Map fields) + + let sourceText = + let lines = String.splitOnNewline sourceCode + if lines.Length = 0 then + "" + else + let startLine = lines[startPos.row] + let endLine = lines[endPos.row] + let startCharIndex = byteIndexToCharIndex startPos.column startLine + let endCharIndex = byteIndexToCharIndex endPos.column endLine + + match startPos.row with + | row when row = endPos.row -> + processLine startLine startCharIndex endCharIndex + | _ -> + let firstLine = processLine startLine startCharIndex startLine.Length + let middleLines = + if startPos.row + 1 <= endPos.row - 1 then + lines[startPos.row + 1 .. endPos.row - 1] + |> List.map (fun line -> processLine line 0 line.Length) + else + [] + let lastLine = processLine endLine 0 endCharIndex + String.concat "\n" (firstLine :: middleLines @ [ lastLine ]) + + let fieldName = + if cursor.FieldName = null then + Dval.optionNone KTString + else + Dval.optionSome KTString (DString cursor.FieldName) + + [ ("fieldName", fieldName) + ("typ", DString cursor.Current.Kind) + ("text", DString sourceText) + ("range", range) + ("children", DList(VT.customType parsedNodeTypeName [], children)) ] + + DRecord(parsedNodeTypeName, parsedNodeTypeName, [], Map fields) + + + let parser = new Parser(Language = DarklangLanguage.create ()) + + let tree = + parser.Parse(Encoding.UTF8.GetBytes sourceCode, InputEncoding.Utf8, None) + tree.Root.Walk() |> mapNodeAtCursor + let fns : List = [ { name = fn "parserParseToSimplifiedTree" 0 typeParams = [] @@ -28,80 +115,7 @@ let fns : List = description = "Parses some Darklang code" fn = (function - | _, _, [ DString sourceCode ] -> - // This was added to handle EGCs correctly - let byteIndexToCharIndex (byteIndex : int) (text : string) : int = - let bytes = Encoding.UTF8.GetBytes(text) - let subText = Encoding.UTF8.GetString(bytes, 0, byteIndex) - subText.Length - - let rec mapNodeAtCursor (cursor : TreeCursor) : Dval = - let mutable children = [] - - if cursor.GotoFirstChild() then - children <- children @ [ mapNodeAtCursor cursor ] - - while cursor.GotoNextSibling() do - children <- children @ [ mapNodeAtCursor cursor ] - - cursor.GotoParent() |> ignore - - let fields = - let mapPoint (point : Point) = - let fields = - [ "row", DInt64 point.row; "column", DInt64 point.column ] - DRecord(pointTypeName, pointTypeName, [], Map fields) - - let startPos = cursor.Current.StartPosition - let endPos = cursor.Current.EndPosition - - let range = - let fields = [ "start", mapPoint startPos; "end_", mapPoint endPos ] - DRecord(rangeTypeName, rangeTypeName, [], Map fields) - - let startCharIndex = byteIndexToCharIndex startPos.column sourceCode - let endCharIndex = byteIndexToCharIndex endPos.column sourceCode - - let sourceText = - let lines = String.splitOnNewline sourceCode - if lines.Length = 0 then - "" - else - match startPos.row with - | row when row = endPos.row -> - lines[row][startCharIndex .. (endCharIndex - 1)] - | _ -> - let firstLine = lines[startPos.row][startCharIndex..] - let middleLines = - if startPos.row + 1 <= endPos.row - 1 then - lines[startPos.row + 1 .. endPos.row - 1] - else - [] - let lastLine = lines[endPos.row][.. (endCharIndex - 1)] - - String.concat "\n" (firstLine :: middleLines @ [ lastLine ]) - - let fieldName = - if cursor.FieldName = null then - Dval.optionNone KTString - else - Dval.optionSome KTString (DString cursor.FieldName) - - [ ("fieldName", fieldName) - ("typ", DString cursor.Current.Kind) - ("text", DString sourceText) - ("range", range) - ("children", DList(VT.customType parsedNodeTypeName [], children)) ] - - DRecord(parsedNodeTypeName, parsedNodeTypeName, [], Map fields) - - - let parser = new Parser(Language = DarklangLanguage.create ()) - - let tree = - parser.Parse(Encoding.UTF8.GetBytes sourceCode, InputEncoding.Utf8, None) - - tree.Root.Walk() |> mapNodeAtCursor |> Ply + | _, _, [ DString sourceCode ] -> (parse sourceCode) |> Ply | _ -> incorrectArgs ()) sqlSpec = NotQueryable previewable = Impure diff --git a/backend/src/LibExecution/PackageIDs.fs b/backend/src/LibExecution/PackageIDs.fs index c0f91391c5..7eb352c0ec 100644 --- a/backend/src/LibExecution/PackageIDs.fs +++ b/backend/src/LibExecution/PackageIDs.fs @@ -383,6 +383,9 @@ module Fn = let parseSingleTestFromFile = p [] "parseSingleTestFromFile" "53f3fbc6-25fd-427a-ab0d-ba0559543c99" + let parseTestFile = + p [] "parseTestFile" "95dc8d95-dd38-4df2-aaac-9e78187a17be" + // what we expose to the outside world let idForName (owner : string) diff --git a/backend/src/LibExecution/ProgramTypesToDarkTypes.fs b/backend/src/LibExecution/ProgramTypesToDarkTypes.fs index 348ebcb348..aeff78b978 100644 --- a/backend/src/LibExecution/ProgramTypesToDarkTypes.fs +++ b/backend/src/LibExecution/ProgramTypesToDarkTypes.fs @@ -921,6 +921,9 @@ module Expr = Exception.raiseInternal "Invalid record update" [ "update", update ]) PT.ERecordUpdate(uint64 id, fromDT record, updates) + | DEnum(_, _, [], "EConstant", [ DInt64 id; name ]) -> + PT.EConstant(uint64 id, NameResolution.fromDT FQConstantName.fromDT name) + | e -> Exception.raiseInternal "Invalid Expr" [ "e", e ] @@ -987,6 +990,7 @@ module Const = | DEnum(_, _, [], "CBool", [ DBool b ]) -> PT.Const.CBool b | DEnum(_, _, [], "CString", [ DString s ]) -> PT.Const.CString s | DEnum(_, _, [], "CChar", [ DChar c ]) -> PT.Const.CChar c + | DEnum(_, _, [], "CChar", [ DString c ]) -> PT.Const.CChar c | DEnum(_, _, [], "CFloat", [ sign; DString w; DString f ]) -> PT.Const.CFloat(Sign.fromDT sign, w, f) | DEnum(_, _, [], "CUnit", []) -> PT.Const.CUnit diff --git a/backend/src/LibExecution/ProgramTypesToRuntimeTypes.fs b/backend/src/LibExecution/ProgramTypesToRuntimeTypes.fs index da55b1e1d2..b8a37fd06b 100644 --- a/backend/src/LibExecution/ProgramTypesToRuntimeTypes.fs +++ b/backend/src/LibExecution/ProgramTypesToRuntimeTypes.fs @@ -165,7 +165,20 @@ module MatchPattern = module Expr = let rec toRT (e : PT.Expr) : RT.Expr = match e with - | PT.EChar(id, char) -> RT.EChar(id, char) + | PT.EChar(id, char) -> + let char = + char + |> fun s -> s.Replace(@"\t", "\t") + |> fun s -> s.Replace(@"\n", "\n") + |> fun s -> s.Replace(@"\r", "\r") + |> fun s -> s.Replace(@"\b", "\b") + |> fun s -> s.Replace(@"\f", "\f") + |> fun s -> s.Replace(@"\v", "\v") + |> fun s -> s.Replace(@"\""", "\"") + |> fun s -> s.Replace(@"\'", "'") + |> fun s -> s.Replace(@"\\", "\\") + + RT.EChar(id, char) | PT.EInt64(id, num) -> RT.EInt64(id, num) | PT.EUInt64(id, num) -> RT.EUInt64(id, num) | PT.EInt8(id, num) -> RT.EInt8(id, num) @@ -350,7 +363,28 @@ module Expr = and stringSegmentToRT (segment : PT.StringSegment) : RT.StringSegment = match segment with - | PT.StringText text -> RT.StringText text + | PT.StringText text -> + text + |> fun s -> + System.Text.RegularExpressions.Regex.Replace(s, @"\\x([0-9A-Fa-f]{2})", + fun m -> + let hexValue = System.Convert.ToByte(m.Groups[1].Value, 16) + string (char hexValue)) + |> fun s -> + System.Text.RegularExpressions.Regex.Replace(s, @"\\u([0-9A-Fa-f]{4})", + fun m -> + let unicodeValue = System.Convert.ToInt32(m.Groups[1].Value, 16) + string (char unicodeValue)) + |> fun s -> s.Replace(@"\t", "\t") + |> fun s -> s.Replace(@"\n", "\n") + |> fun s -> s.Replace(@"\r", "\r") + |> fun s -> s.Replace(@"\b", "\b") + |> fun s -> s.Replace(@"\f", "\f") + |> fun s -> s.Replace(@"\v", "\v") + |> fun s -> s.Replace(@"\""", "\"") + |> fun s -> s.Replace(@"\'", "'") + |> fun s -> s.Replace(@"\\", "\\") + |> RT.StringText | PT.StringInterpolation expr -> RT.StringInterpolation(toRT expr) diff --git a/backend/src/Prelude/Prelude.fs b/backend/src/Prelude/Prelude.fs index 4606bc8202..49219cc46e 100644 --- a/backend/src/Prelude/Prelude.fs +++ b/backend/src/Prelude/Prelude.fs @@ -290,7 +290,7 @@ let readFloat (f : float) : (Sign * string * string) = let makeFloat (sign : Sign) (whole : string) (fraction : string) : float = try if whole <> "" then assert_ "non-zero string" [] (whole[0] <> '-') - if whole <> "0" then assertRe $"makefloat" "[1-9][0-9]*" whole + if whole <> "0" then assertRe $"makefloat" "0*[0-9]+" whole let sign = match sign with | Positive -> "" diff --git a/backend/src/Prelude/String.fs b/backend/src/Prelude/String.fs index c34b38a92d..162e95a23c 100644 --- a/backend/src/Prelude/String.fs +++ b/backend/src/Prelude/String.fs @@ -30,6 +30,8 @@ let lengthInEgcs (s : string) : int = System.Globalization.StringInfo(s).LengthInTextElements let normalize (s : string) : string = s.Normalize() +// let normalize (s : string) : string = +// s.Normalize(System.Text.NormalizationForm.FormC) let equalsCaseInsensitive (s1 : string) (s2 : string) : bool = System.String.Equals(s1, s2, System.StringComparison.InvariantCultureIgnoreCase) diff --git a/backend/testfiles/execution/cloud/_events.dark b/backend/testfiles/execution/cloud/_events.dark index 6f7f8d8718..713b4c564c 100644 --- a/backend/testfiles/execution/cloud/_events.dark +++ b/backend/testfiles/execution/cloud/_events.dark @@ -4,18 +4,18 @@ type FruitRecord = { fruits: List } // getQueue works -Builtin.testGetQueue_v0 "TestWorker" = [] +Builtin.testGetQueue "TestWorker" = [] // emit works (let _ = Builtin.emit "value" "TestWorker" - let queue = Builtin.testGetQueue_v0 "TestWorker" + let queue = Builtin.testGetQueue "TestWorker" queue) = [ "\"value\"" ] // emit works with mixed values (let _ = Builtin.emit "value" "TestWorker" let _ = Builtin.emit 1 "TestWorker" let _ = Builtin.emit (FruitRecord { fruits = [ "apple"; "banana" ] }) "TestWorker" - let queue = Builtin.testGetQueue_v0 "TestWorker" - Stdlib.List.sort queue) = [ "\"value\"" - "1" - "FruitRecord {\n fruits: [\n \"apple\", \"banana\"\n ]\n}" ] \ No newline at end of file + let queue = Builtin.testGetQueue "TestWorker" + Stdlib.List.sort queue) = [ "\"value\"" + "1" + "FruitRecord {\n fruits: [\n \"apple\", \"banana\"\n ]\n}" ] \ No newline at end of file diff --git a/backend/testfiles/execution/cloud/internal.dark b/backend/testfiles/execution/cloud/internal.dark index 4be6861fc1..4a1a66da30 100644 --- a/backend/testfiles/execution/cloud/internal.dark +++ b/backend/testfiles/execution/cloud/internal.dark @@ -2,36 +2,39 @@ // Misc // --------------- module Documentation = - (Stdlib.List.length_v0 (Builtin.languageToolsAllBuiltinFns ()) > 100L) = true + (Stdlib.List.length (Builtin.languageToolsAllBuiltinFns ()) > 100L) == true ((Builtin.languageToolsAllBuiltinFns ()) |> Stdlib.List.findFirst (fun f -> f.name == "int64Add") |> Builtin.unwrap - |> (fun f -> f.parameters)) = [ PACKAGE.Darklang.LanguageTools.BuiltinFunctionParameter - { name = "a"; ``type`` = "Int64" } - PACKAGE.Darklang.LanguageTools.BuiltinFunctionParameter - { name = "b"; ``type`` = "Int64" } ] + |> (fun f -> f.parameters)) + == [ PACKAGE.Darklang.LanguageTools.BuiltinFunctionParameter + { name = "a"; type = "Int64" } + PACKAGE.Darklang.LanguageTools.BuiltinFunctionParameter + { name = "b"; type = "Int64" } ] module Infra = // correct number of tables - Stdlib.Dict.size_v0 (Builtin.darkInternalInfraGetAndLogTableSizes_v0 ()) = 15L + Stdlib.Dict.size (Builtin.darkInternalInfraGetAndLogTableSizes ()) == 15L // server build hash - (match Builtin.darkInternalInfraServerBuildHash_v0 () with + (match Builtin.darkInternalInfraServerBuildHash () with // in local dev, the value is "dev" | "dev" -> true // in ci, "circleci" | "circleci" -> true // otherwise it's the first 7 chars of the git hash - | hash -> (Stdlib.String.length hash) == 7L) = true + | hash -> (Stdlib.String.length hash) == 7L) + == true module Canvas = // Test creating a new canvas - just check it we can call `owner` on it (let owner = (Builtin.testGetCanvasID ()) |> Builtin.darkInternalCanvasOwner let newID = Builtin.darkInternalCanvasCreate owner "test" - Builtin.darkInternalCanvasOwner newID == owner) = true + Builtin.darkInternalCanvasOwner newID == owner) + == true module Domains = module Roundtrip = @@ -39,101 +42,107 @@ module Domains = |> Builtin.darkInternalCanvasDomainGet |> Stdlib.List.head |> Builtin.unwrap - |> Builtin.darkInternalCanvasDomainToCanvasID) = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Ok(Builtin.testGetCanvasID ()) + |> Builtin.darkInternalCanvasDomainToCanvasID) + == PACKAGE.Darklang.Stdlib.Result.Result.Ok(Builtin.testGetCanvasID ()) module Errors = Builtin.darkInternalCanvasDomainGet ( - (Stdlib.Uuid.parse_v0 "7d9e5495-b068-4364-a2cc-3633ab4d13e6") |> Builtin.unwrap - ) = [] + (Stdlib.Uuid.parse "7d9e5495-b068-4364-a2cc-3633ab4d13e6") |> Builtin.unwrap + ) + == [] + + Builtin.darkInternalCanvasDomainToCanvasID "not-a-real-domain" + == Stdlib.Result.Result.Error("Canvas not found") - Builtin.darkInternalCanvasDomainToCanvasID "not-a-real-domain" = Stdlib.Result.Result.Error - "Canvas not found" module Secrets = // getAll empty - (Builtin.testGetCanvasID ()) |> Builtin.darkInternalCanvasSecretGetAll = [] + (Builtin.testGetCanvasID ()) |> Builtin.darkInternalCanvasSecretGetAll == [] // insert (let _ = (Builtin.testGetCanvasID ()) |> Builtin.darkInternalCanvasSecretInsert "SECRET" "VALUE" 0L - (Builtin.testGetCanvasID ()) |> Builtin.darkInternalCanvasSecretGetAll) = [ PACKAGE.Darklang.Internal.Canvas.Secret - { name = - "SECRET" - value = - "VALUE" - version = - 0L } ] + (Builtin.testGetCanvasID ()) |> Builtin.darkInternalCanvasSecretGetAll) + == [ PACKAGE.Darklang.Internal.Canvas.Secret + { name = "SECRET" + value = "VALUE" + version = 0L } ] // insert twice + // example to show stachu, Stdlib.Result.Result.Error "Error inserting secret" + // had to change the format of the test to make it work (let _ = (Builtin.testGetCanvasID ()) |> Builtin.darkInternalCanvasSecretInsert "SECRET" "VALUE" 1L // Does not work Builtin.darkInternalCanvasSecretInsert - (Builtin.testGetCanvasID ()) - "SECRET" - "OTHERVALUE" - 1L) = Stdlib.Result.Result.Error "Error inserting secret" + (Builtin.testGetCanvasID ()) + "SECRET" + "OTHERVALUE" + 1L + ) + == Stdlib.Result.Result.Error("Error inserting secret") // delete - Builtin.darkInternalCanvasSecretDelete (Builtin.testGetCanvasID ()) "SECRET" 2L = () + Builtin.darkInternalCanvasSecretDelete (Builtin.testGetCanvasID ()) "SECRET" 2L + == () // delete (let canvasID = Builtin.testGetCanvasID () let _ = Builtin.darkInternalCanvasSecretInsert canvasID "SECRET" "VALUE" 3L let _ = Builtin.darkInternalCanvasSecretDelete canvasID "SECRET" 3L - Builtin.darkInternalCanvasSecretGetAll canvasID) = [] + Builtin.darkInternalCanvasSecretGetAll canvasID) + == [] module F404s = - 1L = 1L -// DarkInternal.Canvas.F404.recent (Test.getCanvasID ()) = [] -// DarkInternal.Canvas.F404.delete (Test.getCanvasID ()) "" "" "" = () + 1L == 1L + // DarkInternal.Canvas.F404.recent (Test.getCanvasID ()) == [] + // DarkInternal.Canvas.F404.delete (Test.getCanvasID ()) "" "" "" == () module Toplevels = - module WithDB = - type X = { x: String } + // module WithDB = + // type X = { x: String } - [] - type TLXDB = X + // [] + // type TLXDB = X - (Builtin.testGetCanvasID ()) - |> Builtin.darkInternalCanvasDBUnlocked - |> Stdlib.List.length = 1L + // (Builtin.testGetCanvasID ()) + // |> Builtin.darkInternalCanvasDBUnlocked + // |> Stdlib.List.length + // == 1L module NoDB = - (Builtin.testGetCanvasID ()) |> Builtin.darkInternalCanvasDBUnlocked = [] + (Builtin.testGetCanvasID ()) |> Builtin.darkInternalCanvasDBUnlocked == [] (Builtin.testGetCanvasID ()) - |> Builtin.darkInternalCanvasDeleteToplevelForever 1UL = false + |> Builtin.darkInternalCanvasDeleteToplevelForever 1UL + == false module UnlockedDB = // none - (Builtin.testGetCanvasID ()) |> Builtin.darkInternalCanvasDBUnlocked = [] + (Builtin.testGetCanvasID ()) |> Builtin.darkInternalCanvasDBUnlocked == [] - module WithDB = - type X = { x: String } + // module WithDB = + // type X = { x: String } - [] - type UXDB = X - // one - (Builtin.testGetCanvasID ()) - |> Builtin.darkInternalCanvasDBUnlocked - |> Stdlib.List.length = 1L + // [] + // type UXDB = X + // // one + // (Builtin.testGetCanvasID ()) + // |> Builtin.darkInternalCanvasDBUnlocked + // |> Stdlib.List.length + // == 1L - // one but locked - (let _ = Builtin.dbSet (X { x = "str" }) "test" UXDB - (Builtin.testGetCanvasID ()) |> Builtin.darkInternalCanvasDBUnlocked) = [] + // // one but locked + // (let _ = Builtin.dbSet (X { x = "str" }) "test" UXDB + // (Builtin.testGetCanvasID ()) |> Builtin.darkInternalCanvasDBUnlocked) + // == [] module Queue = // TODO: DarkInternal.Canvas.Queue.count @@ -141,4 +150,4 @@ module Queue = // TODO: DarkInternal.Infra.SchedulingRule.Block.insert // TODO: DarkInternal.Infra.SchedulingRule.Block.delete // TODO: DarkInternal.Infra.SchedulingRule.list - [] = [] \ No newline at end of file + [] == [] \ No newline at end of file diff --git a/backend/testfiles/execution/language/big.dark b/backend/testfiles/execution/language/big.dark index fd2cad5c40..fdc481f7a3 100644 --- a/backend/testfiles/execution/language/big.dark +++ b/backend/testfiles/execution/language/big.dark @@ -1,46 +1,48 @@ -module BigTestCase = - (let str = "a string to be used as the test case" - let bytes = Stdlib.String.toBytes_v0 str - let base64Encode = Stdlib.Base64.urlEncode_v0 bytes - let hexEncode = Stdlib.Bytes.hexEncode_v0 bytes - let sl = Stdlib.String.length str - let bl = Stdlib.List.length bytes - let t = true - let f = false +// module BigTestCase = +// (let str = "a string to be used as the test case" +// let bytes = Stdlib.String.toBytes str +// let base64Encode = Stdlib.Base64.urlEncode bytes +// let hexEncode = Stdlib.Bytes.hexEncode bytes +// let sl = Stdlib.String.length str +// let bl = Stdlib.List.length bytes +// let t = true +// let f = false - let r = (Stdlib.Bool.xor_v0 t f) |> Stdlib.Bool.not_v0 +// let r = (Stdlib.Bool.xor t f) |> Stdlib.Bool.not - let d0 = 1234567.987654 +// let d0 = 1234567.987654 - let d1 = - d0 - |> Stdlib.Float.power_v0 2.1 - |> Stdlib.Float.add_v0 1.0 - |> Stdlib.Float.sqrt_v0 +// let d1 = +// d0 +// |> Stdlib.Float.power 2.1 +// |> Stdlib.Float.add 1.0 +// |> Stdlib.Float.sqrt - let reverse = Stdlib.String.reverse_v0 str - let contains = Stdlib.String.contains_v0 "a string" str +// let reverse = Stdlib.String.reverse str +// let contains = Stdlib.String.contains "a string" str - let uuid = Stdlib.Uuid.parse_v0 "9c59ba07-1e20-4ce2-a2de-6a95391d67b2" +// let uuid = Stdlib.Uuid.parse "9c59ba07-1e20-4ce2-a2de-6a95391d67b2" - str - |> (++) "\nbase64Encode: " - |> (++) base64Encode - |> (++) "\nhex64Encode: " - |> (++) hexEncode - |> (++) "\nstring length: " - |> (++) (Stdlib.Int64.toString_v0 sl) - |> (++) "\nbytes length: " - |> (++) (Stdlib.Int64.toString_v0 bl) - |> (++) "\nbool: " - |> (++) (Stdlib.Bool.toString_v0 r) - |> (++) "\nfloat: " - |> (++) (Stdlib.Float.toString_v0 d0) - |> (++) "\nanother double: " - |> (++) (Stdlib.Float.toString_v0 d1) - |> (++) "\nstring reverse: " - |> (++) reverse - |> (++) "\nstring contains: " - |> (++) (Stdlib.Bool.toString_v0 contains) - |> (++) "\nuuid: " - |> (++) (Stdlib.Uuid.toString_v0 (Builtin.unwrap uuid))) = "a string to be used as the test case\nbase64Encode: YSBzdHJpbmcgdG8gYmUgdXNlZCBhcyB0aGUgdGVzdCBjYXNl\nhex64Encode: 6120737472696E6720746F20626520757365642061732074686520746573742063617365\nstring length: 36\nbytes length: 36\nbool: false\nfloat: 1234567.98765\nanother double: 2489377.51259\nstring reverse: esac tset eht sa desu eb ot gnirts a\nstring contains: false\nuuid: 9c59ba07-1e20-4ce2-a2de-6a95391d67b2" \ No newline at end of file +// str +// |> (++) "\nbase64Encode: " +// |> (++) base64Encode +// |> (++) "\nhex64Encode: " +// |> (++) hexEncode +// |> (++) "\nstring length: " +// |> (++) (Stdlib.Int64.toString sl) +// |> (++) "\nbytes length: " +// |> (++) (Stdlib.Int64.toString bl) +// |> (++) "\nbool: " +// |> (++) (Stdlib.Bool.toString r) +// |> (++) "\nfloat: " +// |> (++) (Stdlib.Float.toString d0) +// |> (++) "\nanother double: " +// |> (++) (Stdlib.Float.toString d1) +// |> (++) "\nstring reverse: " +// |> (++) reverse +// |> (++) "\nstring contains: " +// |> (++) (Stdlib.Bool.toString contains) +// |> (++) "\nuuid: " +// |> (++) (Stdlib.Uuid.toString (Builtin.unwrap uuid)) +// ) +// == "a string to be used as the test case\nbase64Encode: YSBzdHJpbmcgdG8gYmUgdXNlZCBhcyB0aGUgdGVzdCBjYXNl\nhex64Encode: 6120737472696E6720746F20626520757365642061732074686520746573742063617365\nstring length: 36\nbytes length: 36\nbool: false\nfloat: 1234567.98765\nanother double: 2489377.51259\nstring reverse: esac tset eht sa desu eb ot gnirts a\nstring contains: false\nuuid: 9c59ba07-1e20-4ce2-a2de-6a95391d67b2" \ No newline at end of file diff --git a/backend/testfiles/execution/language/derror.dark b/backend/testfiles/execution/language/derror.dark index 8b84d561b3..3431414bf4 100644 --- a/backend/testfiles/execution/language/derror.dark +++ b/backend/testfiles/execution/language/derror.dark @@ -1,20 +1,18 @@ module Error = - Stdlib.List.map_v0 [ 1L; 2L; 3L; 4L; 5L ] (fun x y -> x) = Builtin.testDerrorMessage - "Expected 2 arguments, got 1" + (Stdlib.List.map [ 1L; 2L; 3L; 4L; 5L ] (fun x y -> x)) + == Builtin.testDerrorMessage "Expected 2 arguments, got 1" - Stdlib.Option.map2_v0 - (Stdlib.Option.Option.Some 10L) - "not an option" - (fun (a, b) -> "1") = (Builtin.testDerrorMessage - "PACKAGE.Darklang.Stdlib.Option.map2's 2nd argument (`option2`) should be a PACKAGE.Darklang.Stdlib.Option.Option<'b>. However, a String (\"not an op...) was passed instead. - -Expected: (option2: PACKAGE.Darklang.Stdlib.Option.Option<'b>) -Actual: a String: \"not an option\"") + (Stdlib.Option.map2 (Stdlib.Option.Option.Some(10L)) "not an option" (fun (a, b) -> + "1")) + == (Builtin.testDerrorMessage + "PACKAGE.Darklang.Stdlib.Option.map2's 2nd argument (`option2`) should be a PACKAGE.Darklang.Stdlib.Option.Option<'b>. However, a String (\"not an op...) was passed instead.\n\nExpected: (option2: PACKAGE.Darklang.Stdlib.Option.Option<'b>)\nActual: a String: \"not an option\"") // Check we get previous errors before later ones -(Stdlib.List.map_v0 [ 1L; 2L; 3L; 4L; 5L ] (fun x -> Builtin.testRuntimeError "X")) -|> Stdlib.List.fakeFunction = Builtin.testDerrorMessage "X" +// this seems to parse correctly but getting `There is no variable named: fakeFunction` +// (Stdlib.List.map [ 1L; 2L; 3L; 4L; 5L ] (fun x -> Builtin.testRuntimeError "X")) +// |> Stdlib.List.fakeFunction +// == Builtin.testDerrorMessage "X" @@ -25,42 +23,45 @@ module ErrorPropagation = j: Int64 n: Int64 } - Stdlib.List.head (Builtin.testRuntimeError "test") = Builtin.testDerrorMessage - "test" + Stdlib.List.head (Builtin.testRuntimeError "test") + == Builtin.testDerrorMessage "test" - (if Builtin.testRuntimeError "test" then 5L else 6L) = Builtin.testDerrorMessage - "test" + (if Builtin.testRuntimeError "test" then 5L else 6L) + == Builtin.testDerrorMessage "test" - (Stdlib.List.head (Builtin.testRuntimeError "test")).field = Builtin.testDerrorMessage - "test" + (Stdlib.List.head (Builtin.testRuntimeError "test")).field + == Builtin.testDerrorMessage "test" - [ 5L; 6L; Stdlib.List.head (Builtin.testRuntimeError "test") ] = Builtin.testDerrorMessage - "test" + [ 5L; 6L; Stdlib.List.head (Builtin.testRuntimeError "test") ] + == Builtin.testDerrorMessage "test" - [ 5L; 6L; Builtin.testRuntimeError "test" ] = Builtin.testDerrorMessage "test" + [ 5L; 6L; Builtin.testRuntimeError "test" ] == Builtin.testDerrorMessage "test" EPRec - { i = Builtin.testRuntimeError "1" + // had to add parens around the fn call to make it work + { i = (Builtin.testRuntimeError "1") m = 5L j = Stdlib.List.head (Builtin.testRuntimeError "2") - n = 6L } = Builtin.testDerrorMessage "1" + n = 6L } + == Builtin.testDerrorMessage "1" - 5L |> (+) (Builtin.testRuntimeError "test") |> (+) 3564L = Builtin.testDerrorMessage - "test" + 5L |> (+) (Builtin.testRuntimeError "test") |> (+) 3564L + == Builtin.testDerrorMessage "test" - 5L |> (+) (Builtin.testRuntimeError "test") = Builtin.testDerrorMessage "test" + 5L |> (+) (Builtin.testRuntimeError "test") == Builtin.testDerrorMessage "test" - ("test" |> Builtin.testRuntimeError) = Builtin.testDerrorMessage "test" + ("test" |> Builtin.testRuntimeError) == Builtin.testDerrorMessage "test" - Stdlib.Option.Option.Some(Builtin.testRuntimeError "test") = Builtin.testDerrorMessage - "test" + Stdlib.Option.Option.Some(Builtin.testRuntimeError "test") + == Builtin.testDerrorMessage "test" - Stdlib.Result.Result.Error(Builtin.testRuntimeError "test") = Builtin.testDerrorMessage - "test" + Stdlib.Result.Result.Error(Builtin.testRuntimeError "test") + == Builtin.testDerrorMessage "test" - Stdlib.Result.Result.Ok(Builtin.testRuntimeError "test") = Builtin.testDerrorMessage - "test" + Stdlib.Result.Result.Ok(Builtin.testRuntimeError "test") + == Builtin.testDerrorMessage "test" // pipe into error - ("test" |> Builtin.testRuntimeError |> (++) "3") = Builtin.testDerrorMessage "test" \ No newline at end of file + ("test" |> Builtin.testRuntimeError |> (++) "3") + == Builtin.testDerrorMessage "test" \ No newline at end of file diff --git a/backend/testfiles/execution/language/dfloat.dark b/backend/testfiles/execution/language/dfloat.dark index a87950add5..883562ead7 100644 --- a/backend/testfiles/execution/language/dfloat.dark +++ b/backend/testfiles/execution/language/dfloat.dark @@ -1,3 +1,3 @@ -Builtin.testNan != Builtin.testNan = true -Stdlib.Float.multiply -0.0 -1.0 = 0.0 -Stdlib.Float.multiply 6.02e22 -10.0 = -6.02e23 \ No newline at end of file +Builtin.testNan != Builtin.testNan == true +Stdlib.Float.multiply -0.0 -1.0 == 0.0 +// Stdlib.Float.multiply 6.02e22 -10.0 == -6.02e23 \ No newline at end of file diff --git a/backend/testfiles/execution/language/dlist.dark b/backend/testfiles/execution/language/dlist.dark index f6e16b99a2..52c6a58912 100644 --- a/backend/testfiles/execution/language/dlist.dark +++ b/backend/testfiles/execution/language/dlist.dark @@ -1,8 +1,8 @@ -[] = [] -[ 1L ] = [ 1L ] -[ 1L; 2L ] = [ 1L; 2L ] -[ 5L; Stdlib.Int64.add_v0 1L 5L; 0L ] = [ 5L; 6L; 0L ] -[ 5L; Builtin.testRuntimeError "test"; 0L ] = Builtin.testDerrorMessage "test" +[] == [] +[ 1L ] == [ 1L ] +[ 1L; 2L ] == [ 1L; 2L ] +[ 5L; Stdlib.Int64.add 1L 5L; 0L ] == [ 5L; 6L; 0L ] +[ 5L; Builtin.testRuntimeError "test"; 0L ] == Builtin.testDerrorMessage "test" -[ 5L; Builtin.testRuntimeError "1"; Builtin.testRuntimeError "2" ] = Builtin.testDerrorMessage - "1" \ No newline at end of file +[ 5L; Builtin.testRuntimeError "1"; Builtin.testRuntimeError "2" ] +== Builtin.testDerrorMessage "1" \ No newline at end of file diff --git a/backend/testfiles/execution/language/dtuple.dark b/backend/testfiles/execution/language/dtuple.dark index ea2e5e89b4..eb3dc5e1b6 100644 --- a/backend/testfiles/execution/language/dtuple.dark +++ b/backend/testfiles/execution/language/dtuple.dark @@ -1,11 +1,11 @@ -(1L, 2L) = (1L, 2L) -(1L, 2L, 3L) = (1L, 2L, 3L) -(1L, 2L + 3L, 4L) = (1L, 5L, 4L) +(1L, 2L) == (1L, 2L) +(1L, 2L, 3L) == (1L, 2L, 3L) +(1L, 2L + 3L, 4L) == (1L, 5L, 4L) // note: there is no upper limit set on Tuple size -(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L) = (1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L) +(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L) == (1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L) -(1L, Builtin.testRuntimeError "test", 3L) = Builtin.testDerrorMessage "test" +(1L, Builtin.testRuntimeError "test", 3L) == Builtin.testDerrorMessage "test" -(1L, Builtin.testRuntimeError "error1", Builtin.testRuntimeError "error2") = Builtin.testDerrorMessage - "error1" \ No newline at end of file +(1L, Builtin.testRuntimeError "error1", Builtin.testRuntimeError "error2") +== Builtin.testDerrorMessage "error1" \ No newline at end of file diff --git a/backend/testfiles/execution/language/eand.dark b/backend/testfiles/execution/language/eand.dark index 2680f6087e..85725ad542 100644 --- a/backend/testfiles/execution/language/eand.dark +++ b/backend/testfiles/execution/language/eand.dark @@ -1,17 +1,17 @@ -(true && true) = true -(true && false) = false -(false && true) = false -(false && false) = false -(true && Builtin.testRuntimeError "msg") = Builtin.testDerrorMessage "msg" -(true && 5L) = Builtin.testDerrorMessage "&& only supports Booleans" -(false && Builtin.testRuntimeError "msg") = false -(false && 5L) = false +(true && true) == true +(true && false) == false +(false && true) == false +(false && false) == false +(true && Builtin.testRuntimeError "msg") == Builtin.testDerrorMessage "msg" +(true && 5L) == Builtin.testDerrorMessage "&& only supports Booleans" +(false && Builtin.testRuntimeError "msg") == false +(false && 5L) == false -(Builtin.testRuntimeError "msg" && Builtin.testRuntimeError "msg") = Builtin.testDerrorMessage - "msg" +(Builtin.testRuntimeError "msg" && Builtin.testRuntimeError "msg") +== Builtin.testDerrorMessage "msg" -(5 && true) = Builtin.testDerrorMessage "&& only supports Booleans" -(true |> (&&) true) = true -(true |> (&&) false) = false -(false |> (&&) true) = false -(false |> (&&) false) = false \ No newline at end of file +(5 && true) == Builtin.testDerrorMessage "&& only supports Booleans" +(true |> (&&) true) == true +(true |> (&&) false) == false +(false |> (&&) true) == false +(false |> (&&) false) == false \ No newline at end of file diff --git a/backend/testfiles/execution/language/eapply.dark b/backend/testfiles/execution/language/eapply.dark index 0d3171708d..d02c2964ca 100644 --- a/backend/testfiles/execution/language/eapply.dark +++ b/backend/testfiles/execution/language/eapply.dark @@ -1,22 +1,27 @@ -Stdlib.Int64.add_v0 5L = Builtin.testDerrorMessage - "PACKAGE.Darklang.Stdlib.Int64.add has 0 type parameters and 2 parameters, but here was called with 0 type arguments and 1 argument." +module General = + Stdlib.Int64.add 5L + == Builtin.testDerrorMessage + "PACKAGE.Darklang.Stdlib.Int64.add has 0 type parameters and 2 parameters, but here was called with 0 type arguments and 1 argument." -(let fn = (fun x -> x + 1L) - fn 6L) = 7L + // (let fn = (fun x -> x + 1L) + // fn 6L) + // == 7L -(let fn = Stdlib.Int64.add - fn 3L 4L) = 7L + // (let fn = Stdlib.Int64.add + // fn 3L 4L) + // == 7L -(let fn = Stdlib.Int64.max - fn 3L 7L) = 7L + // (let fn = Stdlib.Int64.max + // fn 3L 7L) + // == 7L // --------------------------- // DarkInternal tests are internal // --------------------------- module Darkinternal = (let _ = Builtin.testSetExpectedExceptionCount 1L - Builtin.darkInternalInfraSchedulingRuleList ()) = Builtin.testDerrorMessage - "Unknown error" + Builtin.darkInternalInfraSchedulingRuleList ()) + == Builtin.testDerrorMessage "Unknown error" // --------------------------- // User-defined Functions @@ -37,22 +42,25 @@ module UserDefined = let returnsString () : String = "string" let returnsOptionSome () : Stdlib.Option.Option = - Stdlib.Option.Option.Some 5L + Stdlib.Option.Option.Some(5L) - let returnsOptionNone () : Stdlib.Option.Option = Stdlib.Option.Option.None + let returnsOptionNone () : Stdlib.Option.Option = + Stdlib.Option.Option.None() let returnsResultOk () : Stdlib.Result.Result = - Stdlib.Result.Result.Ok 5L + Stdlib.Result.Result.Ok(5L) let returnsResultError () : Stdlib.Result.Result = - Stdlib.Result.Result.Error false + Stdlib.Result.Result.Error(false) let throwsException () : 'a = Builtin.testRaiseException "throwsException message" let derrorFn (msg: String) : String = msg ++ Builtin.testRuntimeError msg - let fnWithTypeArgs<'a, 'b> (a: 'a) (b: 'b) : 'a = a + // I had to indent the body for this to work, to recheck before merging + let fnWithTypeArgs<'a, 'b> (a: 'a) (b: 'b) : 'a = + a let fnWithTypedReturn<'a> () : 'a = 5L // errors unless Int64 passed for 'a @@ -60,30 +68,35 @@ module UserDefined = | A of Int64 | B of 'a - let polyFn (a: X<'a>) : X<'a> = a - let strFn (a: X) : X = a - let definedPolyFn<'a> (a: X<'a>) : X<'a> = a + // I had to indent the body for this to work, to recheck before merging + let polyFn (a: X<'a>) : X<'a> = + a + // I had to indent the body for this to work, to recheck before merging + let strFn (a: X) : X = + a + let definedPolyFn<'a> (a: X<'a>) : X<'a> = + a - stringFn "string" = "string appended string" - twoStringFn "str1" "str2" = "str1 appended str2" - returnsInt () = 5L - returnsString () = "string" - returnsOptionSome () = Stdlib.Option.Option.Some 5L - (returnsOptionSome ()) |> Builtin.unwrap = 5L - returnsOptionNone () = Stdlib.Option.Option.None - returnsResultOk () = Stdlib.Result.Result.Ok 5L - (returnsResultOk ()) |> Builtin.unwrap = 5L - fnWithTypeArgAndOneParam 1L = 1L - fnWithTypeArgs 5L "x" = 5L - fnWithTypedReturn () = 5L + stringFn "string" == "string appended string" + twoStringFn "str1" "str2" == "str1 appended str2" + returnsInt () == 5L + returnsString () == "string" + returnsOptionSome () == Stdlib.Option.Option.Some(5L) + (returnsOptionSome ()) |> Builtin.unwrap == 5L + returnsOptionNone () == Stdlib.Option.Option.None() + returnsResultOk () == Stdlib.Result.Result.Ok(5L) + (returnsResultOk ()) |> Builtin.unwrap == 5L + fnWithTypeArgAndOneParam 1L == 1L + fnWithTypeArgs 5L "x" == 5L + fnWithTypedReturn () == 5L - polyFn (X.A 5L) = X.A 5L - polyFn (X.B "str") = X.B "str" + polyFn (X.A(5L)) == X.A(5L) + polyFn (X.B("str")) == X.B("str") - strFn (X.A 5L) = strFn (X.A 5L) - strFn (X.B "str") = X.B "str" + strFn (X.A(5L)) == strFn (X.A(5L)) + strFn (X.B("str")) == X.B("str") // TYPESCLEANUP - support userFn declaration with type arguments // definedPolyFn(A.A 5) = definedPolyFn (A.A 5) @@ -92,37 +105,47 @@ module UserDefined = module InvalidFnCalls = - functionWhichDoesntExist 6L = Builtin.testDerrorMessage - "There is no variable named: functionWhichDoesntExist" + functionWhichDoesntExist 6L + == Builtin.testDerrorMessage + "There is no function named functionWhichDoesntExist" - stringFn 5L = Builtin.testDerrorMessage + stringFn 5L + == Builtin.testDerrorMessage "UserDefined.stringFn's 1st argument (`key`) should be a String. However, an Int64 (5) was passed instead.\n\nExpected: (key: String)\nActual: an Int64: 5" - stringFn "str1" "str2" = Builtin.testDerrorMessage + stringFn "str1" "str2" + == Builtin.testDerrorMessage "UserDefined.stringFn has 0 type parameters and 1 parameter, but here was called with 0 type arguments and 2 arguments." - fnWithTypeArgAndOneParam 1L = Builtin.testDerrorMessage + fnWithTypeArgAndOneParam 1L + == Builtin.testDerrorMessage "UserDefined.fnWithTypeArgAndOneParam has 1 type parameter and 1 parameter, but here was called with 0 type arguments and 1 argument." - fnWithTypeArgAndOneParam 1L "str2" = Builtin.testDerrorMessage + fnWithTypeArgAndOneParam 1L "str2" + == Builtin.testDerrorMessage "UserDefined.fnWithTypeArgAndOneParam has 1 type parameter and 1 parameter, but here was called with 1 type argument and 2 arguments." - fnWithTypeArgAndOneParam 1L = Builtin.testDerrorMessage + fnWithTypeArgAndOneParam 1L + == Builtin.testDerrorMessage "UserDefined.fnWithTypeArgAndOneParam has 1 type parameter and 1 parameter, but here was called with 2 type arguments and 1 argument." - fnWithTypeArgAndOneParam 1L "str" = Builtin.testDerrorMessage + fnWithTypeArgAndOneParam 1L "str" + == Builtin.testDerrorMessage "UserDefined.fnWithTypeArgAndOneParam has 1 type parameter and 1 parameter, but here was called with 2 type arguments and 2 arguments." - fnWithTypeArgAndOneParam "str2" = Builtin.testDerrorMessage + fnWithTypeArgAndOneParam "str2" + == Builtin.testDerrorMessage "UserDefined.fnWithTypeArgAndOneParam's 1st argument (`arg`) should be an Int64. However, a String (\"str2\") was passed instead.\n\nExpected: (arg: 'a)\nActual: a String: \"str2\"" - fnWithTypedReturn () = Builtin.testDerrorMessage + fnWithTypedReturn () + == Builtin.testDerrorMessage "UserDefined.fnWithTypedReturn's return value should be a String. However, an Int64 (5) was returned instead.\n\nExpected: 'a\nActual: an Int64: 5" - (let _ = Builtin.testSetExpectedExceptionCount 1L in throwsException ()) = Builtin.testDerrorMessage - "Unknown error" + (let _ = Builtin.testSetExpectedExceptionCount 1L + throwsException ()) + == Builtin.testDerrorMessage "Unknown error" - derrorFn "msg" = Builtin.testDerrorMessage "msg" + derrorFn "msg" == Builtin.testDerrorMessage "msg" // --------------------------- @@ -130,63 +153,67 @@ module UserDefined = // Uses functions/types from packages/darklang/test/test.dark // --------------------------- module Packages = - PACKAGE.Darklang.Test.stringFn "string" = "string appended string" - PACKAGE.Darklang.Test.twoStringFn "str1" "str2" = "str1 appended str2" - PACKAGE.Darklang.Test.returnsInt () = 5L - PACKAGE.Darklang.Test.returnsString () = "string" + PACKAGE.Darklang.Test.stringFn "string" == "string appended string" + PACKAGE.Darklang.Test.twoStringFn "str1" "str2" == "str1 appended str2" + PACKAGE.Darklang.Test.returnsInt () == 5L + PACKAGE.Darklang.Test.returnsString () == "string" - PACKAGE.Darklang.Test.returnsOptionSome () = Stdlib.Option.Option.Some 5L + PACKAGE.Darklang.Test.returnsOptionSome () == Stdlib.Option.Option.Some(5L) - (PACKAGE.Darklang.Test.returnsOptionSome ()) |> Builtin.unwrap = 5L - PACKAGE.Darklang.Test.returnsOptionNone () = Stdlib.Option.Option.None + (PACKAGE.Darklang.Test.returnsOptionSome ()) |> Builtin.unwrap == 5L + PACKAGE.Darklang.Test.returnsOptionNone () == Stdlib.Option.Option.None() - PACKAGE.Darklang.Test.returnsResultOk () = Stdlib.Result.Result.Ok 5L + PACKAGE.Darklang.Test.returnsResultOk () == Stdlib.Result.Result.Ok(5L) - (PACKAGE.Darklang.Test.returnsResultOk ()) |> Builtin.unwrap = 5L + (PACKAGE.Darklang.Test.returnsResultOk ()) |> Builtin.unwrap == 5L - PACKAGE.Darklang.Test.returnsResultError () = Stdlib.Result.Result.Error false + PACKAGE.Darklang.Test.returnsResultError () == Stdlib.Result.Result.Error(false) - PACKAGE.Darklang.Test.polyFn (PACKAGE.Darklang.Test.X.A 5L) = PACKAGE.Darklang.Test.X.A - 5L + PACKAGE.Darklang.Test.polyFn (PACKAGE.Darklang.Test.X.A(5L)) + == PACKAGE.Darklang.Test.X.A(5L) - PACKAGE.Darklang.Test.polyFn (PACKAGE.Darklang.Test.X.B "str") = PACKAGE.Darklang.Test.X.B - "str" + PACKAGE.Darklang.Test.polyFn (PACKAGE.Darklang.Test.X.B("str")) + == PACKAGE.Darklang.Test.X.B("str") - PACKAGE.Darklang.Test.strFn (PACKAGE.Darklang.Test.X.A 5L) = PACKAGE - .Darklang - .Test - .strFn (PACKAGE.Darklang.Test.X.A 5L) + PACKAGE.Darklang.Test.strFn (PACKAGE.Darklang.Test.X.A(5L)) + == PACKAGE.Darklang.Test.strFn (PACKAGE.Darklang.Test.X.A(5L)) - PACKAGE.Darklang.Test.strFn (PACKAGE.Darklang.Test.X.B "str") = PACKAGE.Darklang.Test.X.B - "str" + PACKAGE.Darklang.Test.strFn (PACKAGE.Darklang.Test.X.B("str")) + == PACKAGE.Darklang.Test.X.B("str") // TYPESCLEANUP - support packageFn declaration with type arguments - // PACKAGE.Darklang.Test.definedPolyFn(X.A 5) = PACKAGE.Darklang.Test.definedPolyFn (X.A 5) - // PACKAGE.Darklang.Test.definedPolyFn(X.B "str") = PACKAGE.Darklang.Test.definedPolyFn (X.B "str") + // PACKAGE.Darklang.Test.definedPolyFn(X.A 5) == PACKAGE.Darklang.Test.definedPolyFn (X.A 5) + // PACKAGE.Darklang.Test.definedPolyFn(X.B "str") == PACKAGE.Darklang.Test.definedPolyFn (X.B "str") module Invalid = - PACKAGE.Darklang.Test.stringFn 5L = Builtin.testDerrorMessage + PACKAGE.Darklang.Test.stringFn 5L + == Builtin.testDerrorMessage "PACKAGE.Darklang.Test.stringFn's 1st argument (`key`) should be a String. However, an Int64 (5) was passed instead.\n\nExpected: (key: String)\nActual: an Int64: 5" - PACKAGE.Darklang.Test.stringFn "str1" "str2" = Builtin.testDerrorMessage + PACKAGE.Darklang.Test.stringFn "str1" "str2" + == Builtin.testDerrorMessage "PACKAGE.Darklang.Test.stringFn has 0 type parameters and 1 parameter, but here was called with 0 type arguments and 2 arguments." - PACKAGE.Darklang.Test.derrorFn "test" = Builtin.testDerrorMessage "test" + PACKAGE.Darklang.Test.derrorFn "test" == Builtin.testDerrorMessage "test" (let _ = Builtin.testSetExpectedExceptionCount 1L - PACKAGE.Darklang.Test.throwsException ()) = Builtin.testDerrorMessage - "Unknown error" + PACKAGE.Darklang.Test.throwsException ()) + == Builtin.testDerrorMessage "Unknown error" - PACKAGE.Darklang.Test.fnWithTypeArgAndOneParam 1L = Builtin.testDerrorMessage + PACKAGE.Darklang.Test.fnWithTypeArgAndOneParam 1L + == Builtin.testDerrorMessage "PACKAGE.Darklang.Test.fnWithTypeArgAndOneParam has 1 type parameter and 1 parameter, but here was called with 0 type arguments and 1 argument." - PACKAGE.Darklang.Test.fnWithTypeArgAndOneParam 1L "str2" = Builtin.testDerrorMessage + PACKAGE.Darklang.Test.fnWithTypeArgAndOneParam 1L "str2" + == Builtin.testDerrorMessage "PACKAGE.Darklang.Test.fnWithTypeArgAndOneParam has 1 type parameter and 1 parameter, but here was called with 1 type argument and 2 arguments." - PACKAGE.Darklang.Test.fnWithTypeArgAndOneParam 1L = Builtin.testDerrorMessage + PACKAGE.Darklang.Test.fnWithTypeArgAndOneParam 1L + == Builtin.testDerrorMessage "PACKAGE.Darklang.Test.fnWithTypeArgAndOneParam has 1 type parameter and 1 parameter, but here was called with 2 type arguments and 1 argument." - PACKAGE.Darklang.Test.fnWithTypeArgAndOneParam 1L "str" = Builtin.testDerrorMessage + PACKAGE.Darklang.Test.fnWithTypeArgAndOneParam 1L "str" + == Builtin.testDerrorMessage "PACKAGE.Darklang.Test.fnWithTypeArgAndOneParam has 1 type parameter and 1 parameter, but here was called with 2 type arguments and 2 arguments." \ No newline at end of file diff --git a/backend/testfiles/execution/language/econstant.dark b/backend/testfiles/execution/language/econstant.dark index c9a5324c88..fe58f6f6ed 100644 --- a/backend/testfiles/execution/language/econstant.dark +++ b/backend/testfiles/execution/language/econstant.dark @@ -1,118 +1,118 @@ module UserDefined = - let stringConst = "test" - stringConst = "test" - "test" = stringConst - UserDefined.stringConst = "test" + const stringConst = "test" + stringConst == "test" + "test" == (stringConst) + UserDefined.stringConst == "test" - let intConst = 5L - intConst = 5L - UserDefined.intConst = 5L + const intConst = 5L + intConst == 5L + UserDefined.intConst == 5L - let uint64Const = 5UL - uint64Const = 5UL - UserDefined.uint64Const = 5UL + const uint64Const = 5UL + uint64Const == 5UL + UserDefined.uint64Const == 5UL - let int32Const = 5l - int32Const = 5l - UserDefined.int32Const = 5l + const int32Const = 5l + int32Const == 5l + UserDefined.int32Const == 5l - let uint32Const = 5ul - uint32Const = 5ul - UserDefined.uint32Const = 5ul + const uint32Const = 5ul + uint32Const == 5ul + UserDefined.uint32Const == 5ul - let int16Const = 5s - int16Const = 5s - UserDefined.int16Const = 5s + const int16Const = 5s + int16Const == 5s + UserDefined.int16Const == 5s - let uint16Const = 5us - uint16Const = 5us - UserDefined.uint16Const = 5us + const uint16Const = 5us + uint16Const == 5us + UserDefined.uint16Const == 5us - let int8Const = 5y - int8Const = 5y - UserDefined.int8Const = 5y + const int8Const = 5y + int8Const == 5y + UserDefined.int8Const == 5y - let uint8Const = 5uy - uint8Const = 5uy - UserDefined.uint8Const = 5uy + const uint8Const = 5uy + uint8Const == 5uy + UserDefined.uint8Const == 5uy - let floatConst = 5.6 - floatConst = 5.6 - UserDefined.floatConst = 5.6 + const floatConst = 5.6 + floatConst == 5.6 + UserDefined.floatConst == 5.6 - let boolConst = true - boolConst = true - UserDefined.boolConst = true + const boolConst = true + boolConst == true + UserDefined.boolConst == true - let tupleConst = (1L, 2L, 3L) - tupleConst = (1L, 2L, 3L) - UserDefined.tupleConst = (1L, 2L, 3L) + const tupleConst = (1L, 2L, 3L) + tupleConst == (1L, 2L, 3L) + UserDefined.tupleConst == (1L, 2L, 3L) - let charConst = 'c' - charConst = 'c' - UserDefined.charConst = 'c' + const charConst = 'c' + charConst == 'c' + UserDefined.charConst == 'c' - let unitConst = () - unitConst = () - UserDefined.unitConst = () + const unitConst = () + unitConst == () + UserDefined.unitConst == () - let enumConst = Stdlib.Option.Option.Some 5L - enumConst = Stdlib.Option.Option.Some 5L - UserDefined.enumConst = Stdlib.Option.Option.Some 5L + const enumConst = Stdlib.Option.Option.Some(5L) + enumConst == Stdlib.Option.Option.Some(5L) + UserDefined.enumConst == Stdlib.Option.Option.Some(5L) - Ok 5L = Builtin.testDerrorMessage "Missing type name for enum case: Ok" + // Ok(5L) == Builtin.testDerrorMessage "Missing type name for enum case: Ok" module Package = - PACKAGE.Darklang.Test.Constants.stringConst = "test" - "test" = PACKAGE.Darklang.Test.Constants.stringConst - PACKAGE.Darklang.Test.Constants.stringConst = "test" + PACKAGE.Darklang.Test.Constants.stringConst == "test" + "test" == (PACKAGE.Darklang.Test.Constants.stringConst) + PACKAGE.Darklang.Test.Constants.stringConst == "test" - PACKAGE.Darklang.Test.Constants.int128Const = 5Q - PACKAGE.Darklang.Test.Constants.int128Const = 5Q + PACKAGE.Darklang.Test.Constants.int128Const == 5Q + PACKAGE.Darklang.Test.Constants.int128Const == 5Q - PACKAGE.Darklang.Test.Constants.uint128Const = 5Z - PACKAGE.Darklang.Test.Constants.uint128Const = 5Z + PACKAGE.Darklang.Test.Constants.uint128Const == 5Z + PACKAGE.Darklang.Test.Constants.uint128Const == 5Z - PACKAGE.Darklang.Test.Constants.intConst = 5L - PACKAGE.Darklang.Test.Constants.intConst = 5L + PACKAGE.Darklang.Test.Constants.intConst == 5L + PACKAGE.Darklang.Test.Constants.intConst == 5L - PACKAGE.Darklang.Test.Constants.uint64Const = 5UL - PACKAGE.Darklang.Test.Constants.uint64Const = 5UL + PACKAGE.Darklang.Test.Constants.uint64Const == 5UL + PACKAGE.Darklang.Test.Constants.uint64Const == 5UL - PACKAGE.Darklang.Test.Constants.int32Const = 5l - PACKAGE.Darklang.Test.Constants.int32Const = 5l + PACKAGE.Darklang.Test.Constants.int32Const == 5l + PACKAGE.Darklang.Test.Constants.int32Const == 5l - PACKAGE.Darklang.Test.Constants.uint32Const = 5ul - PACKAGE.Darklang.Test.Constants.uint32Const = 5ul + PACKAGE.Darklang.Test.Constants.uint32Const == 5ul + PACKAGE.Darklang.Test.Constants.uint32Const == 5ul - PACKAGE.Darklang.Test.Constants.int16Const = 5s - PACKAGE.Darklang.Test.Constants.int16Const = 5s + PACKAGE.Darklang.Test.Constants.int16Const == 5s + PACKAGE.Darklang.Test.Constants.int16Const == 5s - PACKAGE.Darklang.Test.Constants.uint16Const = 5us - PACKAGE.Darklang.Test.Constants.uint16Const = 5us + PACKAGE.Darklang.Test.Constants.uint16Const == 5us + PACKAGE.Darklang.Test.Constants.uint16Const == 5us - PACKAGE.Darklang.Test.Constants.int8Const = 5y - PACKAGE.Darklang.Test.Constants.int8Const = 5y + PACKAGE.Darklang.Test.Constants.int8Const == 5y + PACKAGE.Darklang.Test.Constants.int8Const == 5y - PACKAGE.Darklang.Test.Constants.uint8Const = 5uy - PACKAGE.Darklang.Test.Constants.uint8Const = 5uy + PACKAGE.Darklang.Test.Constants.uint8Const == 5uy + PACKAGE.Darklang.Test.Constants.uint8Const == 5uy - PACKAGE.Darklang.Test.Constants.floatConst = 5.6 - PACKAGE.Darklang.Test.Constants.floatConst = 5.6 + PACKAGE.Darklang.Test.Constants.floatConst == 5.6 + PACKAGE.Darklang.Test.Constants.floatConst == 5.6 - PACKAGE.Darklang.Test.Constants.boolConst = true - PACKAGE.Darklang.Test.Constants.boolConst = true + PACKAGE.Darklang.Test.Constants.boolConst == true + PACKAGE.Darklang.Test.Constants.boolConst == true - PACKAGE.Darklang.Test.Constants.tupleConst = (1L, 2L, 3L) - PACKAGE.Darklang.Test.Constants.tupleConst = (1L, 2L, 3L) + PACKAGE.Darklang.Test.Constants.tupleConst == (1L, 2L, 3L) + PACKAGE.Darklang.Test.Constants.tupleConst == (1L, 2L, 3L) - PACKAGE.Darklang.Test.Constants.charConst = 'c' - PACKAGE.Darklang.Test.Constants.charConst = 'c' + PACKAGE.Darklang.Test.Constants.charConst == 'c' + PACKAGE.Darklang.Test.Constants.charConst == 'c' - PACKAGE.Darklang.Test.Constants.unitConst = () - PACKAGE.Darklang.Test.Constants.unitConst = () + PACKAGE.Darklang.Test.Constants.unitConst == () + PACKAGE.Darklang.Test.Constants.unitConst == () - PACKAGE.Darklang.Test.Constants.enumConst = Stdlib.Option.Option.Some 5L + PACKAGE.Darklang.Test.Constants.enumConst == Stdlib.Option.Option.Some(5L) - PACKAGE.Darklang.Test.Constants.enumConst = Stdlib.Option.Option.Some 5L \ No newline at end of file + PACKAGE.Darklang.Test.Constants.enumConst == Stdlib.Option.Option.Some(5L) \ No newline at end of file diff --git a/backend/testfiles/execution/language/edict.dark b/backend/testfiles/execution/language/edict.dark index 3cb6ac0f03..7d5336e493 100644 --- a/backend/testfiles/execution/language/edict.dark +++ b/backend/testfiles/execution/language/edict.dark @@ -1,5 +1,5 @@ -((Dict { a = 5L }) |> Stdlib.Dict.get "a") = Stdlib.Option.Option.Some 5L +((Dict { a = 5L }) |> Stdlib.Dict.get "a") == Stdlib.Option.Option.Some(5L) -((Dict { ___ = 5L }) |> Stdlib.Dict.get "") = Stdlib.Option.Option.Some 5L +((Dict { ___ = 5L }) |> Stdlib.Dict.get "") == Stdlib.Option.Option.Some(5L) -((Dict { a = 5L }) |> Stdlib.Dict.get "b") = Stdlib.Option.Option.None \ No newline at end of file +((Dict { a = 5L }) |> Stdlib.Dict.get "b") == Stdlib.Option.Option.None() \ No newline at end of file diff --git a/backend/testfiles/execution/language/efieldaccess.dark b/backend/testfiles/execution/language/efieldaccess.dark index 997c6479a9..c03afb2df7 100644 --- a/backend/testfiles/execution/language/efieldaccess.dark +++ b/backend/testfiles/execution/language/efieldaccess.dark @@ -1,16 +1,24 @@ type MyRecord = { col1: Int64 } -(let x = MyRecord { col1 = 1L } in x.col1) = 1L +module General = + (let x = MyRecord { col1 = 1L } + x.col1) + == 1L module Errors = + // getting "No field named `___` in MyRecord record" instead + (let x = MyRecord { col1 = 1L } + x.___) + == Builtin.testDerrorMessage "Field name is empty" - (let x = MyRecord { col1 = 1L } in x.___) = Builtin.testDerrorMessage - "Field name is empty" + (let x = MyRecord { col1 = 1L } + x.fieldName) + == Builtin.testDerrorMessage "No field named `fieldName` in MyRecord record" - (let x = MyRecord { col1 = 1L } in x.fieldName) = Builtin.testDerrorMessage - "No field named `fieldName` in MyRecord record" + (Builtin.testRuntimeError "error").fieldName + == Builtin.testDerrorMessage "error" - (Builtin.testRuntimeError "error").fieldName = Builtin.testDerrorMessage "error" - - (let x = 6L in x.fieldName) = Builtin.testDerrorMessage + (let x = 6L + x.fieldName) + == Builtin.testDerrorMessage "Attempting to access field `fieldName` of a Int64 (field access only works with records)" \ No newline at end of file diff --git a/backend/testfiles/execution/language/eif.dark b/backend/testfiles/execution/language/eif.dark index c8eb0f14dc..b2b36bfda4 100644 --- a/backend/testfiles/execution/language/eif.dark +++ b/backend/testfiles/execution/language/eif.dark @@ -1,35 +1,45 @@ -(if true then "correct" else 0L) = "correct" +(if true then "correct" else 0L) == "correct" -(if true then Builtin.testRuntimeError "a" else 0L) = Builtin.testDerrorMessage "a" +(if true then Builtin.testRuntimeError "a" else 0L) +== Builtin.testDerrorMessage "a" -(if false then 0L else Builtin.testRuntimeError "a") = Builtin.testDerrorMessage "a" +(if false then 0L else Builtin.testRuntimeError "a") +== Builtin.testDerrorMessage "a" -(if false then Builtin.testRuntimeError "a" else 0L) = 0L -(if true then 0L else Builtin.testRuntimeError "a") = 0L -(if false then "" else "correct") = "correct" -(if () then "" else "") = Builtin.testDerrorMessage "If only supports Booleans" +(if false then Builtin.testRuntimeError "a" else 0L) == 0L +(if true then 0L else Builtin.testRuntimeError "a") == 0L +(if false then "" else "correct") == "correct" +(if () then "" else "") == Builtin.testDerrorMessage "If only supports Booleans" -(if Builtin.testRuntimeError "msg" then "" else "") = Builtin.testDerrorMessage "msg" +(if Builtin.testRuntimeError "msg" then "" else "") +== Builtin.testDerrorMessage "msg" -(if 5L then "" else "") = Builtin.testDerrorMessage "If only supports Booleans" +(if 5L then "" else "") == Builtin.testDerrorMessage "If only supports Booleans" (if true then - ()) = () + ()) +== () (if 1L > 3L then - 4L) = () + 4L) +== () (if 1L < 3L then - 4L) = 4L + 4L) +== 4L (if 1L < 3L then - "msg") = "msg" + "msg") +== "msg" (if () then - "msg") = Builtin.testDerrorMessage "If only supports Booleans" + "msg") +== Builtin.testDerrorMessage "If only supports Booleans" (if true then - Builtin.testRuntimeError "a") = Builtin.testDerrorMessage "a" + Builtin.testRuntimeError "a") +== Builtin.testDerrorMessage "a" (if Builtin.testRuntimeError "msg" then - "") = Builtin.testDerrorMessage "msg" \ No newline at end of file + "") +== Builtin.testDerrorMessage "msg" \ No newline at end of file diff --git a/backend/testfiles/execution/language/einfix.dark b/backend/testfiles/execution/language/einfix.dark index 43367cc77d..1bfe73540b 100644 --- a/backend/testfiles/execution/language/einfix.dark +++ b/backend/testfiles/execution/language/einfix.dark @@ -1,13 +1,17 @@ -5L + 3L = 8L -"xx" ++ "yy" = "xxyy" -(5L + (3L)) = 8L -Stdlib.Int64.add_v0 5L 3L = 8L +5L + 3L == 8L +"xx" ++ "yy" == "xxyy" +(5L + (3L)) == 8L +Stdlib.Int64.add 5L 3L == 8L -5L + true = Builtin.testDerrorMessage - "int64Add's 2nd argument (`b`) should be an Int64. However, a Bool (true) was passed instead.\n\nExpected: (b: Int64)\nActual: a Bool: true" +5L + true +== Builtin.testDerrorMessage + """int64Add's 2nd argument (`b`) should be an Int64. However, a Bool (true) was passed instead. -5L + (Builtin.testRuntimeError "error") = Builtin.testDerrorMessage "error" -(Builtin.testRuntimeError "error") + 5L = Builtin.testDerrorMessage "error" +Expected: (b: Int64) +Actual: a Bool: true""" -(Builtin.testRuntimeError "one") + (Builtin.testRuntimeError "two") = Builtin.testDerrorMessage - "one" // CLEANUP \ No newline at end of file +5L + (Builtin.testRuntimeError "error") == Builtin.testDerrorMessage "error" +(Builtin.testRuntimeError "error") + 5L == Builtin.testDerrorMessage "error" + +(Builtin.testRuntimeError "one") + (Builtin.testRuntimeError "two") +== Builtin.testDerrorMessage "one" // CLEANUP \ No newline at end of file diff --git a/backend/testfiles/execution/language/elambda.dark b/backend/testfiles/execution/language/elambda.dark index 410fac92b2..592476860e 100644 --- a/backend/testfiles/execution/language/elambda.dark +++ b/backend/testfiles/execution/language/elambda.dark @@ -1,56 +1,74 @@ -Stdlib.List.push_v0 [] (fun x -> -4.611686018e+18) = [ (fun x -> -4.611686018e+18) ] +// Stdlib.List.push [] (fun x -> -4.611686018e+18) +// == [ (fun x -> -4.611686018e+18) ] // Test that empty parameters are removed -(let y = (fun x ___ -> x + 1L) in Stdlib.List.map_v0 [ 1L; 2L; 3L; 4L ] y) = [ 2L - 3L - 4L - 5L ] +(let y = (fun x ___ -> x + 1L) + Stdlib.List.map [ 1L; 2L; 3L; 4L ] y) +== [ 2L; 3L; 4L; 5L ] -(let y = (fun x -> x + 1L) in Stdlib.List.map_v0 [ 1L; 2L; 3L; 4L ] y) = [ 2L - 3L - 4L - 5L ] +(let y = (fun x -> x + 1L) + Stdlib.List.map [ 1L; 2L; 3L; 4L ] y) +== [ 2L; 3L; 4L; 5L ] (let y = (fun msg -> Builtin.testRuntimeError msg) - Stdlib.List.map_v0 [ "1"; "2"; "3"; "4" ] y) = Builtin.testDerrorMessage "1" + Stdlib.List.map [ "1"; "2"; "3"; "4" ] y) +== Builtin.testDerrorMessage "1" -(let y = (fun msg -> Builtin.testRuntimeError msg) in Stdlib.List.map_v0 [] y) = [] +(let y = (fun msg -> Builtin.testRuntimeError msg) + Stdlib.List.map [] y) +== [] // (let y = (fun a b -> a + b) in y 2 3) = 5 // TODO: allow -(let y = (fun a b -> a * b) in Stdlib.List.fold_v0 [ 1L; 2L; 3L; 4L ] 1L y) = 24L +(let y = (fun a b -> a * b) + Stdlib.List.fold [ 1L; 2L; 3L; 4L ] 1L y) +== 24L -(Stdlib.List.fold_v0 [ 4L ] 1L (Builtin.testRuntimeError "test")) = Builtin.testDerrorMessage - "test" +(Stdlib.List.fold [ 4L ] 1L (Builtin.testRuntimeError "test")) +== Builtin.testDerrorMessage "test" (let x = 5L let y = (fun c -> x + c) let x = 6L - [ 1L; 2L; 3L; 4L ] |> Stdlib.List.map_v0 y) = [ 6L; 7L; 8L; 9L ] - -(Stdlib.String.join_v0 - (Stdlib.List.map_v0 (Stdlib.String.toList "some string") (fun var -> - Stdlib.String.toUppercase (Stdlib.String.fromChar var))) - "") = "SOME STRING" + [ 1L; 2L; 3L; 4L ] |> Stdlib.List.map y) +== [ 6L; 7L; 8L; 9L ] + +(Stdlib.String.join + (Stdlib.List.map + (Stdlib.String.toList "some string") + (fun var -> Stdlib.String.toUppercase (Stdlib.String.fromChar var)) + ) + "" +) +== "SOME STRING" (let y = (fun c -> if c > 2L then Builtin.testRuntimeError "err" else 18L) - [ 1L; 2L; 3L; 4L ] |> Stdlib.List.map_v0 y) = Builtin.testDerrorMessage "err" + [ 1L; 2L; 3L; 4L ] |> Stdlib.List.map y) +== Builtin.testDerrorMessage "err" (let y = (fun c -> if c > 2L then Builtin.testRuntimeError "err" else 18L) - [ 1L; 2L ] |> Stdlib.List.map_v0 y) = [ 18L; 18L ] + [ 1L; 2L ] |> Stdlib.List.map y) +== [ 18L; 18L ] -(let t = true in Stdlib.List.all [ 1L; 2L ] (fun _ -> t)) = true -(let f = false in Stdlib.List.all [ 1L; 2L ] (fun _ -> f)) = false +(let t = true + Stdlib.List.all [ 1L; 2L ] (fun _ -> t)) +== true + +(let f = false + Stdlib.List.all [ 1L; 2L ] (fun _ -> f)) +== false (let x = 1L - let f = fun _ -> x + let f = (fun _ -> x) let x = 2L - Stdlib.List.map [ 1L; 2L; 3L ] f) = [ 1L; 1L; 1L ] + Stdlib.List.map [ 1L; 2L; 3L ] f) +== [ 1L; 1L; 1L ] (let pairs = [ (1L, "one"); (2L, "two"); (3L, "three") ] let transformer = fun (num, str) -> $"{Stdlib.Int64.toString num}:{str}" - Stdlib.List.map_v0 pairs transformer) = [ "1:one"; "2:two"; "3:three" ] + Stdlib.List.map pairs transformer) +== [ "1:one"; "2:two"; "3:three" ] (let triplets = [ (1L, "one", true); (2L, "two", false) ] @@ -61,49 +79,55 @@ Stdlib.List.push_v0 [] (fun x -> -4.611686018e+18) = [ (fun x -> -4.611686018e+1 else $"{Stdlib.Int64.toString num}:{str}:FALSE" - Stdlib.List.map_v0 triplets transformer) = [ "1:one:TRUE"; "2:two:FALSE" ] + Stdlib.List.map triplets transformer) +== [ "1:one:TRUE"; "2:two:FALSE" ] // nested (let sing = [ (("1"), "2"); (("3"), "4") ] + // CLEANUP: reintroduce parens around str1 in the lambda_pats + let transformer = (fun (str1, str2) -> str1 ++ str2) + Stdlib.List.map sing transformer) +== [ "12"; "34" ] - let transformer = fun ((str1), str2) -> str1 ++ str2 - Stdlib.List.map_v0 sing transformer) = [ "12"; "34" ] // TODO: // There is weird parser behavior for nested tuples with more than one member. // We will need to check the case with a new parser like the Treesitter. // -// (let triplets = [ ((1, "one"), true); ((2,"two"), false) ] +(let triplets = [ ((1L, "one"), true); ((2L, "two"), false) ] -// let transformer = -// fun ((num, str), flag) -> -// if flag then -// $"{Stdlib.Int64.toString num}:{str}:TRUE" -// else -// $"{Stdlib.Int64.toString num}:{str}:FALSE" + let transformer = + fun ((num, str), flag) -> + if flag then + $"{Stdlib.Int64.toString num}:{str}:TRUE" + else + $"{Stdlib.Int64.toString num}:{str}:FALSE" -// Stdlib.List.map_v0 triplets transformer) = [ "1:one:TRUE" -// "2:two:FALSE" ] + Stdlib.List.map triplets transformer) +== [ "1:one:TRUE"; "2:two:FALSE" ] (let triplets = [ (1L, "one", true); (2L, "two", false) ] let transformer = fun (num, str) -> $"{Stdlib.Int64.toString num}:{str}" - Stdlib.List.map_v0 triplets transformer) = Builtin.testDerrorMessage - "Tuple pattern has wrong number of elements" + Stdlib.List.map triplets transformer) +== Builtin.testDerrorMessage "Tuple pattern has wrong number of elements" -Stdlib.Dict.map_v0 +(Stdlib.Dict.map (Dict { key1 = ("val11", "val12") key2 = ("val21", "val22") }) - (fun x (y, z) -> x ++ y ++ z) = (Dict + (fun x (y, z) -> x ++ y ++ z) +) +== (Dict { key2 = "key2val21val22" key1 = "key1val11val12" }) -Stdlib.Dict.map_v0 +Stdlib.Dict.map (Dict { key1 = ("val11", "val12") key2 = ("val21", "val22") }) - (fun x (_, z) -> x ++ z) = (Dict + (fun x (_, z) -> x ++ z) +== (Dict { key2 = "key2val22" key1 = "key1val12" }) \ No newline at end of file diff --git a/backend/testfiles/execution/language/elet.dark b/backend/testfiles/execution/language/elet.dark index 57ef6879ed..385214663d 100644 --- a/backend/testfiles/execution/language/elet.dark +++ b/backend/testfiles/execution/language/elet.dark @@ -1,37 +1,77 @@ -(let x = Builtin.testRuntimeError "a" in 5L) = Builtin.testDerrorMessage "a" +module General = + (let x = Builtin.testRuntimeError "a" + 5L) + == Builtin.testDerrorMessage "a" -(let x = Builtin.testRuntimeError "a" in Builtin.testRuntimeError "b") = Builtin.testDerrorMessage - "a" + (let x = Builtin.testRuntimeError "a" + Builtin.testRuntimeError "b") + == Builtin.testDerrorMessage "a" module Variables = - (let x = 5L in x) = 5L + (let x = 5L + x) + == 5L module Unit = - (let () = Stdlib.Tuple2.first ((), 5L) in 5L) = 5L + (let () = Stdlib.Tuple2.first ((), 5L) + 5L) + == 5L module Tuples = - (let (a, b) = (1L, 2L) in 2L) = 2L - (let (a, b) = (1L, 2L) in b) = 2L - (let (a, b) = (1L, 2L) in (b, a)) = (2L, 1L) - (let (d, d) = (2L, 1L) in d) = 1L - (let (_, _) = (1L, 2L) in 2L) = 2L + (let (a, b) = (1L, 2L) + 2L) + == 2L + + (let (a, b) = (1L, 2L) + b) + == 2L + + (let (a, b) = (1L, 2L) + (b, a)) + == (2L, 1L) + + (let (d, d) = (2L, 1L) + d) + == 1L + + (let (_, _) = (1L, 2L) + 2L) + == 2L + + (let (a, b, c) = (1L, 2L, 3L) + b) + == 2L + + (let (a, b, c) = (1L, 2L, 3L) + (b, a)) + == (2L, 1L) - (let (a, b, c) = (1L, 2L, 3L) in b) = 2L - (let (a, b, c) = (1L, 2L, 3L) in (b, a)) = (2L, 1L) - (let (d, d, d) = (2L, 1L, 3L) in d) = 3L - (let (_, _, _) = (1L, 2L, 3L) in 2L) = 2L + (let (d, d, d) = (2L, 1L, 3L) + d) + == 3L - (let (_, _, _) = (1L, 2L, Builtin.testRuntimeError "test") in 2L) = Builtin.testDerrorMessage - "test" + (let (_, _, _) = (1L, 2L, 3L) + 2L) + == 2L + + (let (_, _, _) = (1L, 2L, Builtin.testRuntimeError "test") + 2L) + == Builtin.testDerrorMessage "test" (let (_, _, _) = (Builtin.testRuntimeError "test1", 2L, Builtin.testRuntimeError "test2") - 2L) = Builtin.testDerrorMessage "test1" + 2L) + == Builtin.testDerrorMessage "test1" // With multiple levels of nested destructuring - (let ((a, ((b, (c, d)), e)), f) = ((1L, ((2L, (3L, 4L)), 5L)), 6L) in c) = 3L - (let ((a, ((b, cd), e)), f) = ((1L, ((2L, (3L, 4L)), 5L)), 6L) in cd) = (3L, 4L) + (let ((a, ((b, (c, d)), e)), f) = ((1L, ((2L, (3L, 4L)), 5L)), 6L) + c) + == 3L + + (let ((a, ((b, cd), e)), f) = ((1L, ((2L, (3L, 4L)), 5L)), 6L) + cd) + == (3L, 4L) module Nesting = @@ -40,53 +80,60 @@ module Nesting = let z = 2L y + z - x) = 3L + x) + == 3L module Shadowing = (let x = 5L let x = 6L - x) = 6L + x) + == 6L (let x = 35L match 6L with - | x -> x) = 6L + | x -> x) + == 6L (let x = 35L - match Stdlib.Result.Result.Ok 6L with - | Ok x -> x) = 6L + match Stdlib.Result.Result.Ok(6L) with + | Ok(x) -> x) + == 6L - (let x = 35L in Stdlib.List.map_v0 [ 1L; 2L; 3L; 4L ] (fun x -> x + 2L)) = [ 3L - 4L - 5L - 6L ] + (let x = 35L + Stdlib.List.map [ 1L; 2L; 3L; 4L ] (fun x -> x + 2L)) + == [ 3L; 4L; 5L; 6L ] (let x = 35L - match Stdlib.Result.Result.Ok 6L with - | Ok x -> (Stdlib.List.map_v0 [ 1L; 2L; 3L; 4L ] (fun x -> x + 2L))) = [ 3L - 4L - 5L - 6L ] + match Stdlib.Result.Result.Ok(6L) with + | Ok(x) -> (Stdlib.List.map [ 1L; 2L; 3L; 4L ] (fun x -> x + 2L))) + == [ 3L; 4L; 5L; 6L ] - (Stdlib.List.map_v0 [ 1L; 2L; 3L; 4L ] (fun x -> + (Stdlib.List.map [ 1L; 2L; 3L; 4L ] (fun x -> (let x = 35L - match Stdlib.Result.Result.Ok 6L with - | Ok x -> x + 2L))) = [ 8L; 8L; 8L; 8L ] - - - (Stdlib.List.map_v0 [ 1L; 2L; 3L; 4L ] (fun x -> - match Stdlib.Result.Result.Ok 6L with - | Ok x -> let x = 9L in x + 2L)) = [ 11L; 11L; 11L; 11L ] - - (Stdlib.List.map_v0 [ 1L; 2L; 3L; 4L ] (fun x -> - (match Stdlib.Result.Result.Ok(Stdlib.Result.Result.Ok 6L) with - | Ok(Ok x) -> let x = 9L in x + 2L))) = [ 11L; 11L; 11L; 11L ] \ No newline at end of file + match Stdlib.Result.Result.Ok(6L) with + | Ok(x) -> x + 2L))) + == [ 8L; 8L; 8L; 8L ] + +(Stdlib.List.map [ 1L; 2L; 3L; 4L ] (fun x -> + match Stdlib.Result.Result.Ok(6L) with + | Ok(x) -> + let x = 9L + x + 2L)) +== [ 11L; 11L; 11L; 11L ] + +(Stdlib.List.map [ 1L; 2L; 3L; 4L ] (fun x -> + match Stdlib.Result.Result.Ok(Stdlib.Result.Result.Ok(6L)) with + | Ok(Ok(x)) -> + let x = 9L + x + 2L)) +== [ 11L; 11L; 11L; 11L ] \ No newline at end of file diff --git a/backend/testfiles/execution/language/ematch.dark b/backend/testfiles/execution/language/ematch.dark index db489e074c..c068d61c86 100644 --- a/backend/testfiles/execution/language/ematch.dark +++ b/backend/testfiles/execution/language/ematch.dark @@ -8,59 +8,67 @@ module Int64 = | 5L -> "fail" | -6L -> "fail" | 6L -> "pass" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match 6L with | 6L -> "pass" | 5L -> "fail" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match 6L with | var -> "pass" | 6L -> "fail" - | 5L -> "fail") = "pass" + | 5L -> "fail") + == "pass" (match 999999999999999L with | 0L -> "fail" - | 999999999999999L -> "pass") = "pass" + | 999999999999999L -> "pass") + == "pass" (match 6L with - | 6.0 -> "fail") = Builtin.testDerrorMessage - "Cannot match Int64 value 6 with a Float pattern" + | 6.0 -> "fail") + == Builtin.testDerrorMessage "Cannot match Int64 value 6 with a Float pattern" (match 6.0 with - | 6L -> "fail") = Builtin.testDerrorMessage - "Cannot match Float value 6.0 with an Int64 pattern" + | 6L -> "fail") + == Builtin.testDerrorMessage "Cannot match Float value 6.0 with an Int64 pattern" module UInt64 = (match 6UL with | 5UL -> "fail" | 6UL -> "pass" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match 6UL with | 6UL -> "pass" | 5UL -> "fail" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match 6UL with | var -> "pass" | 6UL -> "fail" - | 5UL -> "fail") = "pass" + | 5UL -> "fail") + == "pass" (match 18446744073709551615UL with | 0UL -> "fail" - | 18446744073709551615UL -> "pass") = "pass" + | 18446744073709551615UL -> "pass") + == "pass" (match 6UL with - | 6.0 -> "fail") = Builtin.testDerrorMessage - "Cannot match UInt64 value 6 with a Float pattern" + | 6.0 -> "fail") + == Builtin.testDerrorMessage "Cannot match UInt64 value 6 with a Float pattern" (match 6.0 with - | 6UL -> "fail") = Builtin.testDerrorMessage - "Cannot match Float value 6.0 with an UInt64 pattern" + | 6UL -> "fail") + == Builtin.testDerrorMessage "Cannot match Float value 6.0 with an UInt64 pattern" module Int8 = @@ -68,58 +76,64 @@ module Int8 = | 5y -> "fail" | -6y -> "fail" | 6y -> "pass" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match 6y with | 6y -> "pass" | 5y -> "fail" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match 6y with | var -> "pass" | 6y -> "fail" - | 5y -> "fail") = "pass" + | 5y -> "fail") + == "pass" (match 127y with | 0y -> "fail" - | 127y -> "pass") = "pass" + | 127y -> "pass") + == "pass" (match 6y with - | 6.0 -> "fail") = Builtin.testDerrorMessage - "Cannot match Int8 value 6 with a Float pattern" + | 6.0 -> "fail") + == Builtin.testDerrorMessage "Cannot match Int8 value 6 with a Float pattern" (match 6.0 with - | 6y -> "fail") = Builtin.testDerrorMessage - "Cannot match Float value 6.0 with an Int8 pattern" + | 6y -> "fail") + == Builtin.testDerrorMessage "Cannot match Float value 6.0 with an Int8 pattern" module UInt8 = (match 6uy with | 5uy -> "fail" | 6uy -> "pass" - | var -> "fail") = "pass" + | var -> "fail") == "pass" (match 6uy with | 6uy -> "pass" | 5uy -> "fail" - | var -> "fail") = "pass" + | var -> "fail") == "pass" (match 6uy with | var -> "pass" | 6uy -> "fail" - | 5uy -> "fail") = "pass" + | 5uy -> "fail") + == "pass" (match 255uy with | 0uy -> "fail" - | 255uy -> "pass") = "pass" + | 255uy -> "pass") + == "pass" (match 6uy with - | 6.0 -> "fail") = Builtin.testDerrorMessage - "Cannot match UInt8 value 6 with a Float pattern" + | 6.0 -> "fail") + == Builtin.testDerrorMessage "Cannot match UInt8 value 6 with a Float pattern" (match 6.0 with - | 6uy -> "fail") = Builtin.testDerrorMessage - "Cannot match Float value 6.0 with an UInt8 pattern" + | 6uy -> "fail") + == Builtin.testDerrorMessage "Cannot match Float value 6.0 with an UInt8 pattern" module Int16 = @@ -127,58 +141,66 @@ module Int16 = | 5s -> "fail" | -6s -> "fail" | 6s -> "pass" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match 6s with | 6s -> "pass" | 5s -> "fail" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match 6s with | var -> "pass" | 6s -> "fail" - | 5s -> "fail") = "pass" + | 5s -> "fail") + == "pass" (match 32767s with | 0s -> "fail" - | 32767s -> "pass") = "pass" + | 32767s -> "pass") + == "pass" (match 6s with - | 6.0 -> "fail") = Builtin.testDerrorMessage - "Cannot match Int16 value 6 with a Float pattern" + | 6.0 -> "fail") + == Builtin.testDerrorMessage "Cannot match Int16 value 6 with a Float pattern" (match 6.0 with - | 6s -> "fail") = Builtin.testDerrorMessage - "Cannot match Float value 6.0 with an Int16 pattern" + | 6s -> "fail") + == Builtin.testDerrorMessage "Cannot match Float value 6.0 with an Int16 pattern" module UInt16 = (match 6us with | 5us -> "fail" | 6us -> "pass" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match 6us with | 6us -> "pass" | 5us -> "fail" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match 6us with | var -> "pass" | 6us -> "fail" - | 5us -> "fail") = "pass" + | 5us -> "fail") + == "pass" (match 65535us with | 0us -> "fail" - | 65535us -> "pass") = "pass" + | 65535us -> "pass") + == "pass" (match 6us with - | 6.0 -> "fail") = Builtin.testDerrorMessage - "Cannot match UInt16 value 6 with a Float pattern" + | 6.0 -> "fail") + == Builtin.testDerrorMessage "Cannot match UInt16 value 6 with a Float pattern" (match 6.0 with - | 6us -> "fail") = Builtin.testDerrorMessage - "Cannot match Float value 6.0 with an UInt16 pattern" + | 6us -> "fail") + == Builtin.testDerrorMessage "Cannot match Float value 6.0 with an UInt16 pattern" module Int32 = @@ -186,58 +208,66 @@ module Int32 = | 5l -> "fail" | -6l -> "fail" | 6l -> "pass" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match 6l with | 6l -> "pass" | 5l -> "fail" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match 6l with | var -> "pass" | 6l -> "fail" - | 5l -> "fail") = "pass" + | 5l -> "fail") + == "pass" (match 2147483647l with | 0l -> "fail" - | 2147483647l -> "pass") = "pass" + | 2147483647l -> "pass") + == "pass" (match 6l with - | 6.0 -> "fail") = Builtin.testDerrorMessage - "Cannot match Int32 value 6 with a Float pattern" + | 6.0 -> "fail") + == Builtin.testDerrorMessage "Cannot match Int32 value 6 with a Float pattern" (match 6.0 with - | 6l -> "fail") = Builtin.testDerrorMessage - "Cannot match Float value 6.0 with an Int32 pattern" + | 6l -> "fail") + == Builtin.testDerrorMessage "Cannot match Float value 6.0 with an Int32 pattern" module UInt32 = (match 6ul with | 5ul -> "fail" | 6ul -> "pass" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match 6ul with | 6ul -> "pass" | 5ul -> "fail" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match 6ul with | var -> "pass" | 6ul -> "fail" - | 5ul -> "fail") = "pass" + | 5ul -> "fail") + == "pass" (match 4294967295ul with | 0ul -> "fail" - | 4294967295ul -> "pass") = "pass" + | 4294967295ul -> "pass") + == "pass" (match 6ul with - | 6.0 -> "fail") = Builtin.testDerrorMessage - "Cannot match UInt32 value 6 with a Float pattern" + | 6.0 -> "fail") + == Builtin.testDerrorMessage "Cannot match UInt32 value 6 with a Float pattern" (match 6.0 with - | 6ul -> "fail") = Builtin.testDerrorMessage - "Cannot match Float value 6.0 with an UInt32 pattern" + | 6ul -> "fail") + == Builtin.testDerrorMessage "Cannot match Float value 6.0 with an UInt32 pattern" module Int128 = @@ -245,58 +275,65 @@ module Int128 = | 5Q -> "fail" | -6Q -> "fail" | 6Q -> "pass" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match 6Q with | 6Q -> "pass" | 5Q -> "fail" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match 6Q with | var -> "pass" | 6Q -> "fail" - | 5Q -> "fail") = "pass" + | 5Q -> "fail") + == "pass" (match 170141183460469231731687303715884105727Q with | 0Q -> "fail" - | 170141183460469231731687303715884105727Q -> "pass") = "pass" + | 170141183460469231731687303715884105727Q -> "pass") + == "pass" (match 6Q with - | 6.0 -> "fail") = Builtin.testDerrorMessage - "Cannot match Int128 value 6 with a Float pattern" + | 6.0 -> "fail") + == Builtin.testDerrorMessage "Cannot match Int128 value 6 with a Float pattern" (match 6.0 with - | 6Q -> "fail") = Builtin.testDerrorMessage - "Cannot match Float value 6.0 with an Int128 pattern" + | 6Q -> "fail") + == Builtin.testDerrorMessage "Cannot match Float value 6.0 with an Int128 pattern" module UInt128 = (match 6Z with | 5Z -> "fail" | 6Z -> "pass" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match 6Z with | 6Z -> "pass" | 5Z -> "fail" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match 6Z with | var -> "pass" | 6Z -> "fail" - | 5Z -> "fail") = "pass" + | 5Z -> "fail") + == "pass" (match 340282366920938463463374607431768211455Z with | 0Z -> "fail" - | 340282366920938463463374607431768211455Z -> "pass") = "pass" + | 340282366920938463463374607431768211455Z -> "pass") + == "pass" (match 6Z with - | 6.0 -> "fail") = Builtin.testDerrorMessage - "Cannot match UInt128 value 6 with a Float pattern" + | 6.0 -> "fail") + == Builtin.testDerrorMessage "Cannot match UInt128 value 6 with a Float pattern" (match 6.0 with - | 6Z -> "fail") = Builtin.testDerrorMessage - "Cannot match Float value 6.0 with an UInt128 pattern" - + | 6Z -> "fail") + == Builtin.testDerrorMessage "Cannot match Float value 6.0 with an UInt128 pattern" module String = (match "x" with @@ -304,25 +341,29 @@ module String = | "" -> "pass" | "xx" -> "pass" | "x" -> "pass" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match "x" with | "x" -> "pass" | "y" -> "fail" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match "x" with | var -> $"pass: {var}" | "x" -> "fail" - | "y" -> "fail") = "pass: x" + | "y" -> "fail") + == "pass: x" (match "x" with - | 6L -> "fail") = Builtin.testDerrorMessage + | 6L -> "fail") + == Builtin.testDerrorMessage "Cannot match String value \"x\" with an Int64 pattern" (match 6L with - | "x" -> "fail") = Builtin.testDerrorMessage - "Cannot match Int64 value 6 with a String pattern" + | "x" -> "fail") + == Builtin.testDerrorMessage "Cannot match Int64 value 6 with a String pattern" module Bool = @@ -330,34 +371,40 @@ module Bool = (match true with | false -> "fail" | true -> "pass" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match true with | true -> "pass" | false -> "fail" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match true with | var -> if var then "pass" else "fail" | true -> "fail" - | false -> "fail") = "pass" + | false -> "fail") + == "pass" (match false with | true -> "fail" | false -> "pass" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match false with | var -> if var then "fail" else "pass" | false -> "fail" - | true -> "fail") = "pass" + | true -> "fail") + == "pass" (match false with - | "false" -> "fail") = Builtin.testDerrorMessage - "Cannot match Bool value false with a String pattern" + | "false" -> "fail") + == Builtin.testDerrorMessage "Cannot match Bool value false with a String pattern" (match "false" with - | false -> "fail") = Builtin.testDerrorMessage + | false -> "fail") + == Builtin.testDerrorMessage "Cannot match String value \"false\" with a Bool pattern" @@ -367,59 +414,67 @@ module Float = | 5.5 -> "fail" | -6.5 -> "fail" | 6.5 -> "pass" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match 6.5 with | 6.5 -> "pass" | 5.5 -> "fail" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match 6.5 with | var -> $"pass: {Stdlib.Float.toString var}" | 6.5 -> "fail" - | 5.5 -> "fail") = "pass: 6.5" + | 5.5 -> "fail") + == "pass: 6.5" + // TODO: add a cleanup // (match 0.0 with // | -0.0 -> "fail1" // | 0.0 -> "pass" - // | var -> "fail2") = "pass" + // | var -> "fail2") == "pass" (match -4.7 with | 4.7 -> "fail" | -4.7 -> "pass" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match -4.7 with | var -> $"pass: {Stdlib.Float.toString var}" | -4.7 -> "fail" - | 4.7 -> "fail") = "pass: -4.7" + | 4.7 -> "fail") + == "pass: -4.7" (match -4.7 with - | true -> "fail") = Builtin.testDerrorMessage - "Cannot match Float value -4.7 with a Bool pattern" + | true -> "fail") + == Builtin.testDerrorMessage "Cannot match Float value -4.7 with a Bool pattern" (match true with - | -4.7 -> "fail") = Builtin.testDerrorMessage - "Cannot match Bool value true with a Float pattern" + | -4.7 -> "fail") + == Builtin.testDerrorMessage "Cannot match Bool value true with a Float pattern" module Unit = (match () with | () -> "pass" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match () with | var -> "pass" - | () -> "fail") = "pass" + | () -> "fail") + == "pass" (match () with - | 0L -> "fail") = Builtin.testDerrorMessage - "Cannot match Unit value () with an Int64 pattern" + | 0L -> "fail") + == Builtin.testDerrorMessage "Cannot match Unit value () with an Int64 pattern" (match 0L with - | () -> "fail") = Builtin.testDerrorMessage - "Cannot match Int64 value 0 with an Unit pattern" + | () -> "fail") + == Builtin.testDerrorMessage "Cannot match Int64 value 0 with an Unit pattern" module Char = @@ -427,35 +482,40 @@ module Char = (match 'a' with | 'b' -> "fail" | 'a' -> "pass" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match 'a' with | 'a' -> "pass" | 'b' -> "fail" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match 'a' with | var -> $"pass: {Stdlib.Char.toString var}" | 'a' -> "fail" - | 'b' -> "fail") = "pass: a" + | 'b' -> "fail") + == "pass: a" (match 'c' with | 'd' -> "fail" | 'c' -> "pass" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match 'c' with | var -> $"pass" | 'c' -> "fail" - | 'd' -> "fail") = "pass" + | 'd' -> "fail") + == "pass" (match 'c' with - | true -> "fail") = Builtin.testDerrorMessage - "Cannot match Char value 'c' with a Bool pattern" + | true -> "fail") + == Builtin.testDerrorMessage "Cannot match Char value 'c' with a Bool pattern" (match true with - | 'c' -> "fail") = Builtin.testDerrorMessage - "Cannot match Bool value true with a Char pattern" + | 'c' -> "fail") + == Builtin.testDerrorMessage "Cannot match Bool value true with a Char pattern" module List = @@ -463,12 +523,14 @@ module List = (match [ 1L; 2L; 3L ] with | [] -> "fail" | [ 1L; 2L; 3L ] -> "pass" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match [ 1L; 2L; 3L ] with | [ 1L; 2L; 3L ] -> "pass" | [] -> "fail" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match [ 1L; 2L; 3L ] with | var -> @@ -476,125 +538,147 @@ module List = $"pass with length: {length}" | [ 1L; 2L; 3L ] -> "fail" - | [] -> "fail") = "pass with length: 3" + | [] -> "fail") + == "pass with length: 3" (match [] with | [] -> "pass" | [ 1L; 2L; 3L ] -> "fail" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match [ 1L; 2L; 3L ] with | [ 1L; 2L ] -> "fail" | [ 1L; 2L; 3L; 4L ] -> "fail" | [ 1L; 2L; 3L ] -> "pass" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match [ 1L; 2L; 3L ] with | head :: tail -> $"pass" - | [] -> "fail") = "pass" + | [] -> "fail") + == "pass" (match [] with | head :: tail -> "fail" - | [] -> "pass") = "pass" + | [] -> "pass") + == "pass" // duplicate variable name + // TODO: had to put the rhs of the first match case in a new line indented to make it work (match [ 1L; 2L; 5L ] with - | [ a; a; a ] -> a - | name -> name ++ "var") = 5L + | [ a; a; a ] -> + a + | name -> name ++ "var") + == 5L (match [ 1L; 2L; 3L ] with - | "1,2,3" -> "fail") = Builtin.testDerrorMessage + | "1,2,3" -> "fail") + == Builtin.testDerrorMessage "Cannot match List value [ 1, 2, ... with a String pattern" (match [ 1L; 2L; 3L ] with - | [ 1.0; 2.0; 3.0 ] -> "fail") = Builtin.testDerrorMessage - "Cannot match Int64 value 1 with a Float pattern" + | [ 1.0; 2.0; 3.0 ] -> "fail") + == Builtin.testDerrorMessage "Cannot match Int64 value 1 with a Float pattern" (match "" with - | [ 1L; 2L; 3L ] -> "fail") = Builtin.testDerrorMessage - "Cannot match String value \"\" with a List pattern" + | [ 1L; 2L; 3L ] -> "fail") + == Builtin.testDerrorMessage "Cannot match String value \"\" with a List pattern" module NestedList = - (match [ [ 1L; 2L ]; [ 3L; 4L ] ] with | [] -> "fail" | [ [ 1L; 2L ]; [ 3L; 4L ] ] -> "pass" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match [ [ 1L; 2L ]; [ 3L; 4L ] ] with | [ [ 1L; 2L ]; [ 3L; 4L ] ] -> "pass" | [] -> "fail" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match [ [ 1L; 2L ]; [ 3L; 4L ] ] with | [ a; b ] -> $"pass" - | [] -> "fail") = "pass" + | [] -> "fail") + == "pass" (match [ [ 1L; 2L ]; [] ] with | [ []; _ ] -> "fail" | [ [ 1L; 2L ]; _ ] -> "pass" - | _ -> "fail") = "pass" + | _ -> "fail") + == "pass" (match [ [ 1L; 2L ]; [ 3L; 4L; 5L ] ] with | [ [ 1L; 2L ]; [ _ ] ] -> "fail" | [ [ 1L; 2L ]; [ _; _ ] ] -> "fail" - | [ [ 1L; 2L ]; [ _; _; _ ] ] -> "pass") = "pass" + | [ [ 1L; 2L ]; [ _; _; _ ] ] -> "pass") + == "pass" (match [ [ 1L; 2L ]; [ 3L; 4L ] ] with | [ [ 1L; 2L; 3L ]; [ 4L; 5L; 6L ] ] -> "fail" | [ _; [ 3L; _ ] ] -> "pass" - | _ -> "fail") = "pass" + | _ -> "fail") + == "pass" (match [ [ 1L; 2L ]; [ 3L; 4L ] ] with - | "1,2,3,4" -> "fail") = Builtin.testDerrorMessage + | "1,2,3,4" -> "fail") + == Builtin.testDerrorMessage "Cannot match List> value [ [ ... with a String pattern" (match [ "" ] with - // Different lengths - | [ 1L; 2L; 3L ] -> "fail") = Builtin.testDerrorMessage "No match for [ \"\"]" + // Different lengths + | [ 1L; 2L; 3L ] -> "fail") + == Builtin.testDerrorMessage "No match for [ \"\"]" (match [ "" ] with - | [ 1L ] -> "fail") = Builtin.testDerrorMessage + | [ 1L ] -> "fail") + == Builtin.testDerrorMessage "Cannot match String value \"\" with an Int64 pattern" (match [ [ 1.0 ] ] with - | [ [ 1L ] ] -> "fail") = Builtin.testDerrorMessage - "Cannot match Float value 1.0 with an Int64 pattern" + | [ [ 1L ] ] -> "fail") + == Builtin.testDerrorMessage "Cannot match Float value 1.0 with an Int64 pattern" (match [ [ 1L; 2L ]; [ 3L; 4L ] ] with | [ [ 1.0; 2.0 ]; [ 3L; 4L ] ] -> "fail" | [ [ 1L; 2L ]; [ 3L; 4L ] ] -> "fail" - | _ -> "fail") = Builtin.testDerrorMessage - "Cannot match Int64 value 1 with a Float pattern" + | _ -> "fail") + == Builtin.testDerrorMessage "Cannot match Int64 value 1 with a Float pattern" module ListCons = (match [ 1L; 2L; 3L ] with - | 1L :: 2L :: [ 3L ] -> 42L) = 42L + | 1L :: 2L :: [ 3L ] -> 42L) + == 42L (match [ 1L; 2L; 3L ] with | 1L :: 2L :: [ 3L ] -> 42L | [] -> 4L - | _ -> 2L) = 42L + | _ -> 2L) + == 42L (match [ 1L; 2L; 3L ] with | [] -> 4L | 1L :: 2L :: [ 3L ] -> 42L - | _ -> 2L) = 42L + | _ -> 2L) + == 42L (match [ 1L; 2L; 3L ] with | _ -> 2L | 1L :: 2L :: [ 3L ] -> 42L - | [] -> 4L) = 2L + | [] -> 4L) + == 2L (match [ 1L; 2L; 3L ] with - | head :: rest -> head + (rest |> Stdlib.List.head |> Builtin.unwrap)) = 3L + | head :: rest -> head + (rest |> Stdlib.List.head |> Builtin.unwrap)) + == 3L (match "" with - | head :: rest -> "fail") = Builtin.testDerrorMessage - "Cannot match String value \"\" with a List pattern" + | head :: rest -> "fail") + == Builtin.testDerrorMessage "Cannot match String value \"\" with a List pattern" // head tail let headTail (list: List) : (Int64 * List) = @@ -602,13 +686,14 @@ module List = | head :: tail -> (head, tail) | [] -> (0L, []) - (headTail []) = (0L, []) - (headTail [ 1L ]) = (1L, []) - (headTail [ 1L; 2L ]) = (1L, [ 2L ]) - (headTail [ 1L; 2L; 3L ]) = (1L, [ 2L; 3L ]) + (headTail []) == (0L, []) + (headTail [ 1L ]) == (1L, []) + (headTail [ 1L; 2L ]) == (1L, [ 2L ]) + (headTail [ 1L; 2L; 3L ]) == (1L, [ 2L; 3L ]) (match [ "dd"; "aa"; "fff"; "gg" ] with - | head :: tail -> (head, tail)) = ("dd", [ "aa"; "fff"; "gg" ]) + | head :: tail -> (head, tail)) + == ("dd", [ "aa"; "fff"; "gg" ]) // heads tail let sequence (list: List) : Int64 = @@ -618,273 +703,314 @@ module List = | [] -> 0L | _ -> -1L - (sequence []) = 0L - (sequence [ 1L ]) = -1L - (sequence [ 1L; 2L ]) = 2L - (sequence [ 1L; 2L; 3L ]) = 6L - (sequence [ 1L; 2L; 3L; 0L ]) = 6L + (sequence []) == 0L + (sequence [ 1L ]) == -1L + (sequence [ 1L; 2L ]) == 2L + (sequence [ 1L; 2L; 3L ]) == 6L + (sequence [ 1L; 2L; 3L; 0L ]) == 6L - // nested + // // nested let complexSum (list: List>) : Int64 = match list with | (a1 :: a2 :: ar) :: (b1 :: b2 :: br) :: (c1 :: cr) :: rest -> a1 + a2 + b1 + b2 + c1 - | (a :: ar) :: (b :: brest) :: rest -> a + b + | (a :: ar) :: (b :: brest) :: rest -> + a + b | _ -> 0L - (complexSum []) = 0L - (complexSum [ [ 1L; 2L ]; [ 3L; 4L ] ]) = 4L - (complexSum [ [ 1L; 2L; 3L ]; [ 3L; 4L; 5L ]; [ 4L; 5L; 6L ] ]) = 14L + (complexSum []) == 0L + (complexSum [ [ 1L; 2L ]; [ 3L; 4L ] ]) == 4L + (complexSum [ [ 1L; 2L; 3L ]; [ 3L; 4L; 5L ]; [ 4L; 5L; 6L ] ]) == 14L // wildcard (match [ 1L; 2L; 3L; 4L ] with | 1L :: a :: [ 4L; 3L ] -> a + 1L | _ :: a :: _ -> a + 2L - | 1L :: a :: rest -> a + 3L) = 4L + | 1L :: a :: rest -> a + 3L) + == 4L // misc (match [ 1L; 2L; 3L; 4L ] with | 2L :: a :: [ 3L; 4L ] -> a + 1L | 1L :: a :: [ 4L; 3L ] -> a + 2L | 1L :: a :: [ 3L; 4L ] -> a + 3L - | 1L :: a :: rest -> a + 4L) = 5L + | 1L :: a :: rest -> a + 4L) + == 5L (match [ 1L; 2L; 3L; 4L ] with | 2L :: a :: rest -> a - 1L - | 1L :: a :: rest -> a * 2L) = 4L - + | 1L :: a :: rest -> a * 2L) + == 4L module Tuple = (match (1L, 'a') with | (2L, 'b') -> "fail" | (1L, 'a') -> "pass" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match (1L, 'a') with | (1L, 'a') -> "pass" | (2L, 'b') -> "fail" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match (1L, 'a') with | (x, y) -> $"pass" - | (2L, 'b') -> "fail") = "pass" + | (2L, 'b') -> "fail") + == "pass" (match (1L, 'a', true) with | (1L, _, true) -> "pass" - | _ -> "fail") = "pass" + | _ -> "fail") + == "pass" (match (1L, 'a') with - | "1,a" -> "fail") = Builtin.testDerrorMessage + | "1,a" -> "fail") + == Builtin.testDerrorMessage "Cannot match (Int64, Char) value (1, 'a') with a String pattern" (match "1,a" with - | (1L, 'a') -> "fail") = Builtin.testDerrorMessage + | (1L, 'a') -> "fail") + == Builtin.testDerrorMessage "Cannot match String value \"1,a\" with a Tuple pattern" (match (1L, 'a') with | (1.0, 'a') -> "fail" | (1L, 'a') -> "fail" - | (2L, 'b') -> "fail") = Builtin.testDerrorMessage - "Cannot match Int64 value 1 with a Float pattern" + | (2L, 'b') -> "fail") + == Builtin.testDerrorMessage "Cannot match Int64 value 1 with a Float pattern" (match (1L, 'a') with | (1L, 'a', true) -> "fail" - | (1L, 'a') -> "pass") = "pass" + | (1L, 'a') -> "pass") + == "pass" (match (true, [ 1L; 2L ]) with | (true, [ 1L; 2L; 3L ]) -> "fail" | (false, _) -> "fail" - | (true, [ 1L; 2L ]) -> "pass") = "pass" + | (true, [ 1L; 2L ]) -> "pass") + == "pass" // duplicate tuple variables (let tpl = (1L, 2L, (3L, 4L), 5L) match tpl with | (a, b, (a, b), a) -> (a, b) - | name -> name ++ "var") = (5L, 4L) + | name -> name ++ "var") + == (5L, 4L) - module NestedTuple = +module NestedTuple = - (match ((1L, 'a'), (true, 2.0)) with - | ((2L, 'b'), (false, 3.0)) -> "fail" - | ((1L, 'a'), (true, 2.0)) -> "pass" - | var -> "fail") = "pass" + (match ((1L, 'a'), (true, 2.0)) with + | ((2L, 'b'), (false, 3.0)) -> "fail" + | ((1L, 'a'), (true, 2.0)) -> "pass" + | var -> "fail") + == "pass" - (match ((1L, 'a'), (true, 2.0)) with - | ((1L, 'a'), _) -> "pass" - | ((2L, 'b'), _) -> "fail" - | _ -> "fail") = "pass" + (match ((1L, 'a'), (true, 2.0)) with + | ((1L, 'a'), _) -> "pass" + | ((2L, 'b'), _) -> "fail" + | _ -> "fail") + == "pass" - (match ((1L, 'a'), (true, 2.0)) with - | (_, (true, _)) -> "pass" - | _ -> "fail") = "pass" + (match ((1L, 'a'), (true, 2.0)) with + | (_, (true, _)) -> "pass" + | _ -> "fail") + == "pass" - (match ((1L, 'a'), (true, 2.0)) with - | ((_, 'a'), (true, _)) -> "pass" - | _ -> "fail") = "pass" + (match ((1L, 'a'), (true, 2.0)) with + | ((_, 'a'), (true, _)) -> "pass" + | _ -> "fail") + == "pass" - (match ((1L, 'a'), (true, 2.0)) with - | ((1L, _), (_, 3.0)) -> "fail" - | ((1L, _), (_, 2.0)) -> "pass" - | _ -> "fail") = "pass" + (match ((1L, 'a'), (true, 2.0)) with + | ((1L, _), (_, 3.0)) -> "fail" + | ((1L, _), (_, 2.0)) -> "pass" + | _ -> "fail") + == "pass" - (match ((1L, 'a'), (true, 2.0)) with - | "1,a,true,2.0" -> "fail") = Builtin.testDerrorMessage - "Cannot match ((Int64, Char), (Bool, Float)) value ((1, 'a'),... with a String pattern" + (match ((1L, 'a'), (true, 2.0)) with + | "1,a,true,2.0" -> "fail") + == Builtin.testDerrorMessage + "Cannot match ((Int64, Char), (Bool, Float)) value ((1, 'a'),... with a String pattern" - (match "" with - | ((1.0, 'a'), (true, 2.0)) -> "fail") = Builtin.testDerrorMessage - "Cannot match String value \"\" with a Tuple pattern" + (match "" with + | ((1.0, 'a'), (true, 2.0)) -> "fail") + == Builtin.testDerrorMessage + "Cannot match String value \"\" with a Tuple pattern" - (match ((1L, 'a'), (true, 2.0)) with - | ((1.0, 'a'), (true, 2.0)) -> "fail" - | ((1L, 'a'), (true, 2.0)) -> "fail" - | _ -> "fail") = Builtin.testDerrorMessage - "Cannot match Int64 value 1 with a Float pattern" + (match ((1L, 'a'), (true, 2.0)) with + | ((1.0, 'a'), (true, 2.0)) -> "fail" + | ((1L, 'a'), (true, 2.0)) -> "fail" + | _ -> "fail") + == Builtin.testDerrorMessage "Cannot match Int64 value 1 with a Float pattern" - (match ((1L, 'a'), (true, 2.0)) with - | ((_, _), (_, _)) -> "pass" - | _ -> "fail") = "pass" + (match ((1L, 'a'), (true, 2.0)) with + | ((_, _), (_, _)) -> "pass" + | _ -> "fail") + == "pass" - (match ((1L, 'a'), (true, 2.0)) with - | ((_, _), _) -> "pass" - | _ -> "fail") = "pass" + (match ((1L, 'a'), (true, 2.0)) with + | ((_, _), _) -> "pass" + | _ -> "fail") + == "pass" module Result = - - (match Stdlib.Result.Result.Ok 5L with - | Ok 6L -> "fail" - | Error _ -> "fail" - | Ok 5L -> "pass" - | var -> "fail") = "pass" - - (match Stdlib.Result.Result.Ok 5L with - | Ok 5L -> "pass" - | Error _ -> "fail" - | var -> "fail") = "pass" - - (match Stdlib.Result.Result.Error "failure" with - | Ok _ -> "fail" - | Error "success" -> "fail" - | Error "failure" -> "pass") = "pass" - - (match Stdlib.Result.Result.Error "failure" with - | Ok var -> $"unexpected: {var}" - | Error msg -> $"pass: {msg}") = "pass: failure" - - (match Stdlib.Result.Result.Ok [ 1L; 2L; 3L ] with - | Ok [ 1L; 2L; 3L; 4L ] -> "fail" - | Error _ -> "fail" - | Ok [ 1L; 2L; 3L ] -> "pass" - | _ -> "fail") = "pass" + (match Stdlib.Result.Result.Ok(5L) with + | Ok(6L) -> "fail" + | Error(_) -> "fail" + | Ok(5L) -> "pass" + | var -> "fail") + == "pass" + + (match Stdlib.Result.Result.Ok(5L) with + | Ok(5L) -> "pass" + | Error(_) -> "fail" + | var -> "fail") + == "pass" + + (match Stdlib.Result.Result.Error("failure") with + | Ok(_) -> "fail" + | Error("success") -> "fail" + | Error("failure") -> "pass") + == "pass" + + (match Stdlib.Result.Result.Error("failure") with + | Ok(var) -> $"unexpected: {var}" + | Error(msg) -> $"pass: {msg}") + == "pass: failure" + + (match Stdlib.Result.Result.Ok([ 1L; 2L; 3L ]) with + | Ok([ 1L; 2L; 3L; 4L ]) -> "fail" + | Error(_) -> "fail" + | Ok([ 1L; 2L; 3L ]) -> "pass" + | _ -> "fail") + == "pass" (match Stdlib.Result.Result.Ok((1L, 'a')) with | Ok((2L, 'b')) -> "fail" | Ok((1L, 'a')) -> "pass" - | _ -> "fail") = "pass" - - (match Stdlib.Result.Result.Error "failure" with - | "failure" -> "fail" - | Error "failure" -> "fail" - | _ -> "fail") = Builtin.testDerrorMessage + | _ -> "fail") + == "pass" + + (match Stdlib.Result.Result.Error("failure") with + | "failure" -> "fail" + | Error("failure") -> "fail" + | _ -> "fail") + == Builtin.testDerrorMessage "Cannot match PACKAGE.Darklang.Stdlib.Result.Result value PACKAGE.Da... with a String pattern" - (match Stdlib.Result.Result.Ok 5.0 with - | Ok 6.0 -> "fail" - | Error _ -> "fail" - | Ok 5.0 -> "pass" - | _ -> "fail") = "pass" - - + (match Stdlib.Result.Result.Ok(5.0) with + | Ok(6.0) -> "fail" + | Error(_) -> "fail" + | Ok(5.0) -> "pass" + | _ -> "fail") + == "pass" module Option = - - (match Stdlib.Option.Option.Some 5L with - | Some 6L -> "fail" - | None -> "fail" - | Some 5L -> "pass" - | var -> "fail") = "pass" - - (match Stdlib.Option.Option.Some 5L with - | Some 5L -> "pass" - | None -> "fail" - | var -> "fail") = "pass" - - (match Stdlib.Option.Option.None with - | Some _ -> "fail" - | None -> "pass") = "pass" - - (match Stdlib.Option.Option.Some "hello" with - | Some "world" -> "fail" - | None -> "fail" - | Some msg -> $"pass: {msg}") = "pass: hello" - - (match Stdlib.Option.Option.Some [ 1L; 2L; 3L ] with - | Some [ 1L; 2L; 3L; 4L ] -> "fail" - | None -> "fail" - | Some [ 1L; 2L; 3L ] -> "pass" - | _ -> "fail") = "pass" + (match Stdlib.Option.Option.Some(5L) with + | Some(6L) -> "fail" + | None() -> "fail" + | Some(5L) -> "pass" + | var -> "fail") + == "pass" + + (match Stdlib.Option.Option.Some(5L) with + | Some(5L) -> "pass" + | None() -> "fail" + | var -> "fail") + == "pass" + + (match Stdlib.Option.Option.None() with + | Some(_) -> "fail" + | None() -> "pass") + == "pass" + + (match Stdlib.Option.Option.Some("hello") with + | Some("world") -> "fail" + | None() -> "fail" + | Some(msg) -> $"pass: {msg}") + == "pass: hello" + + (match Stdlib.Option.Option.Some([ 1L; 2L; 3L ]) with + | Some([ 1L; 2L; 3L; 4L ]) -> "fail" + | None() -> "fail" + | Some([ 1L; 2L; 3L ]) -> "pass" + | _ -> "fail") + == "pass" (match Stdlib.Option.Option.Some((1L, 'a')) with | Some((2L, 'b')) -> "fail" | Some((1L, 'a')) -> "pass" - | _ -> "fail") = "pass" + | _ -> "fail") + == "pass" - (match Stdlib.Option.Option.Some "hello" with + (match Stdlib.Option.Option.Some("hello") with | "hello" -> "fail" | Some "hello" -> "fail" - | _ -> "fail") = Builtin.testDerrorMessage + | _ -> "fail") + == Builtin.testDerrorMessage // TODO bad error message "Cannot match PACKAGE.Darklang.Stdlib.Option.Option value PACKAGE.Da... with a String pattern" - (match Stdlib.Option.Option.Some 5.0 with - | Some 6.0 -> "fail" - | None -> "fail" - | Some 5.0 -> "pass" - | _ -> "fail") = "pass" + (match Stdlib.Option.Option.Some(5.0) with + | Some(6.0) -> "fail" + | None() -> "fail" + | Some(5.0) -> "pass" + | _ -> "fail") + == "pass" module Errors = (match "nothing matches" with - | "not this" -> "fail") = Builtin.testDerrorMessage "No match for \"nothing m..." + | "not this" -> "fail") + == Builtin.testDerrorMessage "No match for \"nothing matches\"" (match Builtin.testRuntimeError "cond is error" with | 5L -> "fail" | 6L -> "pass" - | var -> "fail") = Builtin.testDerrorMessage "cond is error" + | var -> "fail") + == Builtin.testDerrorMessage "cond is error" (match Builtin.testRuntimeError "cond is error, wildcard" with | 5L -> 5L - | _ -> 6L) = Builtin.testDerrorMessage "cond is error, wildcard" + | _ -> 6L) + == Builtin.testDerrorMessage "cond is error, wildcard" (match 1L with | 1L -> Builtin.testRuntimeError "a" | 6L -> "pass" - | var -> "fail") = Builtin.testDerrorMessage "a" + | var -> "fail") + == Builtin.testDerrorMessage "a" (match 1L with | 2L -> Builtin.testRuntimeError "a" | 1L -> "pass" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match 1L with | 1L -> "pass" | 6L -> Builtin.testRuntimeError "a" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match 1L with | 2L -> "pass" | 1L -> Builtin.testRuntimeError "a" - | var -> "fail") = Builtin.testDerrorMessage "a" + | var -> "fail") + == Builtin.testDerrorMessage "a" (match 3L with | 2L -> "pass" | 1L -> Builtin.testRuntimeError "a" - | var -> "pass") = "pass" + | var -> "pass") + == "pass" module TypeErrors = @@ -894,78 +1020,92 @@ module TypeErrors = | TwoArgs of Int64 * Int64 // enum with more pattern params than actual args - (match TestType.NoArgs with - | NoArgs _ -> "wrong number") = Builtin.testDerrorMessage - "NoArgs pattern is expecting 1 field, but NoArgs has 0 fields" + (match TestType.NoArgs() with + | NoArgs(_) -> "wrong number") + == Builtin.testDerrorMessage "NoArgs pattern is expecting 1 field, but NoArgs has 0 fields" // enum with fewer pattern params than actual args - (match TestType.OneArg 1L with - | OneArg -> "wrong number") = Builtin.testDerrorMessage - "OneArg pattern is expecting 0 fields, but OneArg has 1 field" + (match TestType.OneArg(1L) with + | OneArg() -> "wrong number") + == Builtin.testDerrorMessage "OneArg pattern is expecting 0 fields, but OneArg has 1 field" // enum with a single wildcard (match TestType.TwoArgs(1L, 2L) with - | TwoArgs _ -> "wildcards allowed") = "wildcards allowed" + | TwoArgs(_) -> "wildcards allowed") + == "wildcards allowed" module GuardClause = (match 5L with | x when x > 0L -> true - | _ -> false) = true + | _ -> false) + == true (match -5L with | x when x > 0L -> true - | _ -> false) = false + | _ -> false) + == false (match 6L with | x when x == 5L -> "fail" | -6L -> "fail" | 6L -> "pass" - | var -> "fail") = "pass" + | var -> "fail") + == "pass" (match 5L with | x when x > 0L -> "positive" | x when x < 0L -> "negative" - | _ -> false) = "positive" + | _ -> false) + == "positive" (match (5L, "hello") with | (x, y) when x > 0L && y == "hello" -> "pass" - | _ -> "fail") = "pass" + | _ -> "fail") + == "pass" (match (5L, "hello") with | (x, y) when x > 0L && y == "hello" -> "first matching branch" | (x, y) when x == 5L && y == "hello" -> "second matching branch" - | _ -> "fail") = "first matching branch" + | _ -> "fail") + == "first matching branch" (match (-5L, "hello") with | (x, y) when x > 0L && y == "hello" -> "pass" - | _ -> "fail") = "fail" + | _ -> "fail") + == "fail" (match (5L, "hello") with | (x, y) when x > 0L && Stdlib.String.length y == 5L -> "pass" - | _ -> "fail") = "pass" + | _ -> "fail") + == "pass" (match -5L with | x when y > 0L -> true - | _ -> false) = Builtin.testDerrorMessage "There is no variable named: y" + | _ -> false) + == Builtin.testDerrorMessage "There is no variable named: y" (match 5L with | 5L -> false - | x when y > 0L -> true) = false + | x when y > 0L -> true) + == false (match 5L with | x when x + 1L -> true - | 5L -> false) = Builtin.testDerrorMessage "When condition should be a boolean" + | 5L -> false) + == Builtin.testDerrorMessage "When condition should be a boolean" (match 5L with | (x, y) when x > 0L -> true - | _ -> false) = Builtin.testDerrorMessage - "Cannot match Int64 value 5 with a Tuple pattern" + | _ -> false) + == Builtin.testDerrorMessage "Cannot match Int64 value 5 with a Tuple pattern" (match 5L with | 2L when x > 2L -> false - | 3L -> true) = Builtin.testDerrorMessage "No match for 5" + | 3L -> true) + == Builtin.testDerrorMessage "No match for 5" - (match Stdlib.Result.Result.Error 5L with - | Ok x when x > 2L -> false - | Error _ -> true) = true \ No newline at end of file + (match Stdlib.Result.Result.Error(5L) with + | Ok(x) when x > 2L -> false + | Error(_) -> true) + == true \ No newline at end of file diff --git a/backend/testfiles/execution/language/eor.dark b/backend/testfiles/execution/language/eor.dark index 07638dab40..916a957a6b 100644 --- a/backend/testfiles/execution/language/eor.dark +++ b/backend/testfiles/execution/language/eor.dark @@ -1,17 +1,17 @@ -(true || true) = true -(true || false) = true -(false || true) = true -(false || false) = false -(true || Builtin.testRuntimeError "msg") = true -(true || 5L) = true -(false || Builtin.testRuntimeError "msg") = Builtin.testDerrorMessage "msg" -(false || 5L) = Builtin.testDerrorMessage "|| only supports Booleans" +(true || true) == true +(true || false) == true +(false || true) == true +(false || false) == false +(true || Builtin.testRuntimeError "msg") == true +(true || 5L) == true +(false || Builtin.testRuntimeError "msg") == Builtin.testDerrorMessage "msg" +(false || 5L) == Builtin.testDerrorMessage "|| only supports Booleans" -(Builtin.testRuntimeError "msg1" || Builtin.testRuntimeError "msg2") = Builtin.testDerrorMessage - "msg1" +(Builtin.testRuntimeError "msg1" || Builtin.testRuntimeError "msg2") +== Builtin.testDerrorMessage "msg1" -(5L || true) = Builtin.testDerrorMessage "|| only supports Booleans" -(true |> (||) true) = true -(true |> (||) false) = true -(false |> (||) true) = true -(false |> (||) false) = false \ No newline at end of file +(5L || true) == Builtin.testDerrorMessage "|| only supports Booleans" +(true |> (||) true) == true +(true |> (||) false) == true +(false |> (||) true) == true +(false |> (||) false) == false \ No newline at end of file diff --git a/backend/testfiles/execution/language/epipe.dark b/backend/testfiles/execution/language/epipe.dark index c1cc9df50b..76a6ad0b6d 100644 --- a/backend/testfiles/execution/language/epipe.dark +++ b/backend/testfiles/execution/language/epipe.dark @@ -1,105 +1,122 @@ -// function -let userFn () : Int64 = 6L -(() |> userFn) = 6L -([] |> Stdlib.List.push_v0 2L) = [ 2L ] +// dict // how is this a dict +type Z = { a: List } +type Y = { z: Z } +type X = { y: Y } -// nested function -([] |> Stdlib.List.push_v0 (Stdlib.Int64.add_v0 1L (Stdlib.Int64.add_v0 1L 3L))) = [ 5L ] +type MyEnum = | A of Int64 * Int64 * Int64 -([] |> Stdlib.List.push_v0 (Stdlib.Int64.add_v0 1L ((+) 1L 3L))) = [ 5L ] +module General = + // function + let userFn () : Int64 = 6L + (() |> userFn) == 6L + ([] |> Stdlib.List.push 2L) == [ 2L ] -([] |> Stdlib.List.push_v0 (Builtin.testRuntimeError "err")) = Builtin.testDerrorMessage - "err" + // nested function + ([] |> Stdlib.List.push (Stdlib.Int64.add 1L (Stdlib.Int64.add 1L 3L))) + == [ 5L ] -// general -(4L |> (-) 3L) = 1L + ([] |> Stdlib.List.push (Stdlib.Int64.add 1L (1L + 3L))) == [ 5L ] -([ 5L ] - |> Stdlib.List.head - |> Builtin.unwrap - |> Stdlib.Int64.add_v0 1L - |> (+) 3L - |> (fun x -> if (x + 4L) > 1L then x else (1L + x))) = 9L + ([] |> Stdlib.List.push (Builtin.testRuntimeError "err")) + == Builtin.testDerrorMessage "err" -// lambda in variable -(let x = fun a -> a + 1L in (5L |> x |> x |> (+) 3L)) = 10L + // general + (4L |> (-) 3L) == 1L -(let x = fun a b -> a + 1L in (7L |> x)) = Builtin.testDerrorMessage - "Expected 2 arguments, got 1" + ([ 5L ] + |> Stdlib.List.head + |> Builtin.unwrap + |> Stdlib.Int64.add 1L + |> (+) 3L + |> (fun x -> if (x + 4L) > 1L then x else (1L + x))) + == 9L -// only lambda might be placed into the variable used in the middle of the pipe -(let x = 1L in (5L |> x |> x |> (+) 3L)) = Builtin.testDerrorMessage - "Expected a function value, got something else: 1" + // lambda in variable + (let x = fun a -> a + 1L + (5L |> x |> x |> (+) 3L)) + == 10L -// dict -type Z = { a: List } -type Y = { z: Z } -type X = { y: Y } + (let x = fun a b -> a + 1L + (7L |> x)) + == Builtin.testDerrorMessage "Expected 2 arguments, got 1" + + // only lambda might be placed into the variable used in the middle of the pipe + (let x = 1L + (5L |> x |> x |> (+) 3L)) + == Builtin.testDerrorMessage "Expected a function value, got something else: 1" -(let x = X { y = Y { z = Z { a = [ 1L; 2L; 3L; 4L; 5L ] } } } - (x.y.z.a |> Stdlib.List.length_v0)) = 5L + (let x = X { y = Y { z = Z { a = [ 1L; 2L; 3L; 4L; 5L ] } } } + (x.y.z.a |> Stdlib.List.length)) + == 5L -type MyEnum = A of Int64 * Int64 * Int64 -(33L |> MyEnum.A 21L 42L) = MyEnum.A 33L 21L 42L -(33L |> MyEnum.A(21L, 42L)) = MyEnum.A(33L, 21L, 42L) + (33L |> MyEnum.A(21L, 42L)) == MyEnum.A(33L, 21L, 42L) -(3L |> Stdlib.Result.Result.Ok) = Stdlib.Result.Result.Ok 3L + (3L |> Stdlib.Result.Result.Ok()) == Stdlib.Result.Result.Ok(3L) -(4L |> (+) 3L |> Stdlib.Option.Option.Some) = Stdlib.Option.Option.Some 7L + (4L |> (+) 3L |> Stdlib.Option.Option.Some()) == Stdlib.Option.Option.Some(7L) -(Stdlib.Option.Option.None |> Stdlib.Option.Option.Some) = Stdlib.Option.Option.Some - Stdlib.Option.Option.None + (Stdlib.Option.Option.None() |> Stdlib.Option.Option.Some()) + == Stdlib.Option.Option.Some(Stdlib.Option.Option.None()) -(let x = Stdlib.Option.Option.Some 3L + (let x = Stdlib.Option.Option.Some(3L) - x |> Stdlib.Option.map (fun a -> a) |> Stdlib.Option.map (fun a -> a + 1L)) = Stdlib.Option.Option.Some - 4L + x |> Stdlib.Option.map (fun a -> a) |> Stdlib.Option.map (fun a -> a + 1L)) + == Stdlib.Option.Option.Some(4L) -(let x = fun x -> Stdlib.Option.map x (fun a -> a) + (let x = fun x -> Stdlib.Option.map x (fun a -> a) - (Stdlib.Option.Option.Some 3L) |> x |> Stdlib.Option.map (fun a -> a + 1L)) = Stdlib.Option.Option.Some - 4L + (Stdlib.Option.Option.Some(3L)) |> x |> Stdlib.Option.map (fun a -> a + 1L)) + == Stdlib.Option.Option.Some(4L) -((Stdlib.Option.Option.Some 3L) - |> Stdlib.Option.withDefault_v0 Stdlib.Option.Option.None - |> (+) 3L) = 6L + ((Stdlib.Option.Option.Some(3L)) + |> Stdlib.Option.withDefault Stdlib.Option.Option.None() + |> (+) 3L) + == 6L -((Stdlib.Result.Result.Ok 3L) |> Stdlib.Result.withDefault_v0 0L |> (+) 3L) = 6L + ((Stdlib.Result.Result.Ok(3L)) |> Stdlib.Result.withDefault 0L |> (+) 3L) == 6L -((Stdlib.Result.Result.Error "err") |> Stdlib.Result.withDefault_v0 0L |> (+) 3L) = 3L + ((Stdlib.Result.Result.Error("err")) |> Stdlib.Result.withDefault 0L |> (+) 3L) + == 3L -(let x = fun a -> Stdlib.Result.withDefault_v0 a 1L - (Stdlib.Result.Result.Error "err") |> x |> (+) 3L) = 4L + (let x = fun a -> Stdlib.Result.withDefault a 1L + (Stdlib.Result.Result.Error("err")) |> x |> (+) 3L) + == 4L -(let x = - fun x -> - Stdlib.Option.andThen_v0 (Stdlib.Option.Option.Some x) (fun x -> - Stdlib.Option.Option.Some(1L + x)) + (let x = + fun x -> + Stdlib.Option.andThen (Stdlib.Option.Option.Some(x)) (fun x -> + Stdlib.Option.Option.Some(1L + x)) - 3L |> x) = Stdlib.Option.Option.Some 4L + 3L |> x) + == Stdlib.Option.Option.Some(4L) -(let x = - fun x -> Stdlib.Option.andThen_v0 x (fun x -> Stdlib.Option.Option.Some(1L + x)) + (let x = + fun x -> Stdlib.Option.andThen x (fun x -> Stdlib.Option.Option.Some(1L + x)) - 3L |> Stdlib.Option.Option.Some |> x) = Stdlib.Option.Option.Some 4L + 3L |> Stdlib.Option.Option.Some() |> x) + == Stdlib.Option.Option.Some(4L) -(3L |> Stdlib.Option.Option.Some |> Stdlib.Result.fromOption "test") = Stdlib.Result.Result.Ok - 3L + (3L |> Stdlib.Option.Option.Some() |> Stdlib.Result.fromOption "test") + == Stdlib.Result.Result.Ok(3L) -(Stdlib.Option.Option.None |> Stdlib.Result.fromOption "test") = Stdlib.Result.Result.Error - "test" + (Stdlib.Option.Option.None() |> Stdlib.Result.fromOption "test") + == Stdlib.Result.Result.Error("test") module FnName = (let fn = (fun x -> x + 1L) - 6L |> fn) = 7L + 6L |> fn) + == 7L - (let fn = Stdlib.Int64.add - 3L |> fn 4L) = 7L + // (let fn = Stdlib.Int64.add + // 3L |> fn 4L) + // == 7L - (let fn = Stdlib.Int64.subtract - 11L |> fn 4L) = 7L + // (let fn = Stdlib.Int64.subtract + // 11L |> fn 4L) + // == 7L - (let fn = Stdlib.Int64.max - 3L |> fn 7L) = 7L \ No newline at end of file + // (let fn = Stdlib.Int64.max + // 3L |> fn 7L) + // == 7L \ No newline at end of file diff --git a/backend/testfiles/execution/language/estring.dark b/backend/testfiles/execution/language/estring.dark index aa89aca3f6..80762c0fdd 100644 --- a/backend/testfiles/execution/language/estring.dark +++ b/backend/testfiles/execution/language/estring.dark @@ -1,18 +1,24 @@ -$"""test {"1"}""" = "test 1" +$"""test {"1"}""" == "test 1" -(let one = "1" in $"test {one}") = "test 1" +(let one = "1" + $"test {one}") == "test 1" -(let one = 1.0 in $"test {one}") = Builtin.testDerrorMessage - "Expected String in string interpolation, got 1.0" +(let one = 1.0 + $"test {one}") +== Builtin.testDerrorMessage "Expected String in string interpolation, got 1.0" -(let one = 1L in $"test {one}") = Builtin.testDerrorMessage - "Expected String in string interpolation, got 1" +(let one = 1L + $"test {one}") +== Builtin.testDerrorMessage "Expected String in string interpolation, got 1" (let name = "John" let age = "30" - $"Name: {name}, Age: {age} years old.") = "Name: John, Age: 30 years old." + $"Name: {name}, Age: {age} years old.") +== "Name: John, Age: 30 years old." -(let two = 2L in "test 1" == $"test {one}") = Builtin.testDerrorMessage - "There is no variable named: one" +(let two = 2L + "test 1" == $"test {one}") +== Builtin.testDerrorMessage "There is no variable named: one" -(let one = 1L in $"test {Stdlib.Int64.toString one}") = "test 1" \ No newline at end of file +(let one = 1L + $"test {Stdlib.Int64.toString one}") == "test 1" \ No newline at end of file diff --git a/backend/testfiles/execution/language/evariable.dark b/backend/testfiles/execution/language/evariable.dark index 1c01fa089f..13356c83f4 100644 --- a/backend/testfiles/execution/language/evariable.dark +++ b/backend/testfiles/execution/language/evariable.dark @@ -1,2 +1,3 @@ -myvar = Builtin.testDerrorMessage "There is no variable named: myvar" -(let x = 5L in x) = 5L \ No newline at end of file +myvar == Builtin.testDerrorMessage "There is no variable named: myvar" +(let x = 5L + x) == 5L \ No newline at end of file diff --git a/backend/testfiles/execution/language/type-alias.dark b/backend/testfiles/execution/language/type-alias.dark index f4b5cbb0d6..68f89c5bed 100644 --- a/backend/testfiles/execution/language/type-alias.dark +++ b/backend/testfiles/execution/language/type-alias.dark @@ -1,12 +1,14 @@ // simple alias type Id = String -type Something = { ID: Id; Data: String } -Something { ID = "2"; Data = "test" } = Something { ID = "2"; Data = "test" } +module SimpleAlias = + type Something = { id: Id; data: String } + Something { id = "2"; data = "test" } == Something { id= "2"; data = "test" } -// TODO: would be better if this indicated that it was an Id originally -Something { ID = 2L; Data = "test" } = Builtin.testDerrorMessage - "Something's `ID` field should be a String. However, an Int64 (2) was passed instead.\n\nExpected: ({ ID: Id; ... })\nActual: an Int64: 2" + // TODO: would be better if this indicated that it was an Id originally + Something { id = 2L; data = "test" } + == Builtin.testDerrorMessage + "SimpleAlias.Something's `id` field should be a String. However, an Int64 (2) was passed instead.\n\nExpected: ({ id: Id; ... })\nActual: an Int64: 2" module SimpleRecordAlias = @@ -14,11 +16,11 @@ module SimpleRecordAlias = type MyPerson = Person type MyPerson2 = Person - (MyPerson { name = "test" } == Person { name = "test" }) = true - (MyPerson { name = "test" } == MyPerson2 { name = "test" }) = true + (MyPerson { name = "test" } == Person { name = "test" }) == true + (MyPerson { name = "test" } == MyPerson2 { name = "test" }) == true let getName (p: MyPerson) : String = p.name - getName (MyPerson { name = "test" }) = "test" + getName (MyPerson { name = "test" }) == "test" module SimpleEnumAlias = type UserRole = @@ -29,7 +31,7 @@ module SimpleEnumAlias = type AdminRole = UserRole type GuestRole = UserRole - (GuestRole.Guest == AdminRole.Guest) = true + (GuestRole.Guest() == AdminRole.Guest()) == true module NestedAlias = type UserCredential = (String * Id) @@ -38,9 +40,10 @@ module NestedAlias = let getUserID (credential: UserCredential) : Id = credential |> Stdlib.Tuple2.second - getUserID (("Alice", "EMP123")) = "EMP123" + (getUserID (("Alice", "EMP123"))) == "EMP123" - getUserID (("Alice", 123L)) = Builtin.testDerrorMessage + getUserID (("Alice", 123L)) + == Builtin.testDerrorMessage "NestedAlias.getUserID's return value should be a String. However, an Int64 (123) was returned instead.\n\nExpected: Id\nActual: an Int64: 123" type UserProfile = @@ -54,24 +57,25 @@ module NestedAlias = UserProfile { credential = ("Alice", "EMP123") name = "Alice" } - ) = "Alice" + ) + == "Alice" module ListAlias = type IntegerList = List - let isEmpty (il: IntegerList) : Bool = Stdlib.List.isEmpty_v0 il + let isEmpty (il: IntegerList) : Bool = Stdlib.List.isEmpty il - isEmpty ([]) = true - isEmpty ([ 1L; 2L; 3L ]) = false + isEmpty ([]) == true + isEmpty ([ 1L; 2L; 3L ]) == false module ResultAlias = // result alias type IntResult = Stdlib.Result.Result - let getIntResultValue (ir: IntResult) : Int64 = Stdlib.Result.withDefault_v0 ir 0L + let getIntResultValue (ir: IntResult) : Int64 = Stdlib.Result.withDefault ir 0L - getIntResultValue (Stdlib.Result.Result.Ok 5L) = 5L - getIntResultValue (Stdlib.Result.Result.Error "error") = 0L + getIntResultValue (Stdlib.Result.Result.Ok(5L)) == 5L + getIntResultValue (Stdlib.Result.Result.Error("error")) == 0L module RecordWithTypeArgs = type Inner<'a, 'b> = { a: 'a; b: 'b } @@ -80,19 +84,22 @@ module RecordWithTypeArgs = type Outer2<'b> = Inner let getInnerField (x: Inner<'a, 'b>) : 'b = x.b - getInnerField (Inner { a = "test"; b = 5L }) = 5L - getInnerField (Outer1 { a = "test"; b = 5L }) = 5L - getInnerField (Outer2 { a = "test"; b = 5L }) = 5L - Outer1 { a = "test"; b = 5L } = Inner { a = "test"; b = 5L } - Outer1 { a = "test"; b = 5L } = Outer2 { a = "test"; b = 5L } - - Outer2 { a = 5L; b = 6L } = Builtin.testDerrorMessage + getInnerField (Inner { a = "test"; b = 5L }) == 5L + getInnerField (Outer1 { a = "test"; b = 5L }) == 5L + getInnerField (Outer2 { a = "test"; b = 5L }) == 5L + Outer1 { a = "test"; b = 5L } == Inner { a = "test"; b = 5L } + Outer1 { a = "test"; b = 5L } == Outer2 { a = "test"; b = 5L } + + Outer2 { a = 5L; b = 6L } + == Builtin.testDerrorMessage "RecordWithTypeArgs.Outer2's `a` field should be a String. However, an Int64 (5) was passed instead.\n\nExpected: ({ a: String; ... })\nActual: an Int64: 5" - Outer1 { a = "a"; b = "b" } = Builtin.testDerrorMessage + Outer1 { a = "a"; b = "b" } + == Builtin.testDerrorMessage "RecordWithTypeArgs.Outer1's `b` field should be an Int64. However, a String (\"b\") was passed instead.\n\nExpected: ({ b: Int64; ... })\nActual: a String: \"b\"" - Outer2 { a = 5L; b = 6L } = Builtin.testDerrorMessage + Outer2 { a = 5L; b = 6L } + == Builtin.testDerrorMessage "RecordWithTypeArgs.Outer2's `a` field should be a String. However, an Int64 (5) was passed instead.\n\nExpected: ({ a: String; ... })\nActual: an Int64: 5" module RecordWithTypeArgsDifferentName = @@ -102,12 +109,14 @@ module RecordWithTypeArgsDifferentName = type Outest<'y> = Outer<'y> type MostOutest = Outest // { a: Int64; b: String } - MostOutest { a = 5L; b = "string" } = Inner { a = 5L; b = "string" } + MostOutest { a = 5L; b = "string" } == Inner { a = 5L; b = "string" } - MostOutest { a = "not allowed"; b = "string" } = Builtin.testDerrorMessage + MostOutest { a = "not allowed"; b = "string" } + == Builtin.testDerrorMessage "RecordWithTypeArgsDifferentName.MostOutest's `a` field should be an Int64. However, a String (\"not allow...) was passed instead.\n\nExpected: ({ a: Int64; ... })\nActual: a String: \"not allowed\"" - MostOutest { a = 5L; b = 6L } = Builtin.testDerrorMessage + MostOutest { a = 5L; b = 6L } + == Builtin.testDerrorMessage "RecordWithTypeArgsDifferentName.MostOutest's `b` field should be a String. However, an Int64 (6) was passed instead.\n\nExpected: ({ b: String; ... })\nActual: an Int64: 6" @@ -128,9 +137,10 @@ module RecordWithRecursiveTypeArgs = Stdlib.Result.Result.Ok( Inner { a = 7L - b = Stdlib.Result.Result.Error "test" } + b = Stdlib.Result.Result.Error("test") } ) } - ) } = Alias + ) } + == Alias { a = 5L b = Stdlib.Result.Result.Ok( @@ -140,7 +150,7 @@ module RecordWithRecursiveTypeArgs = Stdlib.Result.Result.Ok( Alias { a = 7L - b = Stdlib.Result.Result.Error "test" } + b = Stdlib.Result.Result.Error("test") } ) } ) } @@ -153,28 +163,31 @@ module EnumWithTypeArgs = type Outer1<'a> = Inner<'a, Int64> type Outer2<'b> = Inner - let getInnerField (x: Inner<'a, 'b>) (default': 'b) : 'b = + //TODO: allow variable_identifier to include ' (e.g: default') + let getInnerField (x: Inner<'a, 'b>) (default: 'b) : 'b = match x with - | A _ -> default' - | B b -> b + | A(_) -> default + | B(b) -> b - getInnerField (Inner.A 5L) 6L = 6L - getInnerField (Inner.B 5L) 6L = 5L - getInnerField (Outer1.A 5L) 6L = 6L - getInnerField (Outer1.B 5L) 6L = 5L - getInnerField (Outer2.A "str") "str2" = "str2" - getInnerField (Outer2.B "str") "str2" = "str" + getInnerField (Inner.A(5L)) 6L == 6L + getInnerField (Inner.B(5L)) 6L == 5L + getInnerField (Outer1.A(5L)) 6L == 6L + getInnerField (Outer1.B(5L)) 6L == 5L + getInnerField (Outer2.A("str")) "str2" == "str2" + getInnerField (Outer2.B("str")) "str2" == "str" - Outer1.A 5L = Inner.A 5L - Outer1.B 5L = Inner.B 5L + Outer1.A(5L) == Inner.A(5L) + Outer1.B(5L) == Inner.B(5L) - Outer2.A "str" = Outer1.A "str" - Outer2.B 5L = Outer1.B 5L + (Outer2.A("str")) == Outer1.A("str") + (Outer2.B(5L)) == Outer1.B(5L) - Outer1.B "b" = Builtin.testDerrorMessage + Outer1.B("b") + == Builtin.testDerrorMessage "EnumWithTypeArgs.Outer1.B's 1st argument should be an Int64. However, a String (\"b\") was passed instead.\n\nExpected: EnumWithTypeArgs.Outer1.B (Int64)\nActual: EnumWithTypeArgs.Outer1.B (String)" - Outer2.A 5L = Builtin.testDerrorMessage + Outer2.A(5L) + == Builtin.testDerrorMessage "EnumWithTypeArgs.Outer2.A's 1st argument should be a String. However, an Int64 (5) was passed instead.\n\nExpected: EnumWithTypeArgs.Outer2.A (String)\nActual: EnumWithTypeArgs.Outer2.A (Int64)" module EnumWithTypeArgsDifferentName = @@ -187,13 +200,15 @@ module EnumWithTypeArgsDifferentName = type Outest<'y> = Outer<'y> type MostOutest = Outest // | A of Int64 | B of String - MostOutest.A 5L = Inner.A 5L - MostOutest.B "test" = Inner.B "test" + MostOutest.A(5L) == Inner.A(5L) + MostOutest.B("test") == Inner.B("test") - MostOutest.A "not allowed" = Builtin.testDerrorMessage + MostOutest.A("not allowed") + == Builtin.testDerrorMessage "EnumWithTypeArgsDifferentName.MostOutest.A's 1st argument should be an Int64. However, a String (\"not allow...) was passed instead.\n\nExpected: EnumWithTypeArgsDifferentName.MostOutest.A (Int64)\nActual: EnumWithTypeArgsDifferentName.MostOutest.A (String)" - MostOutest.B 6L = Builtin.testDerrorMessage + MostOutest.B(6L) + == Builtin.testDerrorMessage "EnumWithTypeArgsDifferentName.MostOutest.B's 1st argument should be a String. However, an Int64 (6) was passed instead.\n\nExpected: EnumWithTypeArgsDifferentName.MostOutest.B (String)\nActual: EnumWithTypeArgsDifferentName.MostOutest.B (Int64)" @@ -204,6 +219,5 @@ module EnumWithRecursiveTypeArgs = type Alias<'x> = Inner<'x> - Alias.B(Stdlib.Result.Result.Ok(Alias.A 5L)) = Inner.B( - Stdlib.Result.Result.Ok(Inner.A 5L) - ) \ No newline at end of file + Alias.B(Stdlib.Result.Result.Ok(Alias.A(5L))) + == Inner.B(Stdlib.Result.Result.Ok(Inner.A(5L))) \ No newline at end of file diff --git a/backend/testfiles/execution/language/type-enum.dark b/backend/testfiles/execution/language/type-enum.dark index 6d079a4a6f..5eb52b763e 100644 --- a/backend/testfiles/execution/language/type-enum.dark +++ b/backend/testfiles/execution/language/type-enum.dark @@ -1,25 +1,28 @@ -Stdlib.Option.Option.None = Stdlib.Option.Option.None +module General = + Stdlib.Option.Option.None() == Stdlib.Option.Option.None() -((Stdlib.List.head []) == Stdlib.Option.Option.None) = true + ((Stdlib.List.head []) == Stdlib.Option.Option.None()) == true -(Stdlib.List.head []) = Stdlib.Option.Option.None + (Stdlib.List.head []) == Stdlib.Option.Option.None() -Stdlib.Result.Result.Ok(Builtin.testRuntimeError "err") = Builtin.testDerrorMessage - "err" + Stdlib.Result.Result.Ok(Builtin.testRuntimeError "err") + == Builtin.testDerrorMessage "err" + + Stdlib.Option.Option.Some(Builtin.testRuntimeError "err") + == Builtin.testDerrorMessage "err" + + Stdlib.Result.Result.Error(Builtin.testRuntimeError "err") + == Builtin.testDerrorMessage "err" -Stdlib.Option.Option.Some(Builtin.testRuntimeError "err") = Builtin.testDerrorMessage - "err" -Stdlib.Result.Result.Error(Builtin.testRuntimeError "err") = Builtin.testDerrorMessage - "err" module Errors = module Builtins = - Stdlib.Option.Option.None 5 = Builtin.testDerrorMessage - "Case `None` expected 0 fields but got 1" + Stdlib.Option.Option.None(5L) + == Builtin.testDerrorMessage "Case `None` expected 0 fields but got 1" - Stdlib.Option.Option.Some(5, 6) = Builtin.testDerrorMessage - "Case `Some` expected 1 fields but got 2" + Stdlib.Option.Option.Some(5L, 6L) + == Builtin.testDerrorMessage "Case `Some` expected 1 fields but got 2" module User = type MyEnum = @@ -27,23 +30,25 @@ module Errors = | B | C of String - MyEnum.D = Builtin.testDerrorMessage - "There is no case named `D` in Errors.User.MyEnum" + MyEnum.D() + == Builtin.testDerrorMessage "There is no case named `D` in Errors.User.MyEnum" - MyEnum.C = Builtin.testDerrorMessage "Case `C` expected 1 fields but got 0" - MyEnum.B 5L = Builtin.testDerrorMessage "Case `B` expected 0 fields but got 1" + MyEnum.C() == Builtin.testDerrorMessage "Case `C` expected 1 fields but got 0" + MyEnum.B(5L) == Builtin.testDerrorMessage "Case `B` expected 0 fields but got 1" - (match MyEnum.C "test" with - | C v -> v) = "test" + (match MyEnum.C("test") with + | C(v) -> v) + == "test" // TYPESCLEANUP // (match MyEnum.C "test" with | C -> v) = Builtin.testRuntimeError "TODO" // (match MyEnum.C "test" with | D -> "PACKAGE.Darklang.Stdlib.Result.Result.Ok" | C _ -> v) = Builtin.testRuntimeError "TODO" // (match MyEnum.C "test" with | 5 -> "PACKAGE.Darklang.Stdlib.Result.Result.Ok" | C _ -> v) = Builtin.testRuntimeError "TODO" - (MyEnum.C 5L) = Builtin.testDerrorMessage - "Errors.User.MyEnum.C's 1st argument should be a String. However, an Int64 (5) was passed instead. + (MyEnum.C(5L)) + == Builtin.testDerrorMessage + """Errors.User.MyEnum.C's 1st argument should be a String. However, an Int64 (5) was passed instead. Expected: Errors.User.MyEnum.C (String) -Actual: Errors.User.MyEnum.C (Int64)" +Actual: Errors.User.MyEnum.C (Int64)""" module Simple = @@ -51,27 +56,29 @@ module Simple = | A | B - (let a = AorB.A - let b = AorB.B - a == b) = false + (let a = AorB.A() + let b = AorB.B() + a == b) + == false - (let a1 = AorB.A - let a2 = AorB.A - a1 == a2) = true + (let a1 = AorB.A() + let a2 = AorB.A() + a1 == a2) + == true - (AorB.A == AorB.A) = true - (AorB.A == AorB.B) = false + (AorB.A() == AorB.A()) == true + (AorB.A() == AorB.B()) == false - Stdlib.List.unique_v0 [ AorB.A; AorB.B; AorB.A; AorB.A; AorB.B ] = [ AorB.A - AorB.B ] + Stdlib.List.unique [ AorB.A(); AorB.B(); AorB.A(); AorB.A(); AorB.B() ] + == [ AorB.A(); AorB.B() ] module EnumReference = type CorD = | C of Int64 | D of AorB - (CorD.C 5L != CorD.D AorB.B) = true - (CorD.D AorB.A == CorD.D AorB.A) = true + (CorD.C(5L) != CorD.D(AorB.B())) == true + (CorD.D(AorB.A()) == CorD.D(AorB.A())) == true module MixedCases = type EnumOfMixedCases = @@ -80,46 +87,52 @@ module MixedCases = | Y of i: Int64 | Z of c: String * i: Int64 - (EnumOfMixedCases.W == (EnumOfMixedCases.Y 1L)) = false - (EnumOfMixedCases.Y 1L == EnumOfMixedCases.Y 1L) = true + (EnumOfMixedCases.W() == (EnumOfMixedCases.Y(1L))) == false + (EnumOfMixedCases.Y(1L) == EnumOfMixedCases.Y(1L)) == true - EnumOfMixedCases.X 1L = Builtin.testDerrorMessage - "MixedCases.EnumOfMixedCases.X's 1st argument should be a String. However, an Int64 (1) was passed instead.\n\nExpected: MixedCases.EnumOfMixedCases.X (String)\nActual: MixedCases.EnumOfMixedCases.X (Int64)" + EnumOfMixedCases.X(1L) + == Builtin.testDerrorMessage + "MixedCases.EnumOfMixedCases.X's 1st argument should be a String. However, an Int64 (1) was passed instead.\n\nExpected: MixedCases.EnumOfMixedCases.X (String)\nActual: MixedCases.EnumOfMixedCases.X (Int64)" - EnumOfMixedCases.Y "test" = Builtin.testDerrorMessage + EnumOfMixedCases.Y("test") + == Builtin.testDerrorMessage "MixedCases.EnumOfMixedCases.Y's 1st argument should be an Int64. However, a String (\"test\") was passed instead.\n\nExpected: MixedCases.EnumOfMixedCases.Y (Int64)\nActual: MixedCases.EnumOfMixedCases.Y (String)" - EnumOfMixedCases.Z 1L = Builtin.testDerrorMessage - "Case `Z` expected 2 fields but got 1" + EnumOfMixedCases.Z(1L) == (Builtin.testDerrorMessage "Case `Z` expected 2 fields but got 1") // Test ordering of evaluation - EnumOfMixedCases.Z(Builtin.testRuntimeError "1", Builtin.testRuntimeError "2") = Builtin.testDerrorMessage - "1" + EnumOfMixedCases.Z(Builtin.testRuntimeError "1", Builtin.testRuntimeError "2") + == Builtin.testDerrorMessage "1" (let values = - [ EnumOfMixedCases.W - EnumOfMixedCases.X "testX" + [ EnumOfMixedCases.W() + EnumOfMixedCases.X("testX") EnumOfMixedCases.Y(5L) EnumOfMixedCases.Z("testZ", 2L) ] match Stdlib.List.getAt values 3L with - | Some z -> Stdlib.Result.Result.Ok z - | None -> Stdlib.Result.Result.Error "Failure") = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Ok(EnumOfMixedCases.Z("testZ", 2L)) - - ([ EnumOfMixedCases.W - EnumOfMixedCases.X "testX" + | Some(z) -> Stdlib.Result.Result.Ok(z) + | None() -> Stdlib.Result.Result.Error("Failure")) + == PACKAGE.Darklang.Stdlib.Result.Result.Ok(EnumOfMixedCases.Z("testZ", 2L)) + + // if I uncomment this, only 25 tests will run + // no parsing errors that I can see + ([ EnumOfMixedCases.W() + EnumOfMixedCases.X("testX") EnumOfMixedCases.Y(5L) - EnumOfMixedCases.Z("testZ", 2L) ] - |> Stdlib.List.map_v0 (fun v -> - match v with - | X s -> "X " ++ s - | Z(s, _i) -> "Z " ++ s - | Y y -> "Y " ++ (Stdlib.Int64.toString_v0 y) - | W -> "a simple W")) = [ "a simple W"; "X testX"; "Y 5"; "Z testZ" ] + EnumOfMixedCases.Z("testZ", 2L)] + |> Stdlib.List.map + (fun v -> + match v with + | X(s) -> + "X " ++ s + | Z(s, _i) -> + "Z " ++ s + | Y(y) -> + "Y " ++ (Stdlib.Int64.toString y) + | W() -> "a simple W" + ) + ) + == [ "a simple W"; "X testX"; "Y 5"; "Z testZ" ] module TuplesVsNonTuples = type Tuples = @@ -127,16 +140,19 @@ module TuplesVsNonTuples = | Tuple of (String * Int64) (match Tuples.NotTuple("printer broke", 7L) with - | NotTuple(reason, 7L) -> reason) = "printer broke" + | NotTuple(reason, 7L) -> reason + ) + == "printer broke" - (Tuples.NotTuple(("printer broke", 7L))) = Builtin.testDerrorMessage - "Case `NotTuple` expected 2 fields but got 1" + (Tuples.NotTuple(("printer broke", 7L))) + == Builtin.testDerrorMessage "Case `NotTuple` expected 2 fields but got 1" (match Tuples.Tuple(("printer broke", 7L)) with - | Tuple((reason, 7L)) -> reason) = "printer broke" + | Tuple((reason, 7L)) -> reason) + == "printer broke" - Tuples.Tuple("printer broke", 7L) = Builtin.testDerrorMessage - "Case `Tuple` expected 1 fields but got 2" + Tuples.Tuple("printer broke", 7L) + == Builtin.testDerrorMessage "Case `Tuple` expected 1 fields but got 2" module Recursive = @@ -144,10 +160,11 @@ module Recursive = | Leaf | Node of Tree * Tree - Tree.Node(Tree.Leaf, Tree.Leaf) = Tree.Node(Tree.Leaf, Tree.Leaf) + Tree.Node(Tree.Leaf(), Tree.Leaf()) == Tree.Node(Tree.Leaf(), Tree.Leaf()) - (Tree.Node(Tree.Leaf, Tree.Leaf) - == Tree.Node(Tree.Leaf, Tree.Node(Tree.Leaf, Tree.Leaf))) = false + (Tree.Node(Tree.Leaf(), Tree.Leaf()) + == Tree.Node(Tree.Leaf(), Tree.Node(Tree.Leaf(), Tree.Leaf()))) + == false module Polymorphism = // Define a red-black tree @@ -160,19 +177,21 @@ module Polymorphism = | Node of color: Color * left: RBTree<'a> * value: 'a * right: RBTree<'a> let singleton (value: 'a) : RBTree<'a> = - RBTree.Node(Color.Red, RBTree.Empty, value, RBTree.Empty) + RBTree.Node(Color.Red(), RBTree.Empty(), value, RBTree.Empty()) let insert' (tree: RBTree<'a>) (value: 'a) (cmp: ('a * 'a) -> Int64) : RBTree<'a> = match tree with - | Empty -> singleton value + | Empty() -> Polymorphism.singleton value | Node(color, left, v, right) -> // CLEANUP we should allow cmp to call two arguments, and not use a weird // tuple-pipe thing - let c = (value, v) |> cmp + let c = + (value, v) + |> cmp if c < 0L then RBTree.Node(color, insert' left value cmp, v, right) - elif c > 0L then + else if c > 0L then RBTree.Node(color, left, v, insert' right value cmp) else RBTree.Node(color, left, value, right) @@ -181,25 +200,30 @@ module Polymorphism = insert' tree value cmp let ofList (values: List<'a>) (cmp: ('a * 'a) -> Int64) : RBTree<'a> = - Stdlib.List.fold_v0 values RBTree.Empty (fun tree value -> insert tree value cmp) + Stdlib.List.fold values RBTree.Empty() (fun tree value -> insert tree value cmp) let toList' (tree: RBTree<'a>) (acc: List<'a>) : List<'a> = match tree with - | Empty -> acc + | Empty() -> acc | Node(_, left, value, right) -> toList' left (Stdlib.List.push (toList' right acc) value) - let toList (tree: RBTree<'a>) : List<'a> = toList' tree [] + let toList (tree: RBTree<'a>) : List<'a> = + toList' tree [] // CLEANUP: we should support tuple destructuring in lambdas // i.e. update to `fun (x, y) -> ...` - (let intCmp = - fun pair -> - let (x, y) = pair - - if x < y then -1L - elif x > y then 1L - else 0L - - ([ 1L; -2L; 5L; 3L ] |> ofList intCmp |> toList) - == ([ 3L; 5L; -2L; 1L ] |> ofList intCmp |> toList)) = true \ No newline at end of file + // (let intCmp = + // fun pair -> + // let (x, y) = pair + + // if x < y then + // -1L + // else if x > y then + // 1L + // else + // 0L + + // ([ 1L; -2L; 5L; 3L ] |> ofList intCmp |> toList) + // == ([ 3L; 5L; -2L; 1L ] |> ofList intCmp |> toList)) + // == true \ No newline at end of file diff --git a/backend/testfiles/execution/language/type-record.dark b/backend/testfiles/execution/language/type-record.dark index 811a4352a5..b9c1def219 100644 --- a/backend/testfiles/execution/language/type-record.dark +++ b/backend/testfiles/execution/language/type-record.dark @@ -6,17 +6,19 @@ type AnEnum = | B | C -Cols2 { col1 = 1L; col2 = 3L } = Cols2 { col1 = 1L; col2 = 3L } +module General = + Cols2 { col1 = 1L; col2 = 3L } == Cols2 { col1 = 1L; col2 = 3L } -Cols2 - { col1 = 2L - col2 = Builtin.testRuntimeError "test" } = Builtin.testDerrorMessage "test" + Cols2 + { col1 = 2L + col2 = Builtin.testRuntimeError "test" } + == Builtin.testDerrorMessage "test" module WithTypeArgs = type Owner<'a> = { item: 'a } type CoOwner<'a> = Owner<'a> - Owner { item = 5L } = CoOwner { item = 5L } + Owner { item = 5L } == CoOwner { item = 5L } type C<'c> = { v: 'c } type B<'b> = { c: C<'b> } @@ -24,88 +26,94 @@ module WithTypeArgs = let getC (a: A) : Int64 = a.b.c.v - getC (A { b = B { c = C { v = 5L } } }) = 5L + getC (A { b = B { c = C { v = 5L } } }) == 5L module InvalidCols = - Cols1 { col1 = 1L; col1 = 2L } = Builtin.testDerrorMessage - "Duplicate field `col1` in Cols1" + Cols1 { col1 = 1L; col1 = 2L } + == Builtin.testDerrorMessage "Duplicate field `col1` in Cols1" - Cols2 { col1 = 2L; ___ = 3L } = Builtin.testDerrorMessage - "Unexpected field `` in Cols2" + //todo: recheck this test + Cols2 { col1 = 2L; ___ = 3L } + == Builtin.testDerrorMessage "Unexpected field `___` in Cols2" - Cols2 { col1 = 2L } = Builtin.testDerrorMessage "Missing field `col2` in Cols2" + Cols2 { col1 = 2L } == Builtin.testDerrorMessage "Missing field `col2` in Cols2" - Cols2 { col1 = 2L; other = 3L } = Builtin.testDerrorMessage - "Unexpected field `other` in Cols2" + Cols2 { col1 = 2L; other = 3L } + == Builtin.testDerrorMessage "Unexpected field `other` in Cols2" - Cols2 { col1 = 2L; col2 = 3L; col3 = 4L } = Builtin.testDerrorMessage - "Unexpected field `col3` in Cols2" + Cols2 { col1 = 2L; col2 = 3L; col3 = 4L } + == Builtin.testDerrorMessage "Unexpected field `col3` in Cols2" - Cols1 { col1 = "" } = Builtin.testDerrorMessage + Cols1 { col1 = "" } + == Builtin.testDerrorMessage "Cols1's `col1` field should be an Int64. However, a String (\"\") was passed instead.\n\nExpected: ({ col1: Int64; ... })\nActual: a String: \"\"" module InvalidType = - MyNonExistantType { col1 = 2L } = Builtin.testDerrorMessage - "There is no type named MyNonExistantType" + MyNonExistantType { col1 = 2L } + == Builtin.testDerrorMessage "There is no type named MyNonExistantType" - AnEnum { col1 = 2L } = Builtin.testDerrorMessage - "Expected a record but AnEnum is an enum" + AnEnum { col1 = 2L } + == Builtin.testDerrorMessage "Expected a record but AnEnum is an enum" module Polymorphism = type MyRecord<'a> = { col1: 'a; col2: Int64 } - (MyRecord { col1 = (); col2 = 1L }).col2 = 1L + (MyRecord { col1 = (); col2 = 1L }).col2 == 1L (MyRecord - { col1 = Stdlib.Option.Option.Some(Stdlib.Result.Result.Ok 1L) - col2 = 1L }) - .col1 = Stdlib.Option.Option.Some(Stdlib.Result.Result.Ok 1L) + { col1 = Stdlib.Option.Option.Some(Stdlib.Result.Result.Ok(1L)) + col2 = 1L }).col1 + == Stdlib.Option.Option.Some(Stdlib.Result.Result.Ok(1L)) module Nested = type NestedRecordA = { col1: Int64 } type NestedRecordB = { col1: NestedRecordA } - (NestedRecordB { col1 = NestedRecordA { col1 = 1L } }).col1.col1 = 1L + (NestedRecordB { col1 = NestedRecordA { col1 = 1L } }).col1.col1 == 1L module Update = type RecordForUpdate = { x: Int64; y: Int64 } type RecordForUpdateMultipe = { x: Int64; y: Int64; z: Int64 } - ({ RecordForUpdate { x = 4L; y = 1L } with - y = 2L }) = RecordForUpdate { x = 4L; y = 2L } + ({ RecordForUpdate { x = 4L; y = 1L } with y = 2L }) + == RecordForUpdate { x = 4L; y = 2L } - (let myRec = RecordForUpdate { x = 4L; y = 1L } in { myRec with y = 2L }) = RecordForUpdate - { x = 4L; y = 2L } + (let myRec = RecordForUpdate { x = 4L; y = 1L } + { myRec with y = 2L }) + == RecordForUpdate { x = 4L; y = 2L } - (let myRec = RecordForUpdate { x = 4L; y = 1L } in { myRec with y = 22L; y = 42L }) = RecordForUpdate - { x = 4L; y = 42L } + (let myRec = RecordForUpdate { x = 4L; y = 1L } + { myRec with y = 22L; y = 42L }) + == RecordForUpdate { x = 4L; y = 42L } (let myRec = RecordForUpdateMultipe { x = 4L; y = 1L; z = 0L } - { myRec with y = 2L; z = 42L }) = RecordForUpdateMultipe - { x = 4L; y = 2L; z = 42L } + { myRec with y = 2L; z = 42L }) + == RecordForUpdateMultipe { x = 4L; y = 2L; z = 42L } (let myRec = RecordForUpdateMultipe { x = 4L; y = 1L; z = 0L } - { myRec with z = 3L; x = 42L }) = RecordForUpdateMultipe - { x = 42L; y = 1L; z = 3L } + { myRec with z = 3L; x = 42L }) + == RecordForUpdateMultipe { x = 42L; y = 1L; z = 3L } (let myRec = RecordForUpdateMultipe { x = 4L; y = 1L; z = 0L } - { myRec with z = 3L; x = 42L; y = 11L }) = RecordForUpdateMultipe - { x = 42L; y = 11L; z = 3L } + { myRec with z = 3L; x = 42L; y = 11L }) + == RecordForUpdateMultipe { x = 42L; y = 11L; z = 3L } module Invalid = (let myRec = RecordForUpdateMultipe { x = 4L; y = 1L; z = 0L } - - { myRec with - z = 3L - x = 42L - y = 11L - p = 10L }) = Builtin.testDerrorMessage - "Unexpected field `p` in Update.RecordForUpdateMultipe" - - (let myRec = RecordForUpdate { x = 4L; y = 1L } in { myRec with other = 2L }) = Builtin.testDerrorMessage - "Unexpected field `other` in Update.RecordForUpdate" - - (let myRec = RecordForUpdate { x = 4L; y = 1L } in { myRec with y = "2" }) = Builtin.testDerrorMessage + { myRec with + z = 3L + x = 42L + y = 11L + p = 10L }) + == Builtin.testDerrorMessage "Unexpected field `p` in Update.RecordForUpdateMultipe" + + (let myRec = RecordForUpdate { x = 4L; y = 1L } + { myRec with other = 2L }) + == Builtin.testDerrorMessage "Unexpected field `other` in Update.RecordForUpdate" + + (let myRec = RecordForUpdate { x = 4L; y = 1L } + { myRec with y = "2" }) + == Builtin.testDerrorMessage "Update.RecordForUpdate's `y` field should be an Int64. However, a String (\"2\") was passed instead.\n\nExpected: ({ y: Int64; ... })\nActual: a String: \"2\"" \ No newline at end of file diff --git a/backend/testfiles/execution/stdlib/alt-json.dark b/backend/testfiles/execution/stdlib/alt-json.dark index 69c1cc0734..c8e95dd54d 100644 --- a/backend/testfiles/execution/stdlib/alt-json.dark +++ b/backend/testfiles/execution/stdlib/alt-json.dark @@ -20,34 +20,34 @@ let format (json: Json) : String = Stdlib.AltJson.format json let parsedOk (json: Json) : Stdlib.Result.Result = - Stdlib.Result.Result.Ok json + Stdlib.Result.Result.Ok(json) let parseError (err: ParseError) : Stdlib.Result.Result = - Stdlib.Result.Result.Error err + Stdlib.Result.Result.Error(err) // // tests module Null = - format Json.Null = "null" - parse "null" = parsedOk Json.Null + format Json.Null() == "null" + parse "null" == parsedOk Json.Null() - parse "NULL" = parseError ParseError.NotJson - parse "Null" = parseError ParseError.NotJson - parse "unit" = parseError ParseError.NotJson - parse "()" = parseError ParseError.NotJson - parse "" = parseError ParseError.NotJson + parse "NULL" == parseError ParseError.NotJson() + parse "Null" == parseError ParseError.NotJson() + parse "unit" == parseError ParseError.NotJson() + parse "()" == parseError ParseError.NotJson() + parse "" == parseError ParseError.NotJson() module Bool = - format (Json.Bool true) = "true" - format (Json.Bool false) = "false" - parse "true" = parsedOk (Json.Bool true) - parse "false" = parsedOk (Json.Bool false) + format (Json.Bool(true)) == "true" + format (Json.Bool(false)) == "false" + parse "true" == parsedOk (Json.Bool(true)) + parse "false" == parsedOk (Json.Bool(false)) - parse "False" = parseError ParseError.NotJson - parse "f" = parseError ParseError.NotJson - parse "True" = parseError ParseError.NotJson - parse "t" = parseError ParseError.NotJson + parse "False" == parseError ParseError.NotJson() + parse "f" == parseError ParseError.NotJson() + parse "True" == parseError ParseError.NotJson() + parse "t" == parseError ParseError.NotJson() module Number = @@ -56,29 +56,28 @@ module Number = // - NaN // - huge numbers (esp at Float's limits) // - other notation - format (Json.Number 0.0) = "0" // TODO: any reason we need to make this `0.0`? - parse "0" = parsedOk (Json.Number 0.0) + format (Json.Number(0.0)) == "0" // TODO: any reason we need to make this `0.0`? + parse "0" == parsedOk (Json.Number(0.0)) - format (Json.Number 0.1) = "0.1" - parse "0.1" = parsedOk (Json.Number 0.1) + format (Json.Number(0.1)) == "0.1" + parse "0.1" == parsedOk (Json.Number(0.1)) - format (Json.Number -1.0) = "-1" - parse "-1" = parsedOk (Json.Number -1.0) - - format (Json.Number -1337.0) = "-1337" - parse "-1337" = parsedOk (Json.Number -1337.0) + format (Json.Number(-1.0)) == "-1" + parse "-1" == parsedOk (Json.Number(-1.0)) + format (Json.Number(-1337.0)) == "-1337" + parse "-1337" == parsedOk (Json.Number(-1337.0)) module String = // TODO: // - strings with quotes in them // - ' instead of " - format (Json.String "hi") = "\"hi\"" - parse "\"hi\"" = parsedOk (Json.String "hi") + format (Json.String("hi")) == "\"hi\"" + parse "\"hi\"" == parsedOk (Json.String("hi")) - parse "hi" = parseError ParseError.NotJson - parse "\'hi\'" = parseError ParseError.NotJson + parse "hi" == parseError ParseError.NotJson() + parse "\'hi\'" == parseError ParseError.NotJson() module Array = @@ -86,40 +85,41 @@ module Array = // - huge arrays // empty - format (Json.Array []) = "[]" - parse "[]" = parsedOk (Json.Array []) + format (Json.Array([])) == "[]" + parse "[]" == parsedOk (Json.Array([])) // simple single null - format (Json.Array [ Json.Null ]) = "[null]" - parse "[ null ]" = parsedOk (Json.Array [ Json.Null ]) + format (Json.Array([ Json.Null() ])) == "[null]" + parse "[ null ]" == parsedOk (Json.Array([ Json.Null() ])) // first fibonnaci numbers format ( Json.Array - [ Json.Number 0.0 - Json.Number 1.0 - Json.Number 1.0 - Json.Number 2.0 - Json.Number 3.0 - Json.Number 5.0 - Json.Number 8.0 - Json.Number 13.0 - Json.Number 21.0 - Json.Number 34.0 ] - ) = "[0,1,1,2,3,5,8,13,21,34]" - - parse "[0, 1, 1, 2, 3, 5, 8, 13, 21, 34]" = parsedOk ( - Json.Array - [ Json.Number 0.0 - Json.Number 1.0 - Json.Number 1.0 - Json.Number 2.0 - Json.Number 3.0 - Json.Number 5.0 - Json.Number 8.0 - Json.Number 13.0 - Json.Number 21.0 - Json.Number 34.0 ] + ([ Json.Number(0.0) + Json.Number(1.0) + Json.Number(1.0) + Json.Number(2.0) + Json.Number(3.0) + Json.Number(5.0) + Json.Number(8.0) + Json.Number(13.0) + Json.Number(21.0) + Json.Number(34.0) ]) + ) == "[0,1,1,2,3,5,8,13,21,34]" + + parse "[0, 1, 1, 2, 3, 5, 8, 13, 21, 34]" == parsedOk ( + Json.Array( + [ Json.Number(0.0) + Json.Number(1.0) + Json.Number(1.0) + Json.Number(2.0) + Json.Number(3.0) + Json.Number(5.0) + Json.Number(8.0) + Json.Number(13.0) + Json.Number(21.0) + Json.Number(34.0) ] + ) ) // nested arrays @@ -127,66 +127,68 @@ module Array = """ [ [1, 2, 3], [4, 5, 6], - [7, 8, 9] ]""" = parsedOk ( - Json.Array - [ Json.Array [ Json.Number 1.0; Json.Number 2.0; Json.Number 3.0 ] - Json.Array [ Json.Number 4.0; Json.Number 5.0; Json.Number 6.0 ] - Json.Array [ Json.Number 7.0; Json.Number 8.0; Json.Number 9.0 ] ] + [7, 8, 9] ]""" + == parsedOk ( + Json.Array( + [ Json.Array([ Json.Number(1.0); Json.Number(2.0); Json.Number(3.0) ]) + Json.Array([ Json.Number(4.0); Json.Number(5.0); Json.Number(6.0) ]) + Json.Array([ Json.Number(7.0); Json.Number(8.0); Json.Number(9.0) ]) ] + ) ) format ( - Json.Array - [ Json.Array [ Json.Number 1.0; Json.Number 2.0; Json.Number 3.0 ] - Json.Array [ Json.Number 4.0; Json.Number 5.0; Json.Number 6.0 ] - Json.Array [ Json.Number 7.0; Json.Number 8.0; Json.Number 9.0 ] ] - ) = "[[1,2,3],[4,5,6],[7,8,9]]" + Json.Array( + [ Json.Array([ Json.Number(1.0); Json.Number(2.0); Json.Number(3.0) ]) + Json.Array([ Json.Number(4.0); Json.Number(5.0); Json.Number(6.0) ]) + Json.Array([ Json.Number(7.0); Json.Number(8.0); Json.Number(9.0) ]) ] + ) + ) == "[[1,2,3],[4,5,6],[7,8,9]]" // mixed types - format (Json.Array [ Json.Null; Json.Number 1.2 ]) = "[null,1.2]" - - parse "[ null, 1.2 ]" = parsedOk (Json.Array [ Json.Null; Json.Number 1.2 ]) + format (Json.Array([ Json.Null(); Json.Number(1.2) ])) == "[null,1.2]" + parse "[ null, 1.2 ]" == (parsedOk (Json.Array([ Json.Null(); Json.Number(1.2) ]))) module Object = // blank - format (Json.Object []) = """{}""" - parse """{}""" = parsedOk (Json.Object []) + (format (Json.Object([]))) == """{}""" + (parse """{}""") == parsedOk (Json.Object([])) // single name - format (Json.Object [ ("n", Json.Null) ]) = """{"n":null}""" + format (Json.Object([ ("n", Json.Null()) ])) == """{"n":null}""" - parse """{ "n": null }""" = parsedOk (Json.Object[("n", Json.Null)]) + (parse """{ "n": null }""") == parsedOk (Json.Object([ ("n", Json.Null()) ])) // dupe name - parse """{ "n": null, "n": 1 }""" = parsedOk ( - Json.Object [ ("n", Json.Null); ("n", Json.Number 1.0) ] - ) + (parse """{ "n": null, "n": 1 }""") + == parsedOk (Json.Object([ ("n", Json.Null()); ("n", Json.Number(1.0)) ])) - format (Json.Object [ ("n", Json.Null); ("n", Json.Number 1.0) ]) = """{"n":null,"n":1}""" + format (Json.Object([ ("n", Json.Null()); ("n", Json.Number(1.0)) ])) + == """{"n":null,"n":1}""" // blank name - format (Json.Object [ ("", Json.Null) ]) = """{"":null}""" + format (Json.Object([ ("", Json.Null()) ])) == """{"":null}""" - parse """{ "": null }""" = parsedOk (Json.Object[("", Json.Null)]) + parse """{ "": null }""" == parsedOk (Json.Object([ ("", Json.Null()) ])) // name with newline // TODO not sure what's right here - //format (Json.Object [ ("a\nb", Json.Null) ]) = "{\"a\nb\": null}" - // parse "{\"a\nb\": null}" = parsedOk (Json.Object [ ("a\nb", Json.Null) ]) + // format (Json.Object([ ("a\nb", Json.Null()) ])) == "{\"a\nb\": null}" + // parse "{\"a\nb\": null}" == parsedOk (Json.Object([ ("a\nb", Json.Null()) ])) module Errors = // names must be strings - parse """{ 1: 1}""" = parseError ParseError.NotJson + parse """{ 1: 1}""" == parseError ParseError.NotJson() - parse """{ null: 1}""" = parseError ParseError.NotJson + parse """{ null: 1}""" == parseError ParseError.NotJson() // names must be in quotes - parse """{ invalidName: 1}""" = parseError ParseError.NotJson + parse """{ invalidName: 1}""" == parseError ParseError.NotJson() // ..._double_ quotes - parse """{ 'invalidName': 1}""" = parseError ParseError.NotJson \ No newline at end of file + parse """{ 'invalidName': 1}""" == parseError ParseError.NotJson() \ No newline at end of file diff --git a/backend/testfiles/execution/stdlib/base64.dark b/backend/testfiles/execution/stdlib/base64.dark index bc4a87d8fc..58c3839433 100644 --- a/backend/testfiles/execution/stdlib/base64.dark +++ b/backend/testfiles/execution/stdlib/base64.dark @@ -1,119 +1,121 @@ // TODO: try decoding values with incorrect padding -Stdlib.Base64.decode "white space" = Stdlib.Result.Result.Error - "Not a valid base64 string" +Stdlib.Base64.decode "white space" +== Stdlib.Result.Result.Error("Not a valid base64 string") -Stdlib.Base64.decode "Kw" = Stdlib.Result.Result.Ok(Stdlib.String.toBytes_v0 "+") +Stdlib.Base64.decode "Kw" == Stdlib.Result.Result.Ok(Stdlib.String.toBytes "+") -Stdlib.Base64.decode "yLo" = Stdlib.Result.Result.Ok(Stdlib.String.toBytes_v0 "Ⱥ") +Stdlib.Base64.decode "yLo" == Stdlib.Result.Result.Ok(Stdlib.String.toBytes "Ⱥ") -Stdlib.Base64.decode "xbzDs8WCdw" = Stdlib.Result.Result.Ok( - Stdlib.String.toBytes_v0 "żółw" -) +Stdlib.Base64.decode "xbzDs8WCdw" +== Stdlib.Result.Result.Ok(Stdlib.String.toBytes "żółw") -Stdlib.Base64.decode "LyotKygmQDk4NTIx" = Stdlib.Result.Result.Ok( - Stdlib.String.toBytes_v0 "/*-+(&@98521" -) +Stdlib.Base64.decode "LyotKygmQDk4NTIx" +== Stdlib.Result.Result.Ok(Stdlib.String.toBytes "/*-+(&@98521") -Stdlib.Base64.decode "illegal-chars&@:" = Stdlib.Result.Result.Error - "Not a valid base64 string" +Stdlib.Base64.decode "illegal-chars&@:" +== Stdlib.Result.Result.Error("Not a valid base64 string") -Stdlib.Base64.decode "x" = Stdlib.Result.Result.Error "Not a valid base64 string" +Stdlib.Base64.decode "x" +== Stdlib.Result.Result.Error("Not a valid base64 string") // empty case -Stdlib.Base64.decode "" = Stdlib.Result.Result.Ok(Stdlib.String.toBytes_v0 "") +Stdlib.Base64.decode "" == Stdlib.Result.Result.Ok(Stdlib.String.toBytes "") // Test cases from the spec with padding added -Stdlib.Base64.decode "Zg" = Stdlib.Result.Result.Ok(Stdlib.String.toBytes_v0 "f") +Stdlib.Base64.decode "Zg" == Stdlib.Result.Result.Ok(Stdlib.String.toBytes "f") -Stdlib.Base64.decode "Zg==" = Stdlib.Result.Result.Ok(Stdlib.String.toBytes_v0 "f") +Stdlib.Base64.decode "Zg==" +== Stdlib.Result.Result.Ok(Stdlib.String.toBytes "f") -Stdlib.Base64.decode "Zm8" = Stdlib.Result.Result.Ok(Stdlib.String.toBytes_v0 "fo") +Stdlib.Base64.decode "Zm8" +== Stdlib.Result.Result.Ok(Stdlib.String.toBytes "fo") -Stdlib.Base64.decode "Zm8=" = Stdlib.Result.Result.Ok(Stdlib.String.toBytes_v0 "fo") +Stdlib.Base64.decode "Zm8=" +== Stdlib.Result.Result.Ok(Stdlib.String.toBytes "fo") -Stdlib.Base64.decode "Zm9v" = Stdlib.Result.Result.Ok(Stdlib.String.toBytes_v0 "foo") +Stdlib.Base64.decode "Zm9v" +== Stdlib.Result.Result.Ok(Stdlib.String.toBytes "foo") -Stdlib.Base64.decode "Zm9vYg" = Stdlib.Result.Result.Ok( - Stdlib.String.toBytes_v0 "foob" -) +Stdlib.Base64.decode "Zm9vYg" +== Stdlib.Result.Result.Ok(Stdlib.String.toBytes "foob") -Stdlib.Base64.decode "Zm9vYg==" = Stdlib.Result.Result.Ok( - Stdlib.String.toBytes_v0 "foob" -) +Stdlib.Base64.decode "Zm9vYg==" +== Stdlib.Result.Result.Ok(Stdlib.String.toBytes "foob") -Stdlib.Base64.decode "Zm9vYmE" = Stdlib.Result.Result.Ok( - Stdlib.String.toBytes_v0 "fooba" -) +Stdlib.Base64.decode "Zm9vYmE" +== Stdlib.Result.Result.Ok(Stdlib.String.toBytes "fooba") -Stdlib.Base64.decode "Zm9vYmE=" = Stdlib.Result.Result.Ok( - Stdlib.String.toBytes_v0 "fooba" -) +Stdlib.Base64.decode "Zm9vYmE=" +== Stdlib.Result.Result.Ok(Stdlib.String.toBytes "fooba") -Stdlib.Base64.decode "Zm9vYmFy" = Stdlib.Result.Result.Ok( - Stdlib.String.toBytes_v0 "foobar" -) +Stdlib.Base64.decode "Zm9vYmFy" +== Stdlib.Result.Result.Ok(Stdlib.String.toBytes "foobar") // "Impossible cases" from apache // https://commons.apache.org/proper/commons-codec/xref-test/org/apache/commons/codec/binary/Base64Test.html -Stdlib.Base64.decode "ZE==" = Stdlib.Result.Result.Ok(Stdlib.String.toBytes_v0 "d") +Stdlib.Base64.decode "ZE==" +== Stdlib.Result.Result.Ok(Stdlib.String.toBytes "d") -Stdlib.Base64.decode "ZmC=" = Stdlib.Result.Result.Ok(Stdlib.String.toBytes_v0 "f`") +Stdlib.Base64.decode "ZmC=" +== Stdlib.Result.Result.Ok(Stdlib.String.toBytes "f`") -Stdlib.Base64.decode "Zm9vYE==" = Stdlib.Result.Result.Ok( - Stdlib.String.toBytes_v0 "foo`" -) +Stdlib.Base64.decode "Zm9vYE==" +== Stdlib.Result.Result.Ok(Stdlib.String.toBytes "foo`") -Stdlib.Base64.decode "Zm9vYmC=" = Stdlib.Result.Result.Ok( - Stdlib.String.toBytes_v0 "foob`" -) +Stdlib.Base64.decode "Zm9vYmC=" +== Stdlib.Result.Result.Ok(Stdlib.String.toBytes "foob`") Stdlib.Base64.decode - "ZnJvbT0wNi8wNy8yMDEzIHF1ZXJ5PSLOms6xzrvPjs-CIM6_z4HOr8-DzrHPhM61Ig" = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Ok(Stdlib.String.toBytes_v0 "from=06/07/2013 query=\"Καλώς ορίσατε\"") - -Stdlib.Base64.decode "8J-RsfCfkbHwn4-78J-RsfCfj7zwn5Gx8J-PvfCfkbHwn4--8J-RsfCfj78" = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Ok(Stdlib.String.toBytes_v0 "👱👱🏻👱🏼👱🏽👱🏾👱🏿") + "ZnJvbT0wNi8wNy8yMDEzIHF1ZXJ5PSLOms6xzrvPjs-CIM6_z4HOr8-DzrHPhM61Ig" +== PACKAGE.Darklang.Stdlib.Result.Result.Ok( + Stdlib.String.toBytes "from=06/07/2013 query=\"Καλώς ορίσατε\"" +) + +Stdlib.Base64.decode "8J-RsfCfkbHwn4-78J-RsfCfj7zwn5Gx8J-PvfCfkbHwn4--8J-RsfCfj78" +== PACKAGE.Darklang.Stdlib.Result.Result.Ok( + Stdlib.String.toBytes "👱👱🏻👱🏼👱🏽👱🏾👱🏿" +) // These produce strings of bytes which are technically legal it seems -Stdlib.Base64.decode "-p" = Stdlib.Result.Result.Ok([ 250uy ]) +Stdlib.Base64.decode "-p" == Stdlib.Result.Result.Ok([ 250uy ]) -Stdlib.Base64.decode "lI" = Stdlib.Result.Result.Ok([ 148uy ]) +Stdlib.Base64.decode "lI" == Stdlib.Result.Result.Ok([ 148uy ]) -Stdlib.Base64.decode "5Sk" = Stdlib.Result.Result.Ok([ 229uy; 41uy ]) +Stdlib.Base64.decode "5Sk" == Stdlib.Result.Result.Ok([ 229uy; 41uy ]) -Stdlib.Base64.decode "AA" = Stdlib.Result.Result.Ok([ 0uy ]) +Stdlib.Base64.decode "AA" == Stdlib.Result.Result.Ok([ 0uy ]) -Stdlib.Base64.decode "_w" = Stdlib.Result.Result.Ok([ 255uy ]) +Stdlib.Base64.decode "_w" == Stdlib.Result.Result.Ok([ 255uy ]) -Stdlib.Base64.encode (Stdlib.String.toBytes_v0 "abcdef") = "YWJjZGVm" +Stdlib.Base64.encode (Stdlib.String.toBytes "abcdef") == "YWJjZGVm" -Stdlib.Base64.encode (Stdlib.String.toBytes_v0 "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇") = "WsykzZTNp8yRzJPDpM2WzK3MiMyHbM2uzJLNq8enzJfNmsyab8yZzJTNrsyHzZDMhw==" +Stdlib.Base64.encode (Stdlib.String.toBytes "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇") +== "WsykzZTNp8yRzJPDpM2WzK3MiMyHbM2uzJLNq8enzJfNmsyab8yZzJTNrsyHzZDMhw==" -Stdlib.Base64.encode (Stdlib.String.toBytes_v0 "اختبار النص") = "2KfYrtiq2KjYp9ixINin2YTZhti1" +Stdlib.Base64.encode (Stdlib.String.toBytes "اختبار النص") +== "2KfYrtiq2KjYp9ixINin2YTZhti1" -Stdlib.Base64.encode (Stdlib.String.toBytes_v0 "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽") = "77e977e977e977e977e977e977e977e977e977e977e977e977e977e977e977e9" +Stdlib.Base64.encode (Stdlib.String.toBytes "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽") +== "77e977e977e977e977e977e977e977e977e977e977e977e977e977e977e977e9" -Stdlib.Base64.encode (Stdlib.String.toBytes_v0 "👱👱🏻👱🏼👱🏽👱🏾👱🏿") = "8J+RsfCfkbHwn4+78J+RsfCfj7zwn5Gx8J+PvfCfkbHwn4++8J+RsfCfj78=" +Stdlib.Base64.encode (Stdlib.String.toBytes "👱👱🏻👱🏼👱🏽👱🏾👱🏿") +== "8J+RsfCfkbHwn4+78J+RsfCfj7zwn5Gx8J+PvfCfkbHwn4++8J+RsfCfj78=" -Stdlib.Base64.encode (Stdlib.String.toBytes_v0 "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️🇵🇷") = "8J+RqOKAjeKdpO+4j+KAjfCfkovigI3wn5Go8J+RqeKAjfCfkanigI3wn5Gn4oCN8J+RpvCfj7PvuI/igI3imqfvuI/wn4e18J+Htw==" +Stdlib.Base64.encode (Stdlib.String.toBytes "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️🇵🇷") +== "8J+RqOKAjeKdpO+4j+KAjfCfkovigI3wn5Go8J+RqeKAjfCfkanigI3wn5Gn4oCN8J+RpvCfj7PvuI/igI3imqfvuI/wn4e18J+Htw==" -Stdlib.Base64.urlEncode_v0 (Stdlib.String.toBytes_v0 "abcdef") = "YWJjZGVm" +Stdlib.Base64.urlEncode (Stdlib.String.toBytes "abcdef") == "YWJjZGVm" -Stdlib.Base64.urlEncode_v0 (Stdlib.String.toBytes_v0 "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇") = "WsykzZTNp8yRzJPDpM2WzK3MiMyHbM2uzJLNq8enzJfNmsyab8yZzJTNrsyHzZDMhw==" +Stdlib.Base64.urlEncode (Stdlib.String.toBytes "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇") +== "WsykzZTNp8yRzJPDpM2WzK3MiMyHbM2uzJLNq8enzJfNmsyab8yZzJTNrsyHzZDMhw==" -Stdlib.Base64.urlEncode_v0 (Stdlib.String.toBytes_v0 "اختبار النص") = "2KfYrtiq2KjYp9ixINin2YTZhti1" +Stdlib.Base64.urlEncode (Stdlib.String.toBytes "اختبار النص") +== "2KfYrtiq2KjYp9ixINin2YTZhti1" -Stdlib.Base64.urlEncode_v0 (Stdlib.String.toBytes_v0 "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽") = "77e977e977e977e977e977e977e977e977e977e977e977e977e977e977e977e9" +Stdlib.Base64.urlEncode (Stdlib.String.toBytes "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽") +== "77e977e977e977e977e977e977e977e977e977e977e977e977e977e977e977e9" -Stdlib.Base64.urlEncode_v0 (Stdlib.String.toBytes_v0 "👱👱🏻👱🏼👱🏽👱🏾👱🏿") = "8J-RsfCfkbHwn4-78J-RsfCfj7zwn5Gx8J-PvfCfkbHwn4--8J-RsfCfj78=" +Stdlib.Base64.urlEncode (Stdlib.String.toBytes "👱👱🏻👱🏼👱🏽👱🏾👱🏿") +== "8J-RsfCfkbHwn4-78J-RsfCfj7zwn5Gx8J-PvfCfkbHwn4--8J-RsfCfj78=" -Stdlib.Base64.urlEncode_v0 ( - Stdlib.String.toBytes_v0 "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️🇵🇷" -) = "8J-RqOKAjeKdpO-4j-KAjfCfkovigI3wn5Go8J-RqeKAjfCfkanigI3wn5Gn4oCN8J-RpvCfj7PvuI_igI3imqfvuI_wn4e18J-Htw==" \ No newline at end of file +Stdlib.Base64.urlEncode (Stdlib.String.toBytes "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️🇵🇷") +== "8J-RqOKAjeKdpO-4j-KAjfCfkovigI3wn5Go8J-RqeKAjfCfkanigI3wn5Gn4oCN8J-RpvCfj7PvuI_igI3imqfvuI_wn4e18J-Htw==" \ No newline at end of file diff --git a/backend/testfiles/execution/stdlib/bool.dark b/backend/testfiles/execution/stdlib/bool.dark index cafe932683..f3d2a6b5e6 100644 --- a/backend/testfiles/execution/stdlib/bool.dark +++ b/backend/testfiles/execution/stdlib/bool.dark @@ -1,32 +1,32 @@ -Stdlib.Bool.and_v0 false false = false -Stdlib.Bool.and_v0 false true = false -Stdlib.Bool.and_v0 true false = false -Stdlib.Bool.and_v0 true true = true -Stdlib.Bool.and_v0 (8L >= 5L) (6L <= 8L) = true +Stdlib.Bool.and false false == false +Stdlib.Bool.and false true == false +Stdlib.Bool.and true false == false +Stdlib.Bool.and true true == true +Stdlib.Bool.and (8L >= 5L) (6L <= 8L) == true -(false && false) = false -(false && true) = false -(true && false) = false -(true && true) = true -((8L >= 5L) && (6L <= 8L)) = true +(false && false) == false +(false && true) == false +(true && false) == false +(true && true) == true +((8L >= 5L) && (6L <= 8L)) == true -Stdlib.Bool.not_v0 false = true -Stdlib.Bool.not_v0 true = false +Stdlib.Bool.not false == true +Stdlib.Bool.not true == false -Stdlib.Bool.or_v0 false false = false -Stdlib.Bool.or_v0 true false = true -Stdlib.Bool.or_v0 false true = true -Stdlib.Bool.or_v0 true true = true +Stdlib.Bool.or false false == false +Stdlib.Bool.or true false == true +Stdlib.Bool.or false true == true +Stdlib.Bool.or true true == true -(false || false) = false -(true || false) = true -(false || true) = true -(true || true) = true +(false || false) == false +(true || false) == true +(false || true) == true +(true || true) == true -Stdlib.Bool.xor_v0 false false = false -Stdlib.Bool.xor_v0 false true = true -Stdlib.Bool.xor_v0 true false = true -Stdlib.Bool.xor_v0 true true = false +Stdlib.Bool.xor false false == false +Stdlib.Bool.xor false true == true +Stdlib.Bool.xor true false == true +Stdlib.Bool.xor true true == false -Stdlib.Bool.toString true = "true" -Stdlib.Bool.toString false = "false" \ No newline at end of file +Stdlib.Bool.toString true == "true" +Stdlib.Bool.toString false == "false" \ No newline at end of file diff --git a/backend/testfiles/execution/stdlib/bytes.dark b/backend/testfiles/execution/stdlib/bytes.dark index 844e9b2cad..5cb5d8d7a5 100644 --- a/backend/testfiles/execution/stdlib/bytes.dark +++ b/backend/testfiles/execution/stdlib/bytes.dark @@ -1,10 +1,13 @@ -Stdlib.Bytes.hexEncode_v0 (Stdlib.String.toBytes_v0 "123qwc") = "313233717763" +Stdlib.Bytes.hexEncode (Stdlib.String.toBytes "123qwc") == "313233717763" -Stdlib.Bytes.hexEncode_v0 (Stdlib.String.toBytes_v0 "اختبار النص") = "D8A7D8AED8AAD8A8D8A7D8B120D8A7D984D986D8B5" +Stdlib.Bytes.hexEncode (Stdlib.String.toBytes "اختبار النص") +== "D8A7D8AED8AAD8A8D8A7D8B120D8A7D984D986D8B5" -Stdlib.Bytes.hexEncode_v0 (Stdlib.String.toBytes_v0 "👱👱🏻👱🏼👱🏽👱🏾👱🏿") = "F09F91B1F09F91B1F09F8FBBF09F91B1F09F8FBCF09F91B1F09F8FBDF09F91B1F09F8FBEF09F91B1F09F8FBF" +Stdlib.Bytes.hexEncode (Stdlib.String.toBytes "👱👱🏻👱🏼👱🏽👱🏾👱🏿") +== "F09F91B1F09F91B1F09F8FBBF09F91B1F09F8FBCF09F91B1F09F8FBDF09F91B1F09F8FBEF09F91B1F09F8FBF" -Stdlib.Bytes.hexEncode_v0 ( - Stdlib.String.toBytes_v0 +Stdlib.Bytes.hexEncode ( + Stdlib.String.toBytes "dlkjkd329823333333333fjfidjsfudsdhs}{||!|!|!|!!$%^&^&﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" -) = "646C6B6A6B64333239383233333333333333333333666A6669646A73667564736468737D7B7C7C217C217C217C212124255E265E26EFB7BDEFB7BDEFB7BDEFB7BDEFB7BDEFB7BDEFB7BDEFB7BDEFB7BDEFB7BDEFB7BDEFB7BDEFB7BDEFB7BDEFB7BDEFB7BD" \ No newline at end of file +) +== "646C6B6A6B64333239383233333333333333333333666A6669646A73667564736468737D7B7C7C217C217C217C212124255E265E26EFB7BDEFB7BDEFB7BDEFB7BDEFB7BDEFB7BDEFB7BDEFB7BDEFB7BDEFB7BDEFB7BDEFB7BDEFB7BDEFB7BDEFB7BDEFB7BD" \ No newline at end of file diff --git a/backend/testfiles/execution/stdlib/char.dark b/backend/testfiles/execution/stdlib/char.dark index eec0b5775b..d365fdf25b 100644 --- a/backend/testfiles/execution/stdlib/char.dark +++ b/backend/testfiles/execution/stdlib/char.dark @@ -1,5 +1,5 @@ let smiley () : Char = - "😂" |> Stdlib.String.head |> Builtin.unwrap + ("😂" |> Stdlib.String.head |> Builtin.unwrap) let hand () : Char = "✋🏿" |> Stdlib.String.head |> Builtin.unwrap @@ -7,214 +7,216 @@ let hand () : Char = let family () : Char = "👩‍👩‍👧‍👦" |> Stdlib.String.head |> Builtin.unwrap -Stdlib.Char.toLowercase 'A' = 'a' -Stdlib.Char.toLowercase 'a' = 'a' -Stdlib.Char.toLowercase 'Á' = 'á' -Stdlib.Char.toLowercase '3' = '3' -Stdlib.Char.toLowercase (smiley ()) = smiley () -Stdlib.Char.toLowercase 'Ż' = 'ż' -Stdlib.Char.toLowercase 'Ó' = 'ó' -Stdlib.Char.toLowercase 'Ł' = 'ł' -Stdlib.Char.toLowercase (hand ()) = hand () -Stdlib.Char.toLowercase 'Ჾ' = 'ჾ' -Stdlib.Char.toLowercase 'ჾ' = 'ჾ' - - -Stdlib.Char.toUppercase 'a' = 'A' -Stdlib.Char.toUppercase 'A' = 'A' -Stdlib.Char.toUppercase 'á' = 'Á' -Stdlib.Char.toUppercase '3' = '3' -Stdlib.Char.toUppercase (smiley ()) = smiley () -Stdlib.Char.toUppercase 'ż' = 'Ż' -Stdlib.Char.toUppercase 'ó' = 'Ó' -Stdlib.Char.toUppercase 'ł' = 'Ł' -Stdlib.Char.toUppercase (hand ()) = hand () -Stdlib.Char.toUppercase 'ჾ' = 'Ჾ' -Stdlib.Char.toUppercase 'Ჾ' = 'Ჾ' - - -Stdlib.Char.isLowercase_v0 'a' = true -Stdlib.Char.isLowercase_v0 'A' = false -Stdlib.Char.isLowercase_v0 'á' = true -Stdlib.Char.isLowercase_v0 'Á' = false -Stdlib.Char.isLowercase_v0 '3' = false -Stdlib.Char.isLowercase_v0 (smiley ()) = false -Stdlib.Char.isLowercase_v0 'ż' = true -Stdlib.Char.isLowercase_v0 'Ż' = false -Stdlib.Char.isLowercase_v0 'ó' = true -Stdlib.Char.isLowercase_v0 'Ó' = false -Stdlib.Char.isLowercase_v0 'ł' = true -Stdlib.Char.isLowercase_v0 'Ł' = false -Stdlib.Char.isLowercase_v0 (hand ()) = false -Stdlib.Char.isLowercase_v0 'ჾ' = true -Stdlib.Char.isLowercase_v0 'Ჾ' = false - - -Stdlib.Char.isUppercase_v0 'a' = false -Stdlib.Char.isUppercase_v0 'A' = true -Stdlib.Char.isUppercase_v0 'á' = false -Stdlib.Char.isUppercase_v0 'Á' = true -Stdlib.Char.isUppercase_v0 '3' = false -Stdlib.Char.isUppercase_v0 (smiley ()) = false -Stdlib.Char.isUppercase_v0 'ż' = false -Stdlib.Char.isUppercase_v0 'Ż' = true -Stdlib.Char.isUppercase_v0 'ó' = false -Stdlib.Char.isUppercase_v0 'Ó' = true -Stdlib.Char.isUppercase_v0 'ł' = false -Stdlib.Char.isUppercase_v0 'Ł' = true -Stdlib.Char.isUppercase_v0 (hand ()) = false -Stdlib.Char.isUppercase_v0 'ჾ' = false -Stdlib.Char.isUppercase_v0 'Ჾ' = true - - -Stdlib.Char.isDigit_v0 'a' = false -Stdlib.Char.isDigit_v0 'A' = false -Stdlib.Char.isDigit_v0 'á' = false -Stdlib.Char.isDigit_v0 'Á' = false -Stdlib.Char.isDigit_v0 '0' = true -Stdlib.Char.isDigit_v0 '1' = true -Stdlib.Char.isDigit_v0 '2' = true -Stdlib.Char.isDigit_v0 '3' = true -Stdlib.Char.isDigit_v0 '4' = true -Stdlib.Char.isDigit_v0 '5' = true -Stdlib.Char.isDigit_v0 '6' = true -Stdlib.Char.isDigit_v0 '7' = true -Stdlib.Char.isDigit_v0 '8' = true -Stdlib.Char.isDigit_v0 '9' = true -Stdlib.Char.isDigit_v0 (smiley ()) = false -Stdlib.Char.isDigit_v0 'ż' = false -Stdlib.Char.isDigit_v0 'Ż' = false -Stdlib.Char.isDigit_v0 'ó' = false -Stdlib.Char.isDigit_v0 'Ó' = false -Stdlib.Char.isDigit_v0 'ł' = false -Stdlib.Char.isDigit_v0 'Ł' = false -Stdlib.Char.isDigit_v0 (hand ()) = false -Stdlib.Char.isDigit_v0 'ჾ' = false -Stdlib.Char.isDigit_v0 'Ჾ' = false -Stdlib.Char.isDigit_v0 ' ' = false -Stdlib.Char.isDigit_v0 '\t' = false - - -Stdlib.Char.isASCIILetter_v0 'a' = true -Stdlib.Char.isASCIILetter_v0 'A' = true -Stdlib.Char.isASCIILetter_v0 'á' = false -Stdlib.Char.isASCIILetter_v0 'Á' = false -Stdlib.Char.isASCIILetter_v0 '3' = false -Stdlib.Char.isASCIILetter_v0 ',' = false -Stdlib.Char.isASCIILetter_v0 (smiley ()) = false -Stdlib.Char.isASCIILetter_v0 'ż' = false -Stdlib.Char.isASCIILetter_v0 'Ż' = false -Stdlib.Char.isASCIILetter_v0 'ó' = false -Stdlib.Char.isASCIILetter_v0 'Ó' = false -Stdlib.Char.isASCIILetter_v0 'ł' = false -Stdlib.Char.isASCIILetter_v0 'Ł' = false -Stdlib.Char.isASCIILetter_v0 (hand ()) = false -Stdlib.Char.isASCIILetter_v0 'ჾ' = false -Stdlib.Char.isASCIILetter_v0 'Ჾ' = false -Stdlib.Char.isASCIILetter_v0 ' ' = false -Stdlib.Char.isASCIILetter_v0 '\t' = false - - -Stdlib.Char.isASCII_v0 'a' = true -Stdlib.Char.isASCII_v0 'A' = true -Stdlib.Char.isASCII_v0 'á' = false -Stdlib.Char.isASCII_v0 'Á' = false -Stdlib.Char.isASCII_v0 '3' = true -Stdlib.Char.isASCII_v0 (smiley ()) = false -Stdlib.Char.isASCII_v0 'ż' = false -Stdlib.Char.isASCII_v0 'Ż' = false -Stdlib.Char.isASCII_v0 'ó' = false -Stdlib.Char.isASCII_v0 'Ó' = false -Stdlib.Char.isASCII_v0 'ł' = false -Stdlib.Char.isASCII_v0 'Ł' = false -Stdlib.Char.isASCII_v0 (hand ()) = false -Stdlib.Char.isASCII_v0 'ჾ' = false -Stdlib.Char.isASCII_v0 'Ჾ' = false -Stdlib.Char.isASCII_v0 ' ' = true -Stdlib.Char.isASCII_v0 '\t' = true - - -Stdlib.Char.toAsciiCode 'a' = Stdlib.Option.Option.Some 97L - -Stdlib.Char.toAsciiCode 'A' = Stdlib.Option.Option.Some 65L - -Stdlib.Char.toAsciiCode 'á' = Stdlib.Option.Option.Some 225L - -Stdlib.Char.toAsciiCode 'Á' = Stdlib.Option.Option.Some 193L - -Stdlib.Char.toAsciiCode '3' = Stdlib.Option.Option.Some 51L - -Stdlib.Char.toAsciiCode (smiley ()) = Stdlib.Option.Option.None - -Stdlib.Char.toAsciiCode 'ż' = Stdlib.Option.Option.None - -Stdlib.Char.toAsciiCode 'Ż' = Stdlib.Option.Option.None - -Stdlib.Char.toAsciiCode 'ó' = Stdlib.Option.Option.Some 243L - -Stdlib.Char.toAsciiCode 'Ó' = Stdlib.Option.Option.Some 211L - -Stdlib.Char.toAsciiCode 'ł' = Stdlib.Option.Option.None - -Stdlib.Char.toAsciiCode 'Ł' = Stdlib.Option.Option.None - -Stdlib.Char.toAsciiCode (hand ()) = Stdlib.Option.Option.None - -Stdlib.Char.toAsciiCode 'ჾ' = Stdlib.Option.Option.None - -Stdlib.Char.toAsciiCode 'Ჾ' = Stdlib.Option.Option.None - -Stdlib.Char.toAsciiCode ' ' = Stdlib.Option.Option.Some 32L - -Stdlib.Char.toAsciiCode '\t' = Stdlib.Option.Option.Some 9L - - -Stdlib.Char.isLessThan_v0 'a' 'b' = true -Stdlib.Char.isLessThan_v0 'a' 'A' = false -Stdlib.Char.isLessThan_v0 'b' 'A' = false -Stdlib.Char.isLessThan_v0 'a' 'á' = true -Stdlib.Char.isLessThan_v0 'b' 'á' = true -Stdlib.Char.isLessThan_v0 'a' 'ჾ' = true -Stdlib.Char.isLessThan_v0 'a' 'Ჾ' = true -Stdlib.Char.isLessThan_v0 'a' 'ł' = true -Stdlib.Char.isLessThan_v0 'a' 'Ł' = true -Stdlib.Char.isLessThan_v0 'a' ' ' = false -Stdlib.Char.isLessThan_v0 'a' '\t' = false -Stdlib.Char.isLessThan_v0 'a' '1' = false -Stdlib.Char.isLessThan_v0 '2' '1' = false -Stdlib.Char.isLessThan_v0 'a' (smiley ()) = true -Stdlib.Char.isLessThan_v0 'a' (hand ()) = true -Stdlib.Char.isLessThan_v0 'a' (family ()) = true -Stdlib.Char.isLessThan_v0 (smiley ()) (hand ()) = false - - -Stdlib.Char.isGreaterThan_v0 'a' 'b' = false -Stdlib.Char.isGreaterThan_v0 'a' 'A' = true -Stdlib.Char.isGreaterThan_v0 'b' 'A' = true -Stdlib.Char.isGreaterThan_v0 'a' 'á' = false -Stdlib.Char.isGreaterThan_v0 'b' 'á' = false -Stdlib.Char.isGreaterThan_v0 'a' 'ჾ' = false -Stdlib.Char.isGreaterThan_v0 'a' 'Ჾ' = false -Stdlib.Char.isGreaterThan_v0 'a' 'ł' = false -Stdlib.Char.isGreaterThan_v0 'a' 'Ł' = false -Stdlib.Char.isGreaterThan_v0 'a' ' ' = true -Stdlib.Char.isGreaterThan_v0 'a' '\t' = true -Stdlib.Char.isGreaterThan_v0 'a' '1' = true -Stdlib.Char.isGreaterThan_v0 '2' '1' = true -Stdlib.Char.isGreaterThan_v0 'a' (smiley ()) = false -Stdlib.Char.isGreaterThan_v0 'a' (hand ()) = false -Stdlib.Char.isGreaterThan_v0 'a' (family ()) = false -Stdlib.Char.isGreaterThan_v0 (smiley ()) (hand ()) = true - - -Stdlib.Char.toString 'A' = "A" -Stdlib.Char.toString 'a' = "a" -Stdlib.Char.toString 'Á' = "Á" -Stdlib.Char.toString '3' = "3" -Stdlib.Char.toString (smiley ()) = "😂" -Stdlib.Char.toString 'Ż' = "Ż" -Stdlib.Char.toString 'Ó' = "Ó" -Stdlib.Char.toString 'Ł' = "Ł" -Stdlib.Char.toString (hand ()) = "✋🏿" -Stdlib.Char.toString 'Ჾ' = "Ჾ" -Stdlib.Char.toString 'ჾ' = "ჾ" \ No newline at end of file +Stdlib.Char.toLowercase 'A' == 'a' +Stdlib.Char.toLowercase 'a' == 'a' +Stdlib.Char.toLowercase 'Á' == 'á' +Stdlib.Char.toLowercase '3' == '3' +Stdlib.Char.toLowercase (smiley ()) == smiley () +Stdlib.Char.toLowercase 'Ż' == 'ż' +Stdlib.Char.toLowercase 'Ó' == 'ó' +Stdlib.Char.toLowercase 'Ł' == 'ł' +Stdlib.Char.toLowercase (hand ()) == hand () +Stdlib.Char.toLowercase 'Ჾ' == 'ჾ' +Stdlib.Char.toLowercase 'ჾ' == 'ჾ' + + +Stdlib.Char.toUppercase 'a' == 'A' +Stdlib.Char.toUppercase 'A' == 'A' +Stdlib.Char.toUppercase 'á' == 'Á' +Stdlib.Char.toUppercase '3' == '3' +Stdlib.Char.toUppercase (smiley ()) == smiley () +Stdlib.Char.toUppercase 'ż' == 'Ż' +Stdlib.Char.toUppercase 'ó' == 'Ó' +Stdlib.Char.toUppercase 'ł' == 'Ł' +Stdlib.Char.toUppercase (hand ()) == hand () +Stdlib.Char.toUppercase 'ჾ' == 'Ჾ' +Stdlib.Char.toUppercase 'Ჾ' == 'Ჾ' + + +Stdlib.Char.isLowercase 'a' == true +Stdlib.Char.isLowercase 'A' == false +Stdlib.Char.isLowercase 'á' == true +Stdlib.Char.isLowercase 'Á' == false +Stdlib.Char.isLowercase '3' == false +Stdlib.Char.isLowercase (smiley ()) == false +Stdlib.Char.isLowercase 'ż' == true +Stdlib.Char.isLowercase 'Ż' == false +Stdlib.Char.isLowercase 'ó' == true +Stdlib.Char.isLowercase 'Ó' == false +Stdlib.Char.isLowercase 'ł' == true +Stdlib.Char.isLowercase 'Ł' == false +Stdlib.Char.isLowercase (hand ()) == false +Stdlib.Char.isLowercase 'ჾ' == true +Stdlib.Char.isLowercase 'Ჾ' == false + + +Stdlib.Char.isUppercase 'a' == false +Stdlib.Char.isUppercase 'A' == true +Stdlib.Char.isUppercase 'á' == false +Stdlib.Char.isUppercase 'Á' == true +Stdlib.Char.isUppercase '3' == false +Stdlib.Char.isUppercase (smiley ()) == false +Stdlib.Char.isUppercase 'ż' == false +Stdlib.Char.isUppercase 'Ż' == true +Stdlib.Char.isUppercase 'ó' == false +Stdlib.Char.isUppercase 'Ó' == true +Stdlib.Char.isUppercase 'ł' == false +Stdlib.Char.isUppercase 'Ł' == true +Stdlib.Char.isUppercase (hand ()) == false +Stdlib.Char.isUppercase 'ჾ' == false +Stdlib.Char.isUppercase 'Ჾ' == true + + +Stdlib.Char.isDigit 'a' == false +Stdlib.Char.isDigit 'A' == false +Stdlib.Char.isDigit 'á' == false +Stdlib.Char.isDigit 'Á' == false +Stdlib.Char.isDigit '0' == true +Stdlib.Char.isDigit '1' == true +Stdlib.Char.isDigit '2' == true +Stdlib.Char.isDigit '3' == true +Stdlib.Char.isDigit '4' == true +Stdlib.Char.isDigit '5' == true +Stdlib.Char.isDigit '6' == true +Stdlib.Char.isDigit '7' == true +Stdlib.Char.isDigit '8' == true +Stdlib.Char.isDigit '9' == true +Stdlib.Char.isDigit (smiley ()) == false + + +Stdlib.Char.isDigit 'ż' == false +Stdlib.Char.isDigit 'Ż' == false +Stdlib.Char.isDigit 'ó' == false +Stdlib.Char.isDigit 'Ó' == false +Stdlib.Char.isDigit 'ł' == false +Stdlib.Char.isDigit 'Ł' == false +Stdlib.Char.isDigit (hand ()) == false +Stdlib.Char.isDigit 'ჾ' == false +Stdlib.Char.isDigit 'Ჾ' == false +Stdlib.Char.isDigit ' ' == false +Stdlib.Char.isDigit '\t' == false + + +Stdlib.Char.isASCIILetter 'a' == true +Stdlib.Char.isASCIILetter 'A' == true +Stdlib.Char.isASCIILetter 'á' == false +Stdlib.Char.isASCIILetter 'Á' == false +Stdlib.Char.isASCIILetter '3' == false +Stdlib.Char.isASCIILetter ',' == false +Stdlib.Char.isASCIILetter (smiley ()) == false +Stdlib.Char.isASCIILetter 'ż' == false +Stdlib.Char.isASCIILetter 'Ż' == false +Stdlib.Char.isASCIILetter 'ó' == false +Stdlib.Char.isASCIILetter 'Ó' == false +Stdlib.Char.isASCIILetter 'ł' == false +Stdlib.Char.isASCIILetter 'Ł' == false +Stdlib.Char.isASCIILetter (hand ()) == false +Stdlib.Char.isASCIILetter 'ჾ' == false +Stdlib.Char.isASCIILetter 'Ჾ' == false +Stdlib.Char.isASCIILetter ' ' == false +Stdlib.Char.isASCIILetter '\t' == false + + +Stdlib.Char.isASCII 'a' == true +Stdlib.Char.isASCII 'A' == true +Stdlib.Char.isASCII 'á' == false +Stdlib.Char.isASCII 'Á' == false +Stdlib.Char.isASCII '3' == true +Stdlib.Char.isASCII (smiley ()) == false +Stdlib.Char.isASCII 'ż' == false +Stdlib.Char.isASCII 'Ż' == false +Stdlib.Char.isASCII 'ó' == false +Stdlib.Char.isASCII 'Ó' == false +Stdlib.Char.isASCII 'ł' == false +Stdlib.Char.isASCII 'Ł' == false +Stdlib.Char.isASCII (hand ()) == false +Stdlib.Char.isASCII 'ჾ' == false +Stdlib.Char.isASCII 'Ჾ' == false +Stdlib.Char.isASCII ' ' == true +Stdlib.Char.isASCII '\t' == true + + +Stdlib.Char.toAsciiCode 'a' == Stdlib.Option.Option.Some(97L) + +Stdlib.Char.toAsciiCode 'A' == Stdlib.Option.Option.Some(65L) + +Stdlib.Char.toAsciiCode 'á' == Stdlib.Option.Option.Some(225L) + +Stdlib.Char.toAsciiCode 'Á' == Stdlib.Option.Option.Some(193L) + +Stdlib.Char.toAsciiCode '3' == Stdlib.Option.Option.Some(51L) + +Stdlib.Char.toAsciiCode (smiley ()) == Stdlib.Option.Option.None() + +Stdlib.Char.toAsciiCode 'ż' == Stdlib.Option.Option.None() + +Stdlib.Char.toAsciiCode 'Ż' == Stdlib.Option.Option.None() + +Stdlib.Char.toAsciiCode 'ó' == Stdlib.Option.Option.Some(243L) + +Stdlib.Char.toAsciiCode 'Ó' == Stdlib.Option.Option.Some(211L) + +Stdlib.Char.toAsciiCode 'ł' == Stdlib.Option.Option.None() + +Stdlib.Char.toAsciiCode 'Ł' == Stdlib.Option.Option.None() + +Stdlib.Char.toAsciiCode (hand ()) == Stdlib.Option.Option.None() + +Stdlib.Char.toAsciiCode 'ჾ' == Stdlib.Option.Option.None() + +Stdlib.Char.toAsciiCode 'Ჾ' == Stdlib.Option.Option.None() + +Stdlib.Char.toAsciiCode ' ' == Stdlib.Option.Option.Some(32L) + +Stdlib.Char.toAsciiCode '\t' == Stdlib.Option.Option.Some(9L) + + +Stdlib.Char.isLessThan 'a' 'b' == true +Stdlib.Char.isLessThan 'a' 'A' == false +Stdlib.Char.isLessThan 'b' 'A' == false +Stdlib.Char.isLessThan 'a' 'á' == true +Stdlib.Char.isLessThan 'b' 'á' == true +Stdlib.Char.isLessThan 'a' 'ჾ' == true +Stdlib.Char.isLessThan 'a' 'Ჾ' == true +Stdlib.Char.isLessThan 'a' 'ł' == true +Stdlib.Char.isLessThan 'a' 'Ł' == true +Stdlib.Char.isLessThan 'a' ' ' == false +Stdlib.Char.isLessThan 'a' '\t' == false +Stdlib.Char.isLessThan 'a' '1' == false +Stdlib.Char.isLessThan '2' '1' == false +Stdlib.Char.isLessThan 'a' (smiley ()) == true +Stdlib.Char.isLessThan 'a' (hand ()) == true +Stdlib.Char.isLessThan 'a' (family ()) == true +Stdlib.Char.isLessThan (smiley ()) (hand ()) == false + + +Stdlib.Char.isGreaterThan 'a' 'b' == false +Stdlib.Char.isGreaterThan 'a' 'A' == true +Stdlib.Char.isGreaterThan 'b' 'A' == true +Stdlib.Char.isGreaterThan 'a' 'á' == false +Stdlib.Char.isGreaterThan 'b' 'á' == false +Stdlib.Char.isGreaterThan 'a' 'ჾ' == false +Stdlib.Char.isGreaterThan 'a' 'Ჾ' == false +Stdlib.Char.isGreaterThan 'a' 'ł' == false +Stdlib.Char.isGreaterThan 'a' 'Ł' == false +Stdlib.Char.isGreaterThan 'a' ' ' == true +Stdlib.Char.isGreaterThan 'a' '\t' == true +Stdlib.Char.isGreaterThan 'a' '1' == true +Stdlib.Char.isGreaterThan '2' '1' == true +Stdlib.Char.isGreaterThan 'a' (smiley ()) == false +Stdlib.Char.isGreaterThan 'a' (hand ()) == false +Stdlib.Char.isGreaterThan 'a' (family ()) == false +Stdlib.Char.isGreaterThan (smiley ()) (hand ()) == true + + +Stdlib.Char.toString 'A' == "A" +Stdlib.Char.toString 'a' == "a" +Stdlib.Char.toString 'Á' == "Á" +Stdlib.Char.toString '3' == "3" +Stdlib.Char.toString (smiley ()) == "😂" +Stdlib.Char.toString 'Ż' == "Ż" +Stdlib.Char.toString 'Ó' == "Ó" +Stdlib.Char.toString 'Ł' == "Ł" +Stdlib.Char.toString (hand ()) == "✋🏿" +Stdlib.Char.toString 'Ჾ' == "Ჾ" +Stdlib.Char.toString 'ჾ' == "ჾ" \ No newline at end of file diff --git a/backend/testfiles/execution/stdlib/crypto.dark b/backend/testfiles/execution/stdlib/crypto.dark index 4ec583a5ee..a089a0f316 100644 --- a/backend/testfiles/execution/stdlib/crypto.dark +++ b/backend/testfiles/execution/stdlib/crypto.dark @@ -1,63 +1,69 @@ -Stdlib.Bytes.hexEncode_v0 (Stdlib.Crypto.md5_v0 (Stdlib.String.toBytes_v0 "")) = "D41D8CD98F00B204E9800998ECF8427E" +Stdlib.Bytes.hexEncode (Stdlib.Crypto.md5 (Stdlib.String.toBytes "")) +== "D41D8CD98F00B204E9800998ECF8427E" -Stdlib.Bytes.hexEncode_v0 (Stdlib.Crypto.sha256_v0 (Stdlib.String.toBytes_v0 "")) = "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855" +Stdlib.Bytes.hexEncode (Stdlib.Crypto.sha256 (Stdlib.String.toBytes "")) +== "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855" -Stdlib.Bytes.hexEncode_v0 (Stdlib.Crypto.sha384_v0 (Stdlib.String.toBytes_v0 "")) = "38B060A751AC96384CD9327EB1B1E36A21FDB71114BE07434C0CC7BF63F6E1DA274EDEBFE76F65FBD51AD2F14898B95B" +Stdlib.Bytes.hexEncode (Stdlib.Crypto.sha384 (Stdlib.String.toBytes "")) +== "38B060A751AC96384CD9327EB1B1E36A21FDB71114BE07434C0CC7BF63F6E1DA274EDEBFE76F65FBD51AD2F14898B95B" -Stdlib.Bytes.hexEncode_v0 ( - Stdlib.Crypto.md5_v0 ( - Stdlib.String.toBytes_v0 "a longer string that's more interesting" - ) -) = "D95E619F023B430CAAAEB6778A0B9BD1" +Stdlib.Bytes.hexEncode ( + Stdlib.Crypto.md5 (Stdlib.String.toBytes "a longer string that's more interesting") +) +== "D95E619F023B430CAAAEB6778A0B9BD1" -Stdlib.Bytes.hexEncode_v0 ( - Stdlib.Crypto.sha256_v0 ( - Stdlib.String.toBytes_v0 "a longer string that's more interesting" +Stdlib.Bytes.hexEncode ( + Stdlib.Crypto.sha256 ( + Stdlib.String.toBytes "a longer string that's more interesting" ) -) = "1316F78627BC453D44D27E3133902CF798859572E814EED4B5FB56BB1447F05F" +) +== "1316F78627BC453D44D27E3133902CF798859572E814EED4B5FB56BB1447F05F" -Stdlib.Bytes.hexEncode_v0 ( - Stdlib.Crypto.sha384_v0 ( - Stdlib.String.toBytes_v0 "a longer string that's more interesting" +Stdlib.Bytes.hexEncode ( + Stdlib.Crypto.sha384 ( + Stdlib.String.toBytes "a longer string that's more interesting" ) -) = "AD7273EF514770D80B516D067354CB300FE458C042CE084EC97125718678C3C21415FE224658839963F0B2D90137AA7B" +) +== "AD7273EF514770D80B516D067354CB300FE458C042CE084EC97125718678C3C21415FE224658839963F0B2D90137AA7B" // sha256hmac (let secretBytes = - Stdlib.String.toBytes_v0 "AWS4wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY" + Stdlib.String.toBytes "AWS4wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY" - let dataBytes = Stdlib.String.toBytes_v0 "20150830" + let dataBytes = Stdlib.String.toBytes "20150830" - Stdlib.Bytes.hexEncode_v0 (Stdlib.Crypto.sha256hmac_v0 secretBytes dataBytes)) = "0138C7A6CBD60AA727B2F653A522567439DFB9F3E72B21F9B25941A42F04A7CD" + Stdlib.Bytes.hexEncode (Stdlib.Crypto.sha256hmac secretBytes dataBytes)) +== "0138C7A6CBD60AA727B2F653A522567439DFB9F3E72B21F9B25941A42F04A7CD" // sha1hmac (let secretBytes = - Stdlib.String.toBytes_v0 "AWS4wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY" + Stdlib.String.toBytes "AWS4wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY" - let dataBytes = Stdlib.String.toBytes_v0 "20150830" + let dataBytes = Stdlib.String.toBytes "20150830" - Stdlib.Bytes.hexEncode_v0 (Stdlib.Crypto.sha1hmac_v0 secretBytes dataBytes)) = "0932CB57FE685FEBC66657AA30C7568A4AB05CAF" + Stdlib.Bytes.hexEncode (Stdlib.Crypto.sha1hmac secretBytes dataBytes)) +== "0932CB57FE685FEBC66657AA30C7568A4AB05CAF" // aws -(let scope = "20150830/us-east-1/iam/aws4_request" - let content = "f536975d06c0309214f805bb90ccff089219ecd68b2577efef23edd43b7e1a59" - let strs = [ "AWS4-HMAC-SHA256"; "20150830T123600Z"; scope; content ] +// (const scope = "20150830/us-east-1/iam/aws4_request" +// const content = "f536975d06c0309214f805bb90ccff089219ecd68b2577efef23edd43b7e1a59" +// const strs = [ "AWS4-HMAC-SHA256"; "20150830T123600Z"; scope; content ] - let strToSign = Stdlib.String.join_v0 strs Stdlib.String.newline +// let strToSign = Stdlib.String.join strs Stdlib.String.newline - let secret = Stdlib.String.toBytes_v0 "AWS4wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY" +// let secret = Stdlib.String.toBytes "AWS4wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY" - let data = Stdlib.String.toBytes_v0 "20150830" - let date = Stdlib.Crypto.sha256hmac_v0 secret data +// let data = Stdlib.String.toBytes "20150830" +// let date = Stdlib.Crypto.sha256hmac secret data - let region = Stdlib.Crypto.sha256hmac_v0 date (Stdlib.String.toBytes_v0 "us-east-1") +// let region = Stdlib.Crypto.sha256hmac date (Stdlib.String.toBytes "us-east-1") - let service = Stdlib.Crypto.sha256hmac_v0 region (Stdlib.String.toBytes_v0 "iam") +// let service = Stdlib.Crypto.sha256hmac region (Stdlib.String.toBytes "iam") - let signing = - Stdlib.Crypto.sha256hmac_v0 service (Stdlib.String.toBytes_v0 "aws4_request") +// let signing = +// Stdlib.Crypto.sha256hmac service (Stdlib.String.toBytes "aws4_request") - let signed = - Stdlib.Crypto.sha256hmac_v0 signing (Stdlib.String.toBytes_v0 strToSign) +// let signed = Stdlib.Crypto.sha256hmac signing (Stdlib.String.toBytes strToSign) - Stdlib.String.toLowercase (Stdlib.Bytes.hexEncode_v0 signed)) = "5d672d79c15b13162d9279b0855cfba6789a8edb4c82c400e06b5924a6f2b5d7" \ No newline at end of file +// Stdlib.String.toLowercase (Stdlib.Bytes.hexEncode signed)) +// == "5d672d79c15b13162d9279b0855cfba6789a8edb4c82c400e06b5924a6f2b5d7" \ No newline at end of file diff --git a/backend/testfiles/execution/stdlib/date.dark b/backend/testfiles/execution/stdlib/date.dark index ec6945f7f2..e123b62bf2 100644 --- a/backend/testfiles/execution/stdlib/date.dark +++ b/backend/testfiles/execution/stdlib/date.dark @@ -3,380 +3,420 @@ let d (datestr: String) : DateTime = let p (datestr: String) : Stdlib.Result.Result = (Stdlib.DateTime.parse datestr) - |> Stdlib.Result.map (fun x -> Stdlib.DateTime.toString_v0 x) + |> Stdlib.Result.map (fun x -> Stdlib.DateTime.toString x) module DateParsing = (Stdlib.DateTime.parse "2019-07-28T22:42:36Z") - |> Stdlib.Result.map (fun x -> Stdlib.DateTime.toString_v0 x) = Stdlib.Result.Result.Ok - "2019-07-28T22:42:36Z" + |> Stdlib.Result.map (fun x -> Stdlib.DateTime.toString x) + == Stdlib.Result.Result.Ok("2019-07-28T22:42:36Z") - Stdlib.DateTime.parse "asd" = Stdlib.Result.Result.Error "Invalid date format" + Stdlib.DateTime.parse "asd" == Stdlib.Result.Result.Error("Invalid date format") -// Parse in both -p "2018-09-24T18:01:24Z" = Stdlib.Result.Result.Ok "2018-09-24T18:01:24Z" +module General = + // Parse in both + p "2018-09-24T18:01:24Z" == Stdlib.Result.Result.Ok("2018-09-24T18:01:24Z") -// Lowercase `z` aren't allowed -p "2023-09-23T18:01:24z" = Stdlib.Result.Result.Error "Invalid date format" + // Lowercase `z` aren't allowed + p "2023-09-23T18:01:24z" == Stdlib.Result.Result.Error("Invalid date format") -// Time zones aren't allowed -p "2000-11-22 09:10:15z" = Stdlib.Result.Result.Error "Invalid date format" // special cased in F# + // Time zones aren't allowed + p "2000-11-22 09:10:15z" == Stdlib.Result.Result.Error("Invalid date format") // special cased in F# -p "2008-09-15T09:30:41GMT" = Stdlib.Result.Result.Error "Invalid date format" // special cased in F# + p "2008-09-15T09:30:41GMT" == Stdlib.Result.Result.Error("Invalid date format") // special cased in F# -p "2008-09-15T09:30:41UTC" = Stdlib.Result.Result.Error "Invalid date format" + p "2008-09-15T09:30:41UTC" == Stdlib.Result.Result.Error("Invalid date format") -p "2008-09-15T09:30:41EST" = Stdlib.Result.Result.Error "Invalid date format" + p "2008-09-15T09:30:41EST" == Stdlib.Result.Result.Error("Invalid date format") -// Fail in both -p "2000-11-22 09:10:15" = Stdlib.Result.Result.Error "Invalid date format" + // Fail in both + p "2000-11-22 09:10:15" == Stdlib.Result.Result.Error("Invalid date format") -p "2000-11-22 09:10:15Z" = Stdlib.Result.Result.Error "Invalid date format" + p "2000-11-22 09:10:15Z" == Stdlib.Result.Result.Error("Invalid date format") -p "2012-01-31 23:59:59.999" = Stdlib.Result.Result.Error "Invalid date format" + p "2012-01-31 23:59:59.999" == Stdlib.Result.Result.Error("Invalid date format") -p "2012-01-31 23:59:59.999+0100" = Stdlib.Result.Result.Error "Invalid date format" + p "2012-01-31 23:59:59.999+0100" + == Stdlib.Result.Result.Error("Invalid date format") -p "2012-01-31 23:59:59.999-0100" = Stdlib.Result.Result.Error "Invalid date format" + p "2012-01-31 23:59:59.999-0100" + == Stdlib.Result.Result.Error("Invalid date format") -p "2018-09-09 10:43:54+0100" = Stdlib.Result.Result.Error "Invalid date format" + p "2018-09-09 10:43:54+0100" == Stdlib.Result.Result.Error("Invalid date format") -p "2018-09-09 11:43:54+0200" = Stdlib.Result.Result.Error "Invalid date format" + p "2018-09-09 11:43:54+0200" == Stdlib.Result.Result.Error("Invalid date format") -p "2018-09-24T17:48:00" = Stdlib.Result.Result.Error "Invalid date format" + p "2018-09-24T17:48:00" == Stdlib.Result.Result.Error("Invalid date format") -p "2018-09-24T18:09:24+0200" = Stdlib.Result.Result.Error "Invalid date format" + p "2018-09-24T18:09:24+0200" == Stdlib.Result.Result.Error("Invalid date format") -p "1999-03-22T05:06:07+01:00" = Stdlib.Result.Result.Error "Invalid date format" + p "1999-03-22T05:06:07+01:00" + == Stdlib.Result.Result.Error("Invalid date format") -p "1999-03-22T05:06:07.000Z" = Stdlib.Result.Result.Error "Invalid date format" + p "1999-03-22T05:06:07.000Z" == Stdlib.Result.Result.Error("Invalid date format") -p "2006-06-09T10:20:30.040" = Stdlib.Result.Result.Error "Invalid date format" + p "2006-06-09T10:20:30.040" == Stdlib.Result.Result.Error("Invalid date format") -p "2006-06-09T10:20:30.040+02:00" = Stdlib.Result.Result.Error "Invalid date format" + p "2006-06-09T10:20:30.040+02:00" + == Stdlib.Result.Result.Error("Invalid date format") -p "20061204T1020Z" = Stdlib.Result.Result.Error "Invalid date format" + p "20061204T1020Z" == Stdlib.Result.Result.Error("Invalid date format") -p "20061204T1020" = Stdlib.Result.Result.Error "Invalid date format" + p "20061204T1020" == Stdlib.Result.Result.Error("Invalid date format") -p "2008-09-15T09:30:41.1" = Stdlib.Result.Result.Error "Invalid date format" + p "2008-09-15T09:30:41.1" == Stdlib.Result.Result.Error("Invalid date format") -p "2008-09-15T09:30:41.12" = Stdlib.Result.Result.Error "Invalid date format" + p "2008-09-15T09:30:41.12" == Stdlib.Result.Result.Error("Invalid date format") -p "2008-09-15T09:30:41.123" = Stdlib.Result.Result.Error "Invalid date format" + p "2008-09-15T09:30:41.123" == Stdlib.Result.Result.Error("Invalid date format") -p "2008-09-15T09:30:41.1234" = Stdlib.Result.Result.Error "Invalid date format" + p "2008-09-15T09:30:41.1234" == Stdlib.Result.Result.Error("Invalid date format") -p "2008-09-15T09:30:41.12345" = Stdlib.Result.Result.Error "Invalid date format" + p "2008-09-15T09:30:41.12345" + == Stdlib.Result.Result.Error("Invalid date format") -p "2008-09-15T09:30:41.123456" = Stdlib.Result.Result.Error "Invalid date format" + p "2008-09-15T09:30:41.123456" + == Stdlib.Result.Result.Error("Invalid date format") -p "2008-09-15T09:30:41.1234567" = Stdlib.Result.Result.Error "Invalid date format" + p "2008-09-15T09:30:41.1234567" + == Stdlib.Result.Result.Error("Invalid date format") -p "2008-09-15T09:30:41.1234567Z" = Stdlib.Result.Result.Error "Invalid date format" + p "2008-09-15T09:30:41.1234567Z" + == Stdlib.Result.Result.Error("Invalid date format") -p "2008-09-15T09:30:41.7752486-07:00" = Stdlib.Result.Result.Error - "Invalid date format" + p "2008-09-15T09:30:41.7752486-07:00" + == Stdlib.Result.Result.Error("Invalid date format") -p "2008-09-15T09:30:41.7752486-04:00" = Stdlib.Result.Result.Error - "Invalid date format" + p "2008-09-15T09:30:41.7752486-04:00" + == Stdlib.Result.Result.Error("Invalid date format") -p "20061204T10:20:54.67am" = Stdlib.Result.Result.Error "Invalid date format" + p "20061204T10:20:54.67am" == Stdlib.Result.Result.Error("Invalid date format") -p "20061204T10:20:54.67am" = Stdlib.Result.Result.Error "Invalid date format" + p "20061204T10:20:54.67am" == Stdlib.Result.Result.Error("Invalid date format") -p "20061204T1020am" = Stdlib.Result.Result.Error "Invalid date format" + p "20061204T1020am" == Stdlib.Result.Result.Error("Invalid date format") -p "20061204T1020AM" = Stdlib.Result.Result.Error "Invalid date format" + p "20061204T1020AM" == Stdlib.Result.Result.Error("Invalid date format") -p "20061204T1020PM" = Stdlib.Result.Result.Error "Invalid date format" + p "20061204T1020PM" == Stdlib.Result.Result.Error("Invalid date format") -p "20061204T1020pm" = Stdlib.Result.Result.Error "Invalid date format" + p "20061204T1020pm" == Stdlib.Result.Result.Error("Invalid date format") -p "15/06/2008 08:30" = Stdlib.Result.Result.Error "Invalid date format" + p "15/06/2008 08:30" == Stdlib.Result.Result.Error("Invalid date format") -p "18/08/2015 06:30:15.006542" = Stdlib.Result.Result.Error "Invalid date format" + p "18/08/2015 06:30:15.006542" + == Stdlib.Result.Result.Error("Invalid date format") -p "Mon, 15 Sep 2008 09:30:41 GMT" = Stdlib.Result.Result.Error "Invalid date format" + p "Mon, 15 Sep 2008 09:30:41 GMT" + == Stdlib.Result.Result.Error("Invalid date format") -p "2/16/2008 12:15:12 PM" = Stdlib.Result.Result.Error "Invalid date format" + p "2/16/2008 12:15:12 PM" == Stdlib.Result.Result.Error("Invalid date format") -p "16/02/2008 12:15:12" = Stdlib.Result.Result.Error "Invalid date format" + p "16/02/2008 12:15:12" == Stdlib.Result.Result.Error("Invalid date format") -p "12 Juni 2008" = Stdlib.Result.Result.Error "Invalid date format" + p "12 Juni 2008" == Stdlib.Result.Result.Error("Invalid date format") -p "Friday, April 10, 2009" = Stdlib.Result.Result.Error "Invalid date format" + p "Friday, April 10, 2009" == Stdlib.Result.Result.Error("Invalid date format") -p "2006-06-09" = Stdlib.Result.Result.Error "Invalid date format" -p "2012-01-31" = Stdlib.Result.Result.Error "Invalid date format" + p "2006-06-09" == Stdlib.Result.Result.Error("Invalid date format") + p "2012-01-31" == Stdlib.Result.Result.Error("Invalid date format") -p "2016-12-27 14:40:46 +0000" = Stdlib.Result.Result.Error "Invalid date format" + p "2016-12-27 14:40:46 +0000" + == Stdlib.Result.Result.Error("Invalid date format") -p "2017-08-02" = Stdlib.Result.Result.Error "Invalid date format" -p "2T102030Z" = Stdlib.Result.Result.Error "Invalid date format" -p "31-01-12" = Stdlib.Result.Result.Error "Invalid date format" -p "31-01-2012" = Stdlib.Result.Result.Error "Invalid date format" -p "Jun 5 Sun" = Stdlib.Result.Result.Error "Invalid date format" + p "2017-08-02" == Stdlib.Result.Result.Error("Invalid date format") + p "2T102030Z" == Stdlib.Result.Result.Error("Invalid date format") + p "31-01-12" == Stdlib.Result.Result.Error("Invalid date format") + p "31-01-2012" == Stdlib.Result.Result.Error("Invalid date format") + p "Jun 5 Sun" == Stdlib.Result.Result.Error("Invalid date format") -p "Thursday, April 10, 2008" = Stdlib.Result.Result.Error "Invalid date format" + p "Thursday, April 10, 2008" == Stdlib.Result.Result.Error("Invalid date format") -p "00:00:10.512345678" = Stdlib.Result.Result.Error "Invalid date format" + p "00:00:10.512345678" == Stdlib.Result.Result.Error("Invalid date format") -p "01-31-2012" = Stdlib.Result.Result.Error "Invalid date format" -p "10.5" = Stdlib.Result.Result.Error "Invalid date format" -p "10.5+02:00" = Stdlib.Result.Result.Error "Invalid date format" -p "10/04/2008" = Stdlib.Result.Result.Error "Invalid date format" -p "10:20:30.040" = Stdlib.Result.Result.Error "Invalid date format" + p "01-31-2012" == Stdlib.Result.Result.Error("Invalid date format") + p "10.5" == Stdlib.Result.Result.Error("Invalid date format") + p "10.5+02:00" == Stdlib.Result.Result.Error("Invalid date format") + p "10/04/2008" == Stdlib.Result.Result.Error("Invalid date format") + p "10:20:30.040" == Stdlib.Result.Result.Error("Invalid date format") -p "10:20:30.040+02:00" = Stdlib.Result.Result.Error "Invalid date format" + p "10:20:30.040+02:00" == Stdlib.Result.Result.Error("Invalid date format") -p "11:03:01" = Stdlib.Result.Result.Error "Invalid date format" + p "11:03:01" == Stdlib.Result.Result.Error("Invalid date format") -p "13:03:15.454+0530" = Stdlib.Result.Result.Error "Invalid date format" + p "13:03:15.454+0530" == Stdlib.Result.Result.Error("Invalid date format") -p "1999-03-22 AD" = Stdlib.Result.Result.Error "Invalid date format" + p "1999-03-22 AD" == Stdlib.Result.Result.Error("Invalid date format") -p "1999-03-22+01:00" = Stdlib.Result.Result.Error "Invalid date format" + p "1999-03-22+01:00" == Stdlib.Result.Result.Error("Invalid date format") -p "+2006-06-09" = Stdlib.Result.Result.Error "Invalid date format" + p "+2006-06-09" == Stdlib.Result.Result.Error("Invalid date format") -p "+2006-06-09T10:20:30.040" = Stdlib.Result.Result.Error "Invalid date format" + p "+2006-06-09T10:20:30.040" == Stdlib.Result.Result.Error("Invalid date format") -p "1999-03-22T05:06:07+01:00[Europe/Paris]" = Stdlib.Result.Result.Error - "Invalid date format" + p "1999-03-22T05:06:07+01:00[Europe/Paris]" + == Stdlib.Result.Result.Error("Invalid date format") -p "1999-03-22T05:06:07.000+01:00[Europe/Paris]" = Stdlib.Result.Result.Error - "Invalid date format" + p "1999-03-22T05:06:07.000+01:00[Europe/Paris]" + == Stdlib.Result.Result.Error("Invalid date format") -p "1999-03-22T05:06:07.000[Europe/Paris]" = Stdlib.Result.Result.Error - "Invalid date format" + p "1999-03-22T05:06:07.000[Europe/Paris]" + == Stdlib.Result.Result.Error("Invalid date format") -p "1999-081+01:00" = Stdlib.Result.Result.Error "Invalid date format" + p "1999-081+01:00" == Stdlib.Result.Result.Error("Invalid date format") -p "1999-W13-2" = Stdlib.Result.Result.Error "Invalid date format" -p "19990322" = Stdlib.Result.Result.Error "Invalid date format" -p "19990322+0100" = Stdlib.Result.Result.Error "Invalid date format" -p "1999W132" = Stdlib.Result.Result.Error "Invalid date format" + p "1999-W13-2" == Stdlib.Result.Result.Error("Invalid date format") + p "19990322" == Stdlib.Result.Result.Error("Invalid date format") + p "19990322+0100" == Stdlib.Result.Result.Error("Invalid date format") + p "1999W132" == Stdlib.Result.Result.Error("Invalid date format") -p "2006-06-09T+02:00" = Stdlib.Result.Result.Error "Invalid date format" + p "2006-06-09T+02:00" == Stdlib.Result.Result.Error("Invalid date format") -p "2006-123" = Stdlib.Result.Result.Error "Invalid date format" + p "2006-123" == Stdlib.Result.Result.Error("Invalid date format") -p "2006-123T+02:00" = Stdlib.Result.Result.Error "Invalid date format" + p "2006-123T+02:00" == Stdlib.Result.Result.Error("Invalid date format") -p "2006-123T10:20:30.040" = Stdlib.Result.Result.Error "Invalid date format" + p "2006-123T10:20:30.040" == Stdlib.Result.Result.Error("Invalid date format") -p "2006-123T10:20:30.040+02:00" = Stdlib.Result.Result.Error "Invalid date format" + p "2006-123T10:20:30.040+02:00" + == Stdlib.Result.Result.Error("Invalid date format") -p "2006-W27-3" = Stdlib.Result.Result.Error "Invalid date format" + p "2006-W27-3" == Stdlib.Result.Result.Error("Invalid date format") -p "2006-W27-3T+02:00" = Stdlib.Result.Result.Error "Invalid date format" + p "2006-W27-3T+02:00" == Stdlib.Result.Result.Error("Invalid date format") -p "2006-W27-3T10:20:30.040" = Stdlib.Result.Result.Error "Invalid date format" + p "2006-W27-3T10:20:30.040" == Stdlib.Result.Result.Error("Invalid date format") -p "2006-W27-3T10:20:30.040+02:00" = Stdlib.Result.Result.Error "Invalid date format" + p "2006-W27-3T10:20:30.040+02:00" + == Stdlib.Result.Result.Error("Invalid date format") -p "20061204T10203Z" = Stdlib.Result.Result.Error "Invalid date format" + p "20061204T10203Z" == Stdlib.Result.Result.Error("Invalid date format") -p "20061204T102Z" = Stdlib.Result.Result.Error "Invalid date format" -p "20061204T10Z" = Stdlib.Result.Result.Error "Invalid date format" -p "20061204T1Z" = Stdlib.Result.Result.Error "Invalid date format" + p "20061204T102Z" == Stdlib.Result.Result.Error("Invalid date format") + p "20061204T10Z" == Stdlib.Result.Result.Error("Invalid date format") + p "20061204T1Z" == Stdlib.Result.Result.Error("Invalid date format") -p "2006120T102030Z" = Stdlib.Result.Result.Error "Invalid date format" + p "2006120T102030Z" == Stdlib.Result.Result.Error("Invalid date format") -p "200612T102030Z" = Stdlib.Result.Result.Error "Invalid date format" + p "200612T102030Z" == Stdlib.Result.Result.Error("Invalid date format") -p "20061T102030Z" = Stdlib.Result.Result.Error "Invalid date format" -p "2006T102030Z" = Stdlib.Result.Result.Error "Invalid date format" -p "200T102030Z" = Stdlib.Result.Result.Error "Invalid date format" -p "20T102030Z" = Stdlib.Result.Result.Error "Invalid date format" + p "20061T102030Z" == Stdlib.Result.Result.Error("Invalid date format") + p "2006T102030Z" == Stdlib.Result.Result.Error("Invalid date format") + p "200T102030Z" == Stdlib.Result.Result.Error("Invalid date format") + p "20T102030Z" == Stdlib.Result.Result.Error("Invalid date format") -p "Friday the 16th of May" = Stdlib.Result.Result.Error "Invalid date format" + p "Friday the 16th of May" == Stdlib.Result.Result.Error("Invalid date format") -p "Friday, May 16th 2014" = Stdlib.Result.Result.Error "Invalid date format" + p "Friday, May 16th 2014" == Stdlib.Result.Result.Error("Invalid date format") -p "Sat Dec 01 00:00:00 IST 2018" = Stdlib.Result.Result.Error "Invalid date format" + p "Sat Dec 01 00:00:00 IST 2018" + == Stdlib.Result.Result.Error("Invalid date format") -p "Saturday November 2012 10:45:42.720+0100" = Stdlib.Result.Result.Error - "Invalid date format" + p "Saturday November 2012 10:45:42.720+0100" + == Stdlib.Result.Result.Error("Invalid date format") -p "Sunday, June 5, 2013" = Stdlib.Result.Result.Error "Invalid date format" + p "Sunday, June 5, 2013" == Stdlib.Result.Result.Error("Invalid date format") -p "T10.5" = Stdlib.Result.Result.Error "Invalid date format" -p "T10.5+02:00" = Stdlib.Result.Result.Error "Invalid date format" -p "T10:20:30.040" = Stdlib.Result.Result.Error "Invalid date format" + p "T10.5" == Stdlib.Result.Result.Error("Invalid date format") + p "T10.5+02:00" == Stdlib.Result.Result.Error("Invalid date format") + p "T10:20:30.040" == Stdlib.Result.Result.Error("Invalid date format") -p "T10:20:30.040+02:00" = Stdlib.Result.Result.Error "Invalid date format" + p "T10:20:30.040+02:00" == Stdlib.Result.Result.Error("Invalid date format") -p "Thu, Aug 2 1985 08:30 PM" = Stdlib.Result.Result.Error "Invalid date format" + p "Thu, Aug 2 1985 08:30 PM" == Stdlib.Result.Result.Error("Invalid date format") -p "Thursday, August 2 1985 08:30 PM" = Stdlib.Result.Result.Error - "Invalid date format" + p "Thursday, August 2 1985 08:30 PM" + == Stdlib.Result.Result.Error("Invalid date format") -p "Tue, 02 Jan 2018 18:07:59 IST" = Stdlib.Result.Result.Error "Invalid date format" + p "Tue, 02 Jan 2018 18:07:59 IST" + == Stdlib.Result.Result.Error("Invalid date format") -p "mardi janvier 2018 14:51:02.354+0530" = Stdlib.Result.Result.Error - "Invalid date format" + p "mardi janvier 2018 14:51:02.354+0530" + == Stdlib.Result.Result.Error("Invalid date format") -p "20061204T1020 am" = Stdlib.Result.Result.Error "Invalid date format" + p "20061204T1020 am" == Stdlib.Result.Result.Error("Invalid date format") -p "20061204T1020 AM" = Stdlib.Result.Result.Error "Invalid date format" + p "20061204T1020 AM" == Stdlib.Result.Result.Error("Invalid date format") -p "2008-09-15T09:30:41 GMT" = Stdlib.Result.Result.Error "Invalid date format" + p "2008-09-15T09:30:41 GMT" == Stdlib.Result.Result.Error("Invalid date format") -p "2008-09-15T09:30.456" = Stdlib.Result.Result.Error "Invalid date format" + p "2008-09-15T09:30.456" == Stdlib.Result.Result.Error("Invalid date format") -// while space isn't allowed -p " 2006-06-09T10:20:30.040+02:00" = Stdlib.Result.Result.Error "Invalid date format" + // while space isn't allowed + p " 2006-06-09T10:20:30.040+02:00" + == Stdlib.Result.Result.Error("Invalid date format") -p "2006-06-09T10:20:30.040+02:00 " = Stdlib.Result.Result.Error "Invalid date format" + p "2006-06-09T10:20:30.040+02:00 " + == Stdlib.Result.Result.Error("Invalid date format") -p " 2006-06-09T10:20:30.040+02:00 " = Stdlib.Result.Result.Error - "Invalid date format" + p " 2006-06-09T10:20:30.040+02:00 " + == Stdlib.Result.Result.Error("Invalid date format") module LessThan = - Stdlib.DateTime.lessThan (d "2019-07-28T22:42:36Z") (d "2019-07-28T22:42:36Z") = false + Stdlib.DateTime.lessThan (d "2019-07-28T22:42:36Z") (d "2019-07-28T22:42:36Z") + == false - Stdlib.DateTime.lessThan (d "2019-07-28T22:42:36Z") (d "2020-11-26T04:37:46Z") = true + Stdlib.DateTime.lessThan (d "2019-07-28T22:42:36Z") (d "2020-11-26T04:37:46Z") + == true module LessThanOrEquals = Stdlib.DateTime.lessThanOrEqualTo (d "2021-07-28T22:42:36Z") - (d "2020-11-26T04:37:46Z") = false + (d "2020-11-26T04:37:46Z") + == false Stdlib.DateTime.lessThanOrEqualTo (d "2019-07-28T22:42:36Z") - (d "2020-11-26T04:37:46Z") = true + (d "2020-11-26T04:37:46Z") + == true module GreaterThan = - Stdlib.DateTime.greaterThan (d "2019-07-28T22:42:36Z") (d "2019-07-28T22:42:36Z") = false + Stdlib.DateTime.greaterThan (d "2019-07-28T22:42:36Z") (d "2019-07-28T22:42:36Z") + == false - Stdlib.DateTime.greaterThan (d "2020-11-26T04:37:46Z") (d "2019-07-28T22:42:36Z") = true + Stdlib.DateTime.greaterThan (d "2020-11-26T04:37:46Z") (d "2019-07-28T22:42:36Z") + == true module GreaterThanOrEquals = Stdlib.DateTime.greaterThanOrEqualTo (d "2019-11-26T04:37:46Z") - (d "2020-07-28T22:42:36Z") = false + (d "2020-07-28T22:42:36Z") + == false Stdlib.DateTime.greaterThanOrEqualTo (d "2020-11-26T04:37:46Z") - (d "2020-11-26T04:37:46Z") = true + (d "2020-11-26T04:37:46Z") + == true module Fields = - Stdlib.DateTime.year_v0 (d "2019-07-28T22:42:36Z") = 2019L - Stdlib.DateTime.month_v0 (d "2019-07-28T22:42:36Z") = 7L - Stdlib.DateTime.day_v0 (d "2019-07-28T22:42:36Z") = 28L - Stdlib.DateTime.hour (d "2019-12-27T03:27:36Z") = 3L // Leif's test case - Stdlib.DateTime.minute (d "2019-07-28T22:42:36Z") = 42L - Stdlib.DateTime.weekday_v0 (d "2019-07-22T22:42:36Z") = 1L // Monday - Stdlib.DateTime.weekday_v0 (d "2019-07-23T22:42:36Z") = 2L - Stdlib.DateTime.weekday_v0 (d "2019-07-24T22:42:36Z") = 3L - Stdlib.DateTime.weekday_v0 (d "2019-07-25T22:42:36Z") = 4L - Stdlib.DateTime.weekday_v0 (d "2019-07-26T22:42:36Z") = 5L - Stdlib.DateTime.weekday_v0 (d "2019-07-27T22:42:36Z") = 6L - Stdlib.DateTime.weekday_v0 (d "2019-07-28T22:42:36Z") = 7L + Stdlib.DateTime.year (d "2019-07-28T22:42:36Z") == 2019L + Stdlib.DateTime.month (d "2019-07-28T22:42:36Z") == 7L + Stdlib.DateTime.day (d "2019-07-28T22:42:36Z") == 28L + Stdlib.DateTime.hour (d "2019-12-27T03:27:36Z") == 3L // Leif's test case + Stdlib.DateTime.minute (d "2019-07-28T22:42:36Z") == 42L + Stdlib.DateTime.weekday (d "2019-07-22T22:42:36Z") == 1L // Monday + Stdlib.DateTime.weekday (d "2019-07-23T22:42:36Z") == 2L + Stdlib.DateTime.weekday (d "2019-07-24T22:42:36Z") == 3L + Stdlib.DateTime.weekday (d "2019-07-25T22:42:36Z") == 4L + Stdlib.DateTime.weekday (d "2019-07-26T22:42:36Z") == 5L + Stdlib.DateTime.weekday (d "2019-07-27T22:42:36Z") == 6L + Stdlib.DateTime.weekday (d "2019-07-28T22:42:36Z") == 7L module Epoch1919 = - Stdlib.DateTime.year_v0 (d "1919-07-28T22:42:36Z") = 1919L - Stdlib.DateTime.month_v0 (d "1919-07-28T22:42:36Z") = 7L - Stdlib.DateTime.day_v0 (d "1919-07-28T22:42:36Z") = 28L - Stdlib.DateTime.weekday_v0 (d "1919-07-28T22:42:36Z") = 1L - Stdlib.DateTime.hour (d "1919-12-27T03:27:36Z") = 3L - Stdlib.DateTime.minute (d "1919-07-28T22:42:36Z") = 42L - Stdlib.DateTime.second (d "1919-07-28T22:42:36Z") = 36L + Stdlib.DateTime.year (d "1919-07-28T22:42:36Z") == 1919L + Stdlib.DateTime.month (d "1919-07-28T22:42:36Z") == 7L + Stdlib.DateTime.day (d "1919-07-28T22:42:36Z") == 28L + Stdlib.DateTime.weekday (d "1919-07-28T22:42:36Z") == 1L + Stdlib.DateTime.hour (d "1919-12-27T03:27:36Z") == 3L + Stdlib.DateTime.minute (d "1919-07-28T22:42:36Z") == 42L + Stdlib.DateTime.second (d "1919-07-28T22:42:36Z") == 36L module Epoch1969 = - Stdlib.DateTime.year_v0 (d "1969-07-28T22:42:36Z") = 1969L - Stdlib.DateTime.month_v0 (d "1969-07-28T22:42:36Z") = 7L - Stdlib.DateTime.day_v0 (d "1969-07-28T22:42:36Z") = 28L - Stdlib.DateTime.weekday_v0 (d "1969-07-28T22:42:36Z") = 1L - Stdlib.DateTime.hour (d "1969-12-27T03:27:36Z") = 3L - Stdlib.DateTime.minute (d "1969-07-28T22:42:36Z") = 42L - Stdlib.DateTime.second (d "1969-07-28T22:42:36Z") = 36L + Stdlib.DateTime.year (d "1969-07-28T22:42:36Z") == 1969L + Stdlib.DateTime.month (d "1969-07-28T22:42:36Z") == 7L + Stdlib.DateTime.day (d "1969-07-28T22:42:36Z") == 28L + Stdlib.DateTime.weekday (d "1969-07-28T22:42:36Z") == 1L + Stdlib.DateTime.hour (d "1969-12-27T03:27:36Z") == 3L + Stdlib.DateTime.minute (d "1969-07-28T22:42:36Z") == 42L + Stdlib.DateTime.second (d "1969-07-28T22:42:36Z") == 36L module Epoch1970 = - Stdlib.DateTime.year_v0 (d "1970-07-28T22:42:36Z") = 1970L - Stdlib.DateTime.month_v0 (d "1970-07-28T22:42:36Z") = 7L - Stdlib.DateTime.day_v0 (d "1970-07-28T22:42:36Z") = 28L - Stdlib.DateTime.weekday_v0 (d "1970-07-28T22:42:36Z") = 2L - Stdlib.DateTime.hour (d "1970-12-27T03:27:36Z") = 3L - Stdlib.DateTime.minute (d "1970-07-28T22:42:36Z") = 42L - Stdlib.DateTime.minute (d "1970-07-28T22:42:36Z") = 42L - Stdlib.DateTime.second (d "1970-07-28T22:42:36Z") = 36L - Stdlib.DateTime.second (d "1970-07-28T22:42:36Z") = 36L + Stdlib.DateTime.year (d "1970-07-28T22:42:36Z") == 1970L + Stdlib.DateTime.month (d "1970-07-28T22:42:36Z") == 7L + Stdlib.DateTime.day (d "1970-07-28T22:42:36Z") == 28L + Stdlib.DateTime.weekday (d "1970-07-28T22:42:36Z") == 2L + Stdlib.DateTime.hour (d "1970-12-27T03:27:36Z") == 3L + Stdlib.DateTime.minute (d "1970-07-28T22:42:36Z") == 42L + Stdlib.DateTime.minute (d "1970-07-28T22:42:36Z") == 42L + Stdlib.DateTime.second (d "1970-07-28T22:42:36Z") == 36L + Stdlib.DateTime.second (d "1970-07-28T22:42:36Z") == 36L module Convertsion = - Stdlib.DateTime.toString_v0 (d "2019-07-28T22:42:36Z") = "2019-07-28T22:42:36Z" + Stdlib.DateTime.toString (d "2019-07-28T22:42:36Z") == "2019-07-28T22:42:36Z" - Stdlib.DateTime.atStartOfDay_v0 (d "2019-07-28T22:42:36Z") = (d - "2019-07-28T00:00:00Z") + Stdlib.DateTime.atStartOfDay (d "2019-07-28T22:42:36Z") + == (d "2019-07-28T00:00:00Z") - Stdlib.DateTime.toSeconds_v0 (d "2019-07-28T22:42:36Z") = 1564353756L - Stdlib.DateTime.toSeconds_v0 (d "2075-11-14T11:01:35Z") = 3340954895L + Stdlib.DateTime.toSeconds (d "2019-07-28T22:42:36Z") == 1564353756L + Stdlib.DateTime.toSeconds (d "2075-11-14T11:01:35Z") == 3340954895L - Stdlib.DateTime.toStringISO8601BasicDateTime_v0 (d "2019-07-28T22:42:36Z") = "20190728T224236Z" + Stdlib.DateTime.toStringISO8601BasicDateTime (d "2019-07-28T22:42:36Z") + == "20190728T224236Z" - Stdlib.DateTime.toStringISO8601BasicDateTime_v0 (d "1919-07-28T22:42:36Z") = "19190728T224236Z" + Stdlib.DateTime.toStringISO8601BasicDateTime (d "1919-07-28T22:42:36Z") + == "19190728T224236Z" - Stdlib.DateTime.toStringISO8601BasicDate_v0 (d "2019-07-28T22:42:36Z") = "20190728" + Stdlib.DateTime.toStringISO8601BasicDate (d "2019-07-28T22:42:36Z") + == "20190728" - Stdlib.DateTime.toStringISO8601BasicDate_v0 (d "1069-07-28T22:42:36Z") = "10690728" + Stdlib.DateTime.toStringISO8601BasicDate (d "1069-07-28T22:42:36Z") + == "10690728" - 1095379198L |> Stdlib.DateTime.fromSeconds_v0 |> Stdlib.DateTime.toSeconds_v0 = 1095379198L + 1095379198L |> Stdlib.DateTime.fromSeconds |> Stdlib.DateTime.toSeconds + == 1095379198L (d "2019-07-28T22:42:36Z") - |> Stdlib.DateTime.toSeconds_v0 - |> Stdlib.DateTime.fromSeconds_v0 - |> Stdlib.DateTime.toString_v0 = "2019-07-28T22:42:36Z" -// Stdlib.DateTime.today_v0 |> Stdlib.DateTime.toString_v0 = "2020-10-17T00:00:00Z" // todo, how can we test this + |> Stdlib.DateTime.toSeconds + |> Stdlib.DateTime.fromSeconds + |> Stdlib.DateTime.toString + == "2019-07-28T22:42:36Z" +// Stdlib.DateTime.today |> Stdlib.DateTime.toString == "2020-10-17T00:00:00Z" // todo, how can we test this module AddingSeconds = - Stdlib.DateTime.addSeconds_v0 (d "2020-11-26T04:37:46Z") 0L = (d - "2020-11-26T04:37:46Z") + Stdlib.DateTime.addSeconds (d "2020-11-26T04:37:46Z") 0L + == (d "2020-11-26T04:37:46Z") - Stdlib.DateTime.addSeconds_v0 (d "2020-11-26T04:37:46Z") 1L = (d - "2020-11-26T04:37:47Z") + Stdlib.DateTime.addSeconds (d "2020-11-26T04:37:46Z") 1L + == (d "2020-11-26T04:37:47Z") - Stdlib.DateTime.addSeconds_v0 (d "2020-11-26T04:37:46Z") 10L = (d - "2020-11-26T04:37:56Z") + Stdlib.DateTime.addSeconds (d "2020-11-26T04:37:46Z") 10L + == (d "2020-11-26T04:37:56Z") - Stdlib.DateTime.addSeconds_v0 (d "2020-11-26T04:37:46Z") 1000000L = (d - "2020-12-07T18:24:26Z") + Stdlib.DateTime.addSeconds (d "2020-11-26T04:37:46Z") 1000000L + == (d "2020-12-07T18:24:26Z") - Stdlib.DateTime.addSeconds_v0 (d "2020-11-26T04:37:46Z") -10L = (d - "2020-11-26T04:37:36Z") + Stdlib.DateTime.addSeconds (d "2020-11-26T04:37:46Z") -10L + == (d "2020-11-26T04:37:36Z") module SubtractingSeconds = - Stdlib.DateTime.subtractSeconds_v0 (d "2020-11-26T04:37:46Z") 0L = (d - "2020-11-26T04:37:46Z") + Stdlib.DateTime.subtractSeconds (d "2020-11-26T04:37:46Z") 0L + == (d "2020-11-26T04:37:46Z") - Stdlib.DateTime.subtractSeconds_v0 (d "2020-11-26T04:37:46Z") 1L = (d - "2020-11-26T04:37:45Z") + Stdlib.DateTime.subtractSeconds (d "2020-11-26T04:37:46Z") 1L + == (d "2020-11-26T04:37:45Z") - Stdlib.DateTime.subtractSeconds_v0 (d "2020-11-26T04:37:46Z") 10L = (d - "2020-11-26T04:37:36Z") + Stdlib.DateTime.subtractSeconds (d "2020-11-26T04:37:46Z") 10L + == (d "2020-11-26T04:37:36Z") - Stdlib.DateTime.subtractSeconds_v0 (d "2020-11-26T04:37:46Z") 1000000L = (d - "2020-11-14T14:51:06Z") + Stdlib.DateTime.subtractSeconds (d "2020-11-26T04:37:46Z") 1000000L + == (d "2020-11-14T14:51:06Z") - Stdlib.DateTime.subtractSeconds_v0 (d "2020-11-26T04:37:46Z") -10L = (d - "2020-11-26T04:37:56Z") + Stdlib.DateTime.subtractSeconds (d "2020-11-26T04:37:46Z") -10L + == (d "2020-11-26T04:37:56Z") module Difference = - Stdlib.DateTime.subtract (d "2020-11-26T04:37:46Z") (d "2020-11-26T04:37:46Z") = 0L + Stdlib.DateTime.subtract (d "2020-11-26T04:37:46Z") (d "2020-11-26T04:37:46Z") + == 0L - Stdlib.DateTime.subtract (d "2020-11-26T04:37:46Z") (d "2020-11-26T04:37:45Z") = 1L + Stdlib.DateTime.subtract (d "2020-11-26T04:37:46Z") (d "2020-11-26T04:37:45Z") + == 1L - Stdlib.DateTime.subtract (d "2020-11-26T04:37:46Z") (d "2020-11-26T04:37:36Z") = 10L + Stdlib.DateTime.subtract (d "2020-11-26T04:37:46Z") (d "2020-11-26T04:37:36Z") + == 10L - Stdlib.DateTime.subtract (d "2020-11-26T04:37:46Z") (d "2020-11-26T04:37:56Z") = -10L + Stdlib.DateTime.subtract (d "2020-11-26T04:37:46Z") (d "2020-11-26T04:37:56Z") + == -10L - Stdlib.DateTime.subtract (d "2020-11-26T04:37:46Z") (d "2020-11-14T14:51:06Z") = 1000000L + Stdlib.DateTime.subtract (d "2020-11-26T04:37:46Z") (d "2020-11-14T14:51:06Z") + == 1000000L - Stdlib.DateTime.subtract (d "2020-11-14T14:51:06Z") (d "2020-11-26T04:37:46Z") = -1000000L + Stdlib.DateTime.subtract (d "2020-11-14T14:51:06Z") (d "2020-11-26T04:37:46Z") + == -1000000L - Stdlib.DateTime.subtract (d "1921-01-01T12:00:00Z") (d "2021-01-01T12:00:00Z") = -3155760000L + Stdlib.DateTime.subtract (d "1921-01-01T12:00:00Z") (d "2021-01-01T12:00:00Z") + == -3155760000L - Stdlib.DateTime.subtract (d "2021-01-01T12:00:00Z") (d "1921-01-01T12:00:00Z") = 3155760000L \ No newline at end of file + Stdlib.DateTime.subtract (d "2021-01-01T12:00:00Z") (d "1921-01-01T12:00:00Z") + == 3155760000L \ No newline at end of file diff --git a/backend/testfiles/execution/stdlib/dict.dark b/backend/testfiles/execution/stdlib/dict.dark index 2ac13787b7..f46a8c5508 100644 --- a/backend/testfiles/execution/stdlib/dict.dark +++ b/backend/testfiles/execution/stdlib/dict.dark @@ -1,22 +1,31 @@ module Empty = - Stdlib.Dict.empty = Dict { } + Stdlib.Dict.empty == Dict { } module FilterMap = - Stdlib.Dict.filterMap_v0 (Dict { }) (fun key value -> 0L) = (Dict { }) - - Stdlib.Dict.filterMap_v0 (Dict { a = "x"; b = "y"; c = "z" }) (fun key value -> - if value == "y" then - Stdlib.Option.Option.None - else - (Stdlib.Option.Option.Some(key ++ value))) = (Dict { c = "cz"; a = "ax" }) - - (Stdlib.Dict.filterMap_v0 (Dict { a = "x"; b = "y"; c = "z" }) (fun key value -> - if value == "y" then - false - else - Stdlib.Option.Option.Some(key ++ value))) = Builtin.testDerrorMessage - """Function return value should be a PACKAGE.Darklang.Stdlib.Option.Option<'b>. However, a Bool (false) was returned instead. + Stdlib.Dict.filterMap (Dict { }) (fun key value -> 0L) == (Dict { }) + + Stdlib.Dict.filterMap + (Dict { a = "x"; b = "y"; c = "z" }) + (fun key value -> + if value == "y" then + Stdlib.Option.Option.None() + else + (Stdlib.Option.Option.Some(key ++ value)) + ) + == (Dict { c = "cz"; a = "ax" }) + + // had to update the formatting for this to pass + (Stdlib.Dict.filterMap + (Dict { a = "x"; b = "y"; c = "z" }) + (fun key value -> + if value == "y" then + false + else + Stdlib.Option.Option.Some(key ++ value) + ) + ) + == Builtin.testDerrorMessage """Function return value should be a PACKAGE.Darklang.Stdlib.Option.Option<'b>. However, a Bool (false) was returned instead. Expected: PACKAGE.Darklang.Stdlib.Option.Option<'b> Actual: a Bool: false""" @@ -24,178 +33,179 @@ Actual: a Bool: false""" module Filter = - Stdlib.Dict.filter (Dict { key1 = "val1"; key2 = "val2" }) (fun k v -> k == "key1") = (Dict - { key1 = "val1" }) + // had to wrap this in parens to get it to pass + (Stdlib.Dict.filter + (Dict { key1 = "val1"; key2 = "val2" }) + (fun k v -> k == "key1")) + == (Dict { key1 = "val1" }) - Stdlib.Dict.filter (Dict { key1 = 1L; key2 = 3L }) (fun k v -> v < 2L) = (Dict - { key1 = 1L }) + (Stdlib.Dict.filter + (Dict { key1 = 1L; key2 = 3L }) + (fun k v -> v < 2L)) + == (Dict { key1 = 1L }) - Stdlib.Dict.filter (Dict { }) (fun k v -> 0L) = (Dict { }) + (Stdlib.Dict.filter (Dict { }) (fun k v -> 0L)) == (Dict { }) - Stdlib.Dict.filter (Dict { a = 1L; b = 2L; c = 3L }) (fun k v -> 2L) = Builtin.testDerrorMessage - """Function return value should be a Bool. However, an Int64 (2) was returned instead. + Stdlib.Dict.filter (Dict { a = 1L; b = 2L; c = 3L }) (fun k v -> 2L) == + Builtin.testDerrorMessage """Function return value should be a Bool. However, an Int64 (2) was returned instead. Expected: Bool Actual: an Int64: 2""" module FromListOverwritingDuplicates = - Stdlib.Dict.fromListOverwritingDuplicates_v0 - [ ("duplicate_key", 1L); ("b", 2L); ("duplicate_key", 3L) ] = (Dict - { b = 2L; duplicate_key = 3L }) + Stdlib.Dict.fromListOverwritingDuplicates + [ ("duplicate_key", 1L); ("b", 2L); ("duplicate_key", 3L) ] + == (Dict { b = 2L; duplicate_key = 3L }) - Stdlib.Dict.fromListOverwritingDuplicates_v0 [ ("a", 1L); ("b", 2L); ("c", 3L) ] = (Dict - { c = 3L; b = 2L; a = 1L }) + (Stdlib.Dict.fromListOverwritingDuplicates [ ("a", 1L); ("b", 2L); ("c", 3L) ]) + == (Dict { c = 3L; b = 2L; a = 1L }) - Stdlib.Dict.fromListOverwritingDuplicates_v0 [] = (Dict { }) + Stdlib.Dict.fromListOverwritingDuplicates [] == (Dict { }) - Stdlib.Dict.fromListOverwritingDuplicates_v0 [ Builtin.testRuntimeError "" ] = Builtin.testDerrorMessage - "" + Stdlib.Dict.fromListOverwritingDuplicates [ Builtin.testRuntimeError "" ] == Builtin.testDerrorMessage "" // In Dict.fromListOverwritingDuplicates's 1st argument (`entries`), the nested value `entries[1]` should be a (String, 'b). However, an Int64 (2) was passed instead.\n\nExpected: (String, 'b)\nActual: an Int64: 2 - Stdlib.Dict.fromListOverwritingDuplicates_v0 [ (1L, 2L) ] = Builtin.testDerrorMessage - "PACKAGE.Darklang.Stdlib.Dict.fromListOverwritingDuplicates's 1st argument (`entries`) should be a List<(String * 'a)>. However, a List<(Int64, Int64)> ([ (1, 2)...) was passed instead. + Stdlib.Dict.fromListOverwritingDuplicates [ (1L, 2L) ] == Builtin.testDerrorMessage + """PACKAGE.Darklang.Stdlib.Dict.fromListOverwritingDuplicates's 1st argument (`entries`) should be a List<(String * 'a)>. However, a List<(Int64, Int64)> ([ (1, 2)...) was passed instead. Expected: (entries: List<(String * 'a)>) -Actual: a List<(Int64, Int64)>: [\n (1, 2)\n]" +Actual: a List<(Int64, Int64)>: [\n (1, 2)\n]""" - Stdlib.Dict.fromListOverwritingDuplicates_v0 [ 1L ] = Builtin.testDerrorMessage - "PACKAGE.Darklang.Stdlib.Dict.fromListOverwritingDuplicates's 1st argument (`entries`) should be a List<(String * 'a)>. However, a List ([ 1]) was passed instead. + Stdlib.Dict.fromListOverwritingDuplicates [ 1L ] == Builtin.testDerrorMessage + """PACKAGE.Darklang.Stdlib.Dict.fromListOverwritingDuplicates's 1st argument (`entries`) should be a List<(String * 'a)>. However, a List ([ 1]) was passed instead. Expected: (entries: List<(String * 'a)>) -Actual: a List: [\n 1\n]" +Actual: a List: [\n 1\n]""" module FromList = // CLEANUP the first test here feels surprising - should it error or something? - Stdlib.Dict.fromList_v0 [ ("duplicate_key", 1L); ("b", 2L); ("duplicate_key", 3L) ] = Stdlib.Option.Option.None - - Stdlib.Dict.fromList_v0 [ ("a", 1L); ("b", 2L); ("c", 3L) ] = PACKAGE - .Darklang - .Stdlib - .Option - .Option - .Some(Dict { c = 3L; b = 2L; a = 1L }) - - Stdlib.Dict.fromList_v0 [ ("Content-Length", "0"); ("Server", "dark") ] = PACKAGE - .Darklang - .Stdlib - .Option - .Option - .Some( + Stdlib.Dict.fromList [ ("duplicate_key", 1L); ("b", 2L); ("duplicate_key", 3L) ] == Stdlib.Option.Option.None() + + Stdlib.Dict.fromList [ ("a", 1L); ("b", 2L); ("c", 3L) ] + == PACKAGE.Darklang.Stdlib.Option.Option.Some(Dict { c = 3L; b = 2L; a = 1L }) + + Stdlib.Dict.fromList [ ("Content-Length", "0"); ("Server", "dark") ] + == PACKAGE.Darklang.Stdlib.Option.Option.Some( Dict { ``Content-Length`` = "0" - Server = "dark" } + ``Server`` = "dark" } ) - Stdlib.Dict.fromList_v0 [] = Stdlib.Option.Option.Some(Dict { }) + Stdlib.Dict.fromList [] == Stdlib.Option.Option.Some(Dict { }) - Stdlib.Dict.fromList_v0 [ Builtin.testRuntimeError "" ] = Builtin.testDerrorMessage - "" + Stdlib.Dict.fromList [ Builtin.testRuntimeError "" ] == Builtin.testDerrorMessage "" // CLEANUP this error message is the goal once Dvals include typeRefs: //Test.runtimeError "In Dict.fromList's 1st argument (`entries`), the nested value `entries[0][0]` should be a String. However, an Int64 (1) was passed instead.\n\nExpected: String\nActual: an Int64: 1" - Stdlib.Dict.fromList_v0 [ (1L, 1L) ] = Builtin.testDerrorMessage - "PACKAGE.Darklang.Stdlib.Dict.fromList's 1st argument (`entries`) should be a List<(String * 'a)>. However, a List<(Int64, Int64)> ([ (1, 1)...) was passed instead. + Stdlib.Dict.fromList [ (1L, 1L) ] == Builtin.testDerrorMessage + """PACKAGE.Darklang.Stdlib.Dict.fromList's 1st argument (`entries`) should be a List<(String * 'a)>. However, a List<(Int64, Int64)> ([ (1, 1)...) was passed instead. Expected: (entries: List<(String * 'a)>) -Actual: a List<(Int64, Int64)>: [\n (1, 1)\n]" +Actual: a List<(Int64, Int64)>: [\n (1, 1)\n]""" module Get = - Stdlib.Dict.get (Dict { key1 = "val1" }) "key1" = Stdlib.Option.Option.Some "val1" + Stdlib.Dict.get (Dict { key1 = "val1" }) "key1" == Stdlib.Option.Option.Some("val1") - Stdlib.Dict.get (Dict { key1 = "val1" }) "" = Stdlib.Option.Option.None + Stdlib.Dict.get (Dict { key1 = "val1" }) "" == Stdlib.Option.Option.None() module IsEmpty = - Stdlib.Dict.isEmpty_v0 (Dict { a = 1L }) = false - Stdlib.Dict.isEmpty_v0 (Dict { }) = true + Stdlib.Dict.isEmpty (Dict { a = 1L }) == false + Stdlib.Dict.isEmpty (Dict { }) == true module Keys = - Stdlib.Dict.keys_v0 (Dict { key1 = "val1" }) = [ "key1" ] + Stdlib.Dict.keys (Dict { key1 = "val1" }) == [ "key1" ] module Map = - Stdlib.Dict.map_v0 (Dict { key1 = "val1"; key2 = "val2" }) (fun k x -> k ++ x) = (Dict - { key2 = "key2val2"; key1 = "key1val1" }) - - Stdlib.Dict.map_v0 (Dict { key1 = 5L; key2 = 3L; key3 = 3L }) (fun k x -> - Stdlib.Bool.and_v0 - (Stdlib.Int64.greaterThanOrEqualTo_v0 x 1L) - (Stdlib.Int64.lessThanOrEqualTo_v0 x 4L)) = (Dict + Stdlib.Dict.map + (Dict { key1 = "val1"; key2 = "val2" }) + (fun k x -> k ++ x) + == (Dict { key2 = "key2val2"; key1 = "key1val1" }) + + Stdlib.Dict.map + (Dict { key1 = 5L; key2 = 3L; key3 = 3L }) + (fun k x -> + Stdlib.Bool.and + (Stdlib.Int64.greaterThanOrEqualTo x 1L) + (Stdlib.Int64.lessThanOrEqualTo x 4L) + ) + == + (Dict { key3 = true key2 = true key1 = false }) - Stdlib.Dict.map_v0 (Dict { a = 1L; b = 2L }) (fun k x -> x + 1L) = (Dict + Stdlib.Dict.map (Dict { a = 1L; b = 2L }) (fun k x -> x + 1L) == (Dict { b = 3L; a = 2L }) - Stdlib.Dict.map_v0 (Dict { }) (fun key value -> 0L) = (Dict { }) + Stdlib.Dict.map (Dict { }) (fun key value -> 0L) == (Dict { }) module Member = - Stdlib.Dict.member_v0 (Dict { otherKey = 5L; someKey = 5L }) "someKey" = true + Stdlib.Dict.member (Dict { otherKey = 5L; someKey = 5L }) "someKey" == true - Stdlib.Dict.member_v0 (Dict { otherKey = 5L }) "someKey" = false + Stdlib.Dict.member (Dict { otherKey = 5L }) "someKey" == false module Merge = - Stdlib.Dict.merge_v0 (Dict { key1 = "val1" }) (Dict { key2 = "val2" }) = (Dict + Stdlib.Dict.merge (Dict { key1 = "val1" }) (Dict { key2 = "val2" }) == (Dict { key2 = "val2"; key1 = "val1" }) - Stdlib.Dict.merge_v0 (Dict { key1 = "val_l" }) (Dict { key1 = "val_r" }) = (Dict + Stdlib.Dict.merge (Dict { key1 = "val_l" }) (Dict { key1 = "val_r" }) == (Dict { key1 = "val_r" }) - Stdlib.Dict.merge_v0 (Dict { }) (Dict { }) = (Dict { }) + Stdlib.Dict.merge (Dict { }) (Dict { }) == (Dict { }) module Set = - Stdlib.Dict.set_v0 (Dict { key1 = "val1before" }) "key1" "val1after" = (Dict + Stdlib.Dict.set (Dict { key1 = "val1before" }) "key1" "val1after" == (Dict { key1 = "val1after" }) - Stdlib.Dict.set_v0 (Dict { key1 = "val1" }) "key2" "val2" = (Dict + Stdlib.Dict.set (Dict { key1 = "val1" }) "key2" "val2" == (Dict { key1 = "val1"; key2 = "val2" }) // Dicts do not currently enforce value typing, therefore the following tests pass // VTTODO: this should fail - Stdlib.Dict.set_v0 (Dict { key1 = "val1" }) "key2" 2L = (Dict + Stdlib.Dict.set (Dict { key1 = "val1" }) "key2" 2L == (Dict { key1 = "val1"; key2 = 2L }) - Stdlib.Dict.set_v0 (Dict { key1 = 1 }) "key1" "changedTypeValue" = (Dict + Stdlib.Dict.set (Dict { key1 = 1 }) "key1" "changedTypeValue" == (Dict { key1 = "changedTypeValue" }) module Singleton = - Stdlib.Dict.singleton_v0 "one" 1L = (Dict { one = 1L }) + Stdlib.Dict.singleton "one" 1L == (Dict { one = 1L }) - Stdlib.Dict.singleton_v0 "Content-Length" 1L = (Dict { ``Content-Length`` = 1L }) + Stdlib.Dict.singleton "Content-Length" 1L == (Dict { ``Content-Length`` = 1L }) module Size = - Stdlib.Dict.size_v0 (Dict { a = 3L; b = 1L; c = 1L }) = 3L - Stdlib.Dict.size_v0 (Dict { }) = 0L + Stdlib.Dict.size (Dict { a = 3L; b = 1L; c = 1L }) == 3L + Stdlib.Dict.size (Dict { }) == 0L module ToList = - Stdlib.Dict.toList_v0 (Dict { a = 1L; b = 2L; c = 3L }) = [ ("a", 1L) + (Stdlib.Dict.toList (Dict { a = 1L; b = 2L; c = 3L })) == [ ("a", 1L) ("b", 2L) ("c", 3L) ] - Stdlib.Dict.toList_v0 (Dict { }) = [] + Stdlib.Dict.toList (Dict { }) == [] module Values = - Stdlib.Dict.values_v0 (Dict { key1 = "val1" }) = [ "val1" ] + Stdlib.Dict.values (Dict { key1 = "val1" }) == [ "val1" ] module Remove = - Stdlib.Dict.remove_v0 (Dict { key1 = "val1"; key2 = "val2" }) "key1" = (Dict - { key2 = "val2" }) + (Stdlib.Dict.remove (Dict { key1 = "val1"; key2 = "val2" }) "key1") == (Dict { key2 = "val2" }) - Stdlib.Dict.remove_v0 (Dict { key1 = "val1" }) "key1" = (Dict { }) + (Stdlib.Dict.remove (Dict { key1 = "val1" }) "key1") == (Dict { }) - Stdlib.Dict.remove_v0 (Dict { key1 = "val1" }) "key2" = (Dict { key1 = "val1" }) + (Stdlib.Dict.remove (Dict { key1 = "val1" }) "key2") == (Dict { key1 = "val1" }) - Stdlib.Dict.remove_v0 (Dict { }) "key1" = (Dict { }) \ No newline at end of file + (Stdlib.Dict.remove (Dict { }) "key1") == (Dict { }) \ No newline at end of file diff --git a/backend/testfiles/execution/stdlib/float.dark b/backend/testfiles/execution/stdlib/float.dark index e2188bed30..b7af8b2984 100644 --- a/backend/testfiles/execution/stdlib/float.dark +++ b/backend/testfiles/execution/stdlib/float.dark @@ -1,188 +1,198 @@ -Stdlib.Float.add_v0 1.2 1.3 = 2.5 +Stdlib.Float.add 1.2 1.3 == 2.5 -Stdlib.Float.ceiling_v0 1.3 = 2L -Stdlib.Float.ceiling_v0 1.0000001 = 2L -Stdlib.Float.ceiling_v0 -2147483647.8 = -2147483647L -Stdlib.Float.ceiling_v0 2147483647.0 = 2147483647L -Stdlib.Float.ceiling_v0 0000000.1 = 1L -Stdlib.Float.ceiling_v0 0.0 = 0L -Stdlib.Float.ceiling_v0 17.55042081 = 18L +Stdlib.Float.ceiling 1.3 == 2L +Stdlib.Float.ceiling 1.0000001 == 2L +Stdlib.Float.ceiling -2147483647.8 == -2147483647L +Stdlib.Float.ceiling 2147483647.0 == 2147483647L +Stdlib.Float.ceiling 0000000.1 == 1L +Stdlib.Float.ceiling 0.0 == 0L +Stdlib.Float.ceiling 17.55042081 == 18L -Stdlib.Float.roundUp_v0 1.3 = 2L -Stdlib.Float.roundUp_v0 1.0000001 = 2L -Stdlib.Float.roundUp_v0 -2147483647.8 = -2147483647L -Stdlib.Float.roundUp_v0 2147483647.0 = 2147483647L -Stdlib.Float.roundUp_v0 0000000.1 = 1L -Stdlib.Float.roundUp_v0 0.0 = 0L +Stdlib.Float.roundUp 1.3 == 2L +Stdlib.Float.roundUp 1.0000001 == 2L +Stdlib.Float.roundUp -2147483647.8 == -2147483647L +Stdlib.Float.roundUp 2147483647.0 == 2147483647L +Stdlib.Float.roundUp 0000000.1 == 1L +Stdlib.Float.roundUp 0.0 == 0L -Stdlib.Float.floor_v0 1.8 = 1L -Stdlib.Float.floor_v0 -1.0000001 = -2L -Stdlib.Float.floor_v0 -2147483647.8 = -2147483648L -Stdlib.Float.floor_v0 2147483647.0 = 2147483647L -Stdlib.Float.floor_v0 0000000.1 = 0L -Stdlib.Float.floor_v0 0.0 = 0L +Stdlib.Float.floor 1.8 == 1L +Stdlib.Float.floor -1.0000001 == -2L +Stdlib.Float.floor -2147483647.8 == -2147483648L +Stdlib.Float.floor 2147483647.0 == 2147483647L +Stdlib.Float.floor 0000000.1 == 0L +Stdlib.Float.floor 0.0 == 0L -Stdlib.Float.roundDown_v0 1.8 = 1L -Stdlib.Float.roundDown_v0 -1.0000001 = -2L -Stdlib.Float.roundDown_v0 -2147483647.8 = -2147483648L -Stdlib.Float.roundDown_v0 2147483647.0 = 2147483647L -Stdlib.Float.roundDown_v0 0000000.1 = 0L -Stdlib.Float.roundDown_v0 0.0 = 0L +Stdlib.Float.roundDown 1.8 == 1L +Stdlib.Float.roundDown -1.0000001 == -2L +Stdlib.Float.roundDown -2147483647.8 == -2147483648L +Stdlib.Float.roundDown 2147483647.0 == 2147483647L +Stdlib.Float.roundDown 0000000.1 == 0L +Stdlib.Float.roundDown 0.0 == 0L -Stdlib.Float.round_v0 -2147483647.8 = -2147483648L -Stdlib.Float.round_v0 0000000.1 = 0L -Stdlib.Float.round_v0 2147483647.000009 = 2147483647L +Stdlib.Float.round -2147483647.8 == -2147483648L +Stdlib.Float.round 0000000.1 == 0L +Stdlib.Float.round 2147483647.000009 == 2147483647L -Stdlib.Float.truncate_v0 -2367.9267 = -2367L -Stdlib.Float.truncate_v0 000000.9 = 0L -Stdlib.Float.truncate_v0 -000000.9 = 0L -Stdlib.Float.truncate_v0 0.0 = 0L -Stdlib.Float.truncate_v0 2147483647.000009 = 2147483647L +Stdlib.Float.truncate -2367.9267 == -2367L +Stdlib.Float.truncate 000000.9 == 0L +Stdlib.Float.truncate -000000.9 == 0L +Stdlib.Float.truncate 0.0 == 0L +Stdlib.Float.truncate 2147483647.000009 == 2147483647L -Stdlib.Float.absoluteValue_v0 Builtin.testNegativeInfinity_v0 = Builtin.testInfinity_v0 -Stdlib.Float.absoluteValue_v0 Builtin.testNan_v0 = Builtin.testNan_v0 -Stdlib.Float.absoluteValue_v0 -5.6 = 5.6 -Stdlib.Float.absoluteValue_v0 -0.0 = 0.0 -Stdlib.Float.absoluteValue_v0 -0.0 = 0.0 +Stdlib.Float.absoluteValue Builtin.testNegativeInfinity == (Builtin.testInfinity) +Stdlib.Float.absoluteValue Builtin.testNan == (Builtin.testNan) -Stdlib.Float.negate_v0 Builtin.testNan_v0 = Builtin.testNan_v0 -Stdlib.Float.negate_v0 Builtin.testInfinity_v0 = Builtin.testNegativeInfinity_v0 -Stdlib.Float.negate_v0 -5.6 = 5.6 -Stdlib.Float.negate_v0 5.6 = -5.6 -Stdlib.Float.negate_v0 0.0 = -0.0 -Stdlib.Float.negate_v0 -0.0 = 0.0 +Stdlib.Float.absoluteValue -5.6 == 5.6 +Stdlib.Float.absoluteValue -0.0 == 0.0 +Stdlib.Float.absoluteValue -0.0 == 0.0 -Stdlib.Float.clamp_v0 Builtin.testInfinity_v0 -1.0 0.5 = Stdlib.Result.Result.Ok 0.5 +Stdlib.Float.negate Builtin.testNan == (Builtin.testNan) +Stdlib.Float.negate Builtin.testInfinity == (Builtin.testNegativeInfinity) -Stdlib.Float.clamp_v0 Builtin.testNegativeInfinity_v0 -1.0 0.5 = Stdlib.Result.Result.Ok - -1.0 +Stdlib.Float.negate -5.6 == 5.6 +Stdlib.Float.negate 5.6 == -5.6 +Stdlib.Float.negate 0.0 == -0.0 +Stdlib.Float.negate -0.0 == 0.0 -Stdlib.Float.clamp_v0 Builtin.testNan_v0 -1.0 1.0 = Stdlib.Result.Result.Ok - Builtin.testNan_v0 +Stdlib.Float.clamp Builtin.testInfinity -1.0 0.5 == Stdlib.Result.Result.Ok(0.5) -Stdlib.Float.clamp_v0 0.5 Builtin.testInfinity_v0 1.0 = Stdlib.Result.Result.Ok 1.0 +Stdlib.Float.clamp Builtin.testNegativeInfinity -1.0 0.5 +== Stdlib.Result.Result.Ok(-1.0) -Stdlib.Float.clamp_v0 0.5 Builtin.testNegativeInfinity_v0 1.0 = Stdlib.Result.Result.Ok - 0.5 +Stdlib.Float.clamp Builtin.testNan -1.0 1.0 +== Stdlib.Result.Result.Ok(Builtin.testNan) -Stdlib.Float.clamp_v0 0.5 Builtin.testNan_v0 1.0 = Stdlib.Result.Result.Error - "clamp requires arguments to be valid numbers" +Stdlib.Float.clamp 0.5 Builtin.testInfinity 1.0 == Stdlib.Result.Result.Ok(1.0) -Stdlib.Float.clamp_v0 -1.0 0.5 Builtin.testInfinity_v0 = Stdlib.Result.Result.Ok 0.5 +Stdlib.Float.clamp 0.5 Builtin.testNegativeInfinity 1.0 +== Stdlib.Result.Result.Ok(0.5) -Stdlib.Float.clamp_v0 -1.0 0.5 Builtin.testNegativeInfinity_v0 = Stdlib.Result.Result.Ok - -1.0 +Stdlib.Float.clamp 0.5 Builtin.testNan 1.0 +== Stdlib.Result.Result.Error("clamp requires arguments to be valid numbers") -Stdlib.Float.clamp_v0 0.5 1.0 Builtin.testNan_v0 = Stdlib.Result.Result.Error - "clamp requires arguments to be valid numbers" +Stdlib.Float.clamp -1.0 0.5 Builtin.testInfinity == Stdlib.Result.Result.Ok(0.5) -Stdlib.Float.clamp_v0 -2.0 -5.0 5.0 = Stdlib.Result.Result.Ok -2.0 +Stdlib.Float.clamp -1.0 0.5 Builtin.testNegativeInfinity +== Stdlib.Result.Result.Ok(-1.0) -Stdlib.Float.clamp_v0 -3.0 -2.0 1.0 = Stdlib.Result.Result.Ok -2.0 +Stdlib.Float.clamp 0.5 1.0 Builtin.testNan +== Stdlib.Result.Result.Error("clamp requires arguments to be valid numbers") -Stdlib.Float.clamp_v0 -5.0 1.0 1.0 = Stdlib.Result.Result.Ok 1.0 +Stdlib.Float.clamp -2.0 -5.0 5.0 == Stdlib.Result.Result.Ok(-2.0) -Stdlib.Float.clamp_v0 1.0 2.0 1.0 = Stdlib.Result.Result.Ok 1.0 +Stdlib.Float.clamp -3.0 -2.0 1.0 == Stdlib.Result.Result.Ok(-2.0) -Stdlib.Float.clamp_v0 3.0 0.0 2.0 = Stdlib.Result.Result.Ok 2.0 +Stdlib.Float.clamp -5.0 1.0 1.0 == Stdlib.Result.Result.Ok(1.0) -Stdlib.Float.divide_v0 9.0 2.0 = 4.5 -Stdlib.Float.divide_v0 9.0 0.0 = Builtin.testInfinity_v0 -Stdlib.Float.divide_v0 9.0 -0.0 = Builtin.testNegativeInfinity_v0 +Stdlib.Float.clamp 1.0 2.0 1.0 == Stdlib.Result.Result.Ok(1.0) -9.0 / 2.0 = 4.5 -17.0 / 3.3 = 5.151515152 --8.74 / 5.351 = -1.633339563 -0.0 / 1.0 = 0.0 -1.0 / 0.0 = Builtin.testInfinity_v0 +Stdlib.Float.clamp 3.0 0.0 2.0 == Stdlib.Result.Result.Ok(2.0) +Stdlib.Float.divide 9.0 2.0 == 4.5 +Stdlib.Float.divide 9.0 0.0 == (Builtin.testInfinity) +Stdlib.Float.divide 9.0 -0.0 == (Builtin.testNegativeInfinity) -Stdlib.Float.greaterThanOrEqualTo_v0 0.1 0.1 = true +9.0 / 2.0 == 4.5 +17.0 / 3.3 == 5.151515152 +-8.74 / 5.351 == -1.633339563 +0.0 / 1.0 == 0.0 +1.0 / 0.0 == (Builtin.testInfinity) -Stdlib.Float.greaterThan_v0 0.2 0.1 = true -Stdlib.Float.lessThanOrEqualTo_v0 0.1 0.1 = true +Stdlib.Float.greaterThanOrEqualTo 0.1 0.1 == true -Stdlib.Float.lessThan_v0 0.2 0.1 = false +Stdlib.Float.greaterThan 0.2 0.1 == true -Stdlib.Float.max_v0 Builtin.testInfinity_v0 1.0 = Builtin.testInfinity_v0 -Stdlib.Float.max_v0 Builtin.testNegativeInfinity_v0 1.0 = 1.0 -Stdlib.Float.max_v0 -10.0 1.0 = 1.0 -Stdlib.Float.max_v0 10.0 Builtin.testNan_v0 = Builtin.testNan_v0 -Stdlib.Float.max_v0 10.0 1.0 = 10.0 -Stdlib.Float.max_v0 0.0 0.00 = 0.0 -Stdlib.Float.max_v0 -2147483647.8 -00000000.000 = 0.0 -Stdlib.Float.max_v0 2147483647.0 00000000.000 = 2147483647.0 +Stdlib.Float.lessThanOrEqualTo 0.1 0.1 == true -Stdlib.Float.min_v0 Builtin.testInfinity_v0 1.0 = 1.0 -Stdlib.Float.min_v0 Builtin.testNegativeInfinity_v0 1.0 = Builtin.testNegativeInfinity_v0 -Stdlib.Float.min_v0 -10.0 1.0 = -10.0 -Stdlib.Float.min_v0 10.0 Builtin.testNan_v0 = Builtin.testNan_v0 -Stdlib.Float.min_v0 10.0 1.0 = 1.0 -Stdlib.Float.min_v0 0.0 0.00 = 0.0 -Stdlib.Float.min_v0 -2147483647.8 -00000000.000 = -2147483647.8 -Stdlib.Float.min_v0 2147483647.0 00000000.000 = 0.0 +Stdlib.Float.lessThan 0.2 0.1 == false -Stdlib.Float.multiply_v0 26.0 0.5 = 13.0 +Stdlib.Float.max Builtin.testInfinity 1.0 == (Builtin.testInfinity) +Stdlib.Float.max Builtin.testNegativeInfinity 1.0 == 1.0 -Stdlib.Float.parse_v0 "1.5" = Stdlib.Result.Result.Ok 1.5 +Stdlib.Float.max -10.0 1.0 == 1.0 +Stdlib.Float.max 10.0 Builtin.testNan == (Builtin.testNan) -Stdlib.Float.parse_v0 "0.0" = Stdlib.Result.Result.Ok 0.0 +Stdlib.Float.max 10.0 1.0 == 10.0 +Stdlib.Float.max 0.0 0.00 == 0.0 -Stdlib.Float.parse_v0 "-0.5" = Stdlib.Result.Result.Ok -0.5 +Stdlib.Float.max -2147483647.8 -00000000.000 == 0.0 +Stdlib.Float.max 2147483647.0 00000000.000 == 2147483647.0 -Stdlib.Float.parse_v0 "+0.5" = Stdlib.Result.Result.Ok 0.5 +Stdlib.Float.min Builtin.testInfinity 1.0 == 1.0 -Stdlib.Float.parse_v0 ".5" = Stdlib.Result.Result.Ok 0.5 +Stdlib.Float.min Builtin.testNegativeInfinity 1.0 +== (Builtin.testNegativeInfinity) -Stdlib.Float.parse_v0 "0.6999999999999999555910790149937383830547332763671875" = Stdlib.Result.Result.Ok - 0.7 +Stdlib.Float.min -10.0 1.0 == -10.0 +Stdlib.Float.min 10.0 Builtin.testNan == (Builtin.testNan) +Stdlib.Float.min 10.0 1.0 == 1.0 +Stdlib.Float.min 0.0 0.00 == 0.0 +Stdlib.Float.min -2147483647.8 -00000000.000 == -2147483647.8 +Stdlib.Float.min 2147483647.0 00000000.000 == 0.0 -Stdlib.Float.parse_v0 "-0.6999999999999999555910790149937383830547332763671875" = Stdlib.Result.Result.Ok - -0.7 +Stdlib.Float.multiply 26.0 0.5 == 13.0 -Stdlib.Float.parse_v0 "0.7999999999" = Stdlib.Result.Result.Ok 0.8 +Stdlib.Float.parse "1.5" == Stdlib.Result.Result.Ok(1.5) -Stdlib.Float.parse_v0 "0.79999" = Stdlib.Result.Result.Ok 0.79999 +Stdlib.Float.parse "0.0" == Stdlib.Result.Result.Ok(0.0) -Stdlib.Float.parse_v0 "-55555555555555555555555555555.5" = Stdlib.Result.Result.Ok - -55555555555555555555555555555.5 +Stdlib.Float.parse "-0.5" == Stdlib.Result.Result.Ok(-0.5) -Stdlib.Float.parse_v0 "-141s" = Stdlib.Result.Result.Error - Stdlib.Float.ParseError.BadFormat +Stdlib.Float.parse "+0.5" == Stdlib.Result.Result.Ok(0.5) -Stdlib.Float.parse_v0 "" = Stdlib.Result.Result.Error - Stdlib.Float.ParseError.BadFormat +Stdlib.Float.parse ".5" == Stdlib.Result.Result.Ok(0.5) -Stdlib.Float.parse "-5.55555555556e+28" = Stdlib.Result.Result.Ok - -55555555555555555555555555555.5 -//Stdlib.Float.parse_v0 "0xffffffffffffffff" = Stdlib.Result.Result.Ok 1.844674407e+19 +Stdlib.Float.parse "0.6999999999999999555910790149937383830547332763671875" +== Stdlib.Result.Result.Ok(0.7) -Stdlib.Float.parse_v0 "-1.8E+308" = Stdlib.Result.Result.Ok - Builtin.testNegativeInfinity_v0 +Stdlib.Float.parse "-0.6999999999999999555910790149937383830547332763671875" +== Stdlib.Result.Result.Ok(-0.7) -Stdlib.Float.parse_v0 "1.8E+308" = Stdlib.Result.Result.Ok Builtin.testInfinity_v0 +Stdlib.Float.parse "0.7999999999" == Stdlib.Result.Result.Ok(0.8) -Stdlib.Float.power_v0 4.0 -0.5 = 0.5 -Stdlib.Float.power_v0 4.0 0.5 = 2.0 +Stdlib.Float.parse "0.79999" == Stdlib.Result.Result.Ok(0.79999) -Stdlib.Float.roundTowardsZero -2367.9267 = -2367L -Stdlib.Float.roundTowardsZero 000000.9 = 0L -Stdlib.Float.roundTowardsZero -000000.9 = 0L -Stdlib.Float.roundTowardsZero 0.0 = 0L -Stdlib.Float.roundTowardsZero 2147483647.000009 = 2147483647L +Stdlib.Float.parse "-55555555555555555555555555555.5" +== Stdlib.Result.Result.Ok(-55555555555555555555555555555.5) -Stdlib.Float.sqrt_v0 25.0 = 5.0 -Stdlib.Float.sqrt_v0 0.0 = 0.0 +Stdlib.Float.parse "-141s" +== Stdlib.Result.Result.Error(Stdlib.Float.ParseError.BadFormat()) -Stdlib.Float.subtract_v0 1.0 0.2 = 0.8 +Stdlib.Float.parse "" +== Stdlib.Result.Result.Error(Stdlib.Float.ParseError.BadFormat()) -Stdlib.Float.sum_v0 [ 1.0; 0.2 ] = 1.2 +Stdlib.Float.parse "-5.55555555556e+28" +== Stdlib.Result.Result.Ok(-55555555555555555555555555555.5) -Builtin.testNan_v0 == Builtin.testNan_v0 = false +// Stdlib.Float.parse "0xffffffffffffffff" +// == Stdlib.Result.Result.Ok(1.844674407e+19) -Stdlib.Float.toString 1.5 = "1.5" -Stdlib.Float.toString 0.0 = "0.0" -Stdlib.Float.toString -0.5 = "-0.5" -Stdlib.Float.toString 0.5 = "0.5" -Stdlib.Float.toString -55555555555555555555555555555.5 = "-5.55555555556e+28" \ No newline at end of file +Stdlib.Float.parse "-1.8E+308" +== Stdlib.Result.Result.Ok(Builtin.testNegativeInfinity) + +Stdlib.Float.parse "1.8E+308" == Stdlib.Result.Result.Ok(Builtin.testInfinity) + +Stdlib.Float.power 4.0 -0.5 == 0.5 +Stdlib.Float.power 4.0 0.5 == 2.0 + +Stdlib.Float.roundTowardsZero -2367.9267 == -2367L +Stdlib.Float.roundTowardsZero 000000.9 == 0L +Stdlib.Float.roundTowardsZero -000000.9 == 0L +Stdlib.Float.roundTowardsZero 0.0 == 0L +Stdlib.Float.roundTowardsZero 2147483647.000009 == 2147483647L + +Stdlib.Float.sqrt 25.0 == 5.0 +Stdlib.Float.sqrt 0.0 == 0.0 + +Stdlib.Float.subtract 1.0 0.2 == 0.8 + +Stdlib.Float.sum [ 1.0; 0.2 ] == 1.2 + +Builtin.testNan == Builtin.testNan == false + +Stdlib.Float.toString 1.5 == "1.5" +Stdlib.Float.toString 0.0 == "0.0" +Stdlib.Float.toString -0.5 == "-0.5" +Stdlib.Float.toString 0.5 == "0.5" +Stdlib.Float.toString -55555555555555555555555555555.5 == "-5.55555555556e+28" \ No newline at end of file diff --git a/backend/testfiles/execution/stdlib/html.dark b/backend/testfiles/execution/stdlib/html.dark index 98ca161317..b5acfbaba4 100644 --- a/backend/testfiles/execution/stdlib/html.dark +++ b/backend/testfiles/execution/stdlib/html.dark @@ -10,10 +10,10 @@ let stringNode (str: String) : Node = Stdlib.Html.stringNode str let htmlTag (n: String) - (a: List>) + (a: List<(String * Stdlib.Option.Option)>) (c: List) : Node = - Stdlib.Html.htmlTagNode n a c + Stdlib.Html.htmlTagNode n a c let tidyHtml (html: String) : String = @@ -24,105 +24,111 @@ let tidyHtml (html: String) : String = // -- basic testing of low-level fns -(htmlTag "div" [] []) |> nodeToString = "
" +(htmlTag "div" [] []) |> nodeToString == "
" -(htmlTag "div" [] [ stringNode "yolo" ]) |> nodeToString = "
yolo
" +(htmlTag "div" [] [ stringNode "yolo" ]) |> nodeToString == "
yolo
" -(htmlTag "div" [ ("id", (Stdlib.Option.Option.Some "my-div")) ] [ stringNode "yolo" ]) -|> nodeToString = "
yolo
" +(htmlTag "div" [ ("id", (Stdlib.Option.Option.Some("my-div"))) ] [ stringNode "yolo" ]) +|> nodeToString +== "
yolo
" (htmlTag "div" [] [ htmlTag "button" [] [ stringNode "click me" ] ]) -|> nodeToString = "
" +|> nodeToString +== "
" // -- testing of simple html node helpers -(Stdlib.Html.comment "hello") |> nodeToString = "" +(Stdlib.Html.comment "hello") |> nodeToString == "" -(Stdlib.Html.br ()) |> nodeToString = "
" -(Stdlib.Html.div [] []) |> nodeToString = "
" -(Stdlib.Html.span [] []) |> nodeToString = "" +(Stdlib.Html.br ()) |> nodeToString == "
" +(Stdlib.Html.div [] []) |> nodeToString == "
" +(Stdlib.Html.span [] []) |> nodeToString == "" -(Stdlib.Html.h1 [] []) |> nodeToString = "

" -(Stdlib.Html.h2 [] []) |> nodeToString = "

" -(Stdlib.Html.h3 [] []) |> nodeToString = "

" -(Stdlib.Html.h4 [] []) |> nodeToString = "

" -(Stdlib.Html.h5 [] []) |> nodeToString = "
" -(Stdlib.Html.h6 [] []) |> nodeToString = "
" +(Stdlib.Html.h1 [] []) |> nodeToString == "

" +(Stdlib.Html.h2 [] []) |> nodeToString == "

" +(Stdlib.Html.h3 [] []) |> nodeToString == "

" +(Stdlib.Html.h4 [] []) |> nodeToString == "

" +(Stdlib.Html.h5 [] []) |> nodeToString == "
" +(Stdlib.Html.h6 [] []) |> nodeToString == "
" -(Stdlib.Html.p [] []) |> nodeToString = "

" -(Stdlib.Html.ul [] []) |> nodeToString = "
    " -(Stdlib.Html.ol [] []) |> nodeToString = "
      " -(Stdlib.Html.li [] []) |> nodeToString = "
    1. " +(Stdlib.Html.p [] []) |> nodeToString == "

      " +(Stdlib.Html.ul [] []) |> nodeToString == "
        " +(Stdlib.Html.ol [] []) |> nodeToString == "
          " +(Stdlib.Html.li [] []) |> nodeToString == "
        1. " -(Stdlib.Html.table [] []) |> nodeToString = "
          " -(Stdlib.Html.tr [] []) |> nodeToString = "" -(Stdlib.Html.td [] []) |> nodeToString = "" -(Stdlib.Html.th [] []) |> nodeToString = "" -(Stdlib.Html.tbody [] []) |> nodeToString = "" -(Stdlib.Html.thead [] []) |> nodeToString = "" -(Stdlib.Html.tfoot [] []) |> nodeToString = "" +(Stdlib.Html.table [] []) |> nodeToString == "
          " +(Stdlib.Html.tr [] []) |> nodeToString == "" +(Stdlib.Html.td [] []) |> nodeToString == "" +(Stdlib.Html.th [] []) |> nodeToString == "" +(Stdlib.Html.tbody [] []) |> nodeToString == "" +(Stdlib.Html.thead [] []) |> nodeToString == "" +(Stdlib.Html.tfoot [] []) |> nodeToString == "" -(Stdlib.Html.caption [] []) |> nodeToString = "" +(Stdlib.Html.caption [] []) |> nodeToString == "" -(Stdlib.Html.colgroup [] []) |> nodeToString = "" -(Stdlib.Html.col [] []) |> nodeToString = "" +(Stdlib.Html.colgroup [] []) |> nodeToString == "" +(Stdlib.Html.col [] []) |> nodeToString == "" -(Stdlib.Html.img []) |> nodeToString = "" +(Stdlib.Html.img []) |> nodeToString == "" -(Stdlib.Html.img [ ("src", Stdlib.Option.Option.Some "foo.png") ]) -|> nodeToString = "" +(Stdlib.Html.img [ ("src", Stdlib.Option.Option.Some("foo.png")) ]) +|> nodeToString +== "" -(Stdlib.Html.svg [] []) |> nodeToString = "" -(Stdlib.Html.path []) |> nodeToString = "" +(Stdlib.Html.svg [] []) |> nodeToString == "" +(Stdlib.Html.path []) |> nodeToString == "" -(Stdlib.Html.i [] []) |> nodeToString = "" +(Stdlib.Html.i [] []) |> nodeToString == "" -(Stdlib.Html.meta [ ("charset", Stdlib.Option.Option.Some "UTF-8") ]) -|> nodeToString = "" +(Stdlib.Html.meta [ ("charset", Stdlib.Option.Option.Some("UTF-8")) ]) +|> nodeToString +== "" (Stdlib.Html.link - [ ("rel", Stdlib.Option.Option.Some "stylesheet") - ("href", Stdlib.Option.Option.Some "./style.css") ]) -|> nodeToString = "" + [ ("rel", Stdlib.Option.Option.Some("stylesheet")) + ("href", Stdlib.Option.Option.Some("./style.css")) ]) +|> nodeToString +== "" -(Stdlib.Html.script - [ ("src", Stdlib.Option.Option.Some "https://cdn.tailwindcss.com") ] - []) -|> nodeToString = "" +(Stdlib.Html.script [ ("src", Stdlib.Option.Option.Some("https://cdn.tailwindcss.com")) ] []) +|> nodeToString +== "" -(Stdlib.Html.form [ ("id", Stdlib.Option.Option.Some "my-form") ] []) -|> nodeToString = "
          " +(Stdlib.Html.form [ ("id", Stdlib.Option.Option.Some("my-form")) ] []) +|> nodeToString +== "
          " (Stdlib.Html.input - [ ("type", Stdlib.Option.Option.Some "text") - ("name", Stdlib.Option.Option.Some "name") - ("id", Stdlib.Option.Option.Some "name") ]) -|> nodeToString = "" + [ ("type", Stdlib.Option.Option.Some("text")) + ("name", Stdlib.Option.Option.Some("name")) + ("id", Stdlib.Option.Option.Some("name")) ]) +|> nodeToString +== "" -(Stdlib.Html.label - [ ("for", Stdlib.Option.Option.Some "name") ] - [ stringNode "Name" ]) -|> nodeToString = "" +(Stdlib.Html.label [ ("for", Stdlib.Option.Option.Some("name")) ] [ stringNode "Name" ]) +|> nodeToString +== "" -(Stdlib.Html.section [] []) |> nodeToString = "
          " +(Stdlib.Html.section [] []) |> nodeToString == "
          " // code -(Stdlib.Html.code [] []) |> nodeToString = "" -(Stdlib.Html.pre [] []) |> nodeToString = "
          "
          +(Stdlib.Html.code [] []) |> nodeToString == ""
          +(Stdlib.Html.pre [] []) |> nodeToString == "
          "
           
          -(Stdlib.Html.nav [] []) |> nodeToString = ""
          -(Stdlib.Html.footer [] []) |> nodeToString = "
          " +(Stdlib.Html.nav [] []) |> nodeToString == "" +(Stdlib.Html.footer [] []) |> nodeToString == "
          " // -- test writing out a full document ([ Stdlib.Html.html - [] - [ Stdlib.Html.head [] [ Stdlib.Html.title [] [ stringNode "Darklang.com" ] ] - - Stdlib.Html.body [] [ Stdlib.Html.p [] [ stringNode "welcome to darklang" ] ] ] ] - |> Stdlib.Html.document) = (" + [] + [ Stdlib.Html.head [] [ Stdlib.Html.title [] [ stringNode "Darklang.com" ] ] + Stdlib.Html.body [] [ Stdlib.Html.p [] [ stringNode "welcome to darklang" ] ] ] + ] + |> Stdlib.Html.document) +== (" Darklang.com

          welcome to darklang

          " - |> tidyHtml) \ No newline at end of file + |> tidyHtml) \ No newline at end of file diff --git a/backend/testfiles/execution/stdlib/http.dark b/backend/testfiles/execution/stdlib/http.dark index 2bebb77de5..d544118cf7 100644 --- a/backend/testfiles/execution/stdlib/http.dark +++ b/backend/testfiles/execution/stdlib/http.dark @@ -18,12 +18,14 @@ // Stdlib.Http.setCookie "myCookie" "myVal" { Fake = "fake"} = Builtin.Test.runtimeError "Keys must be `Expires`, `Max-Age`, `Domain`, `Path`, `Secure`, `HttpOnly`, and/or `SameSite`, but one of the keys was Fake" -Stdlib.Http.badRequest_v0 "Your request resulted in an error" = Stdlib.Http.Response +Stdlib.Http.badRequest "Your request resulted in an error" +== Stdlib.Http.Response { statusCode = 400L headers = [] body = Stdlib.String.toBytes "Your request resulted in an error" } -Stdlib.Http.response (Stdlib.String.toBytes "test") 200L = Stdlib.Http.Response +Stdlib.Http.response (Stdlib.String.toBytes "test") 200L +== Stdlib.Http.Response { statusCode = 200L headers = [] body = Stdlib.String.toBytes "test" } @@ -31,52 +33,50 @@ Stdlib.Http.response (Stdlib.String.toBytes "test") 200L = Stdlib.Http.Response Stdlib.Http.responseWithHeaders (Stdlib.String.toBytes "test") [ ("Content-Type", "text/html; charset=utf-8") ] - 200L = Stdlib.Http.Response + 200L +== Stdlib.Http.Response { statusCode = 200L headers = [ ("Content-Type", "text/html; charset=utf-8") ] body = Stdlib.String.toBytes "test" } -Stdlib.Http.notFound () = Stdlib.Http.response [] 404L +Stdlib.Http.notFound () == Stdlib.Http.response [] 404L -Stdlib.Http.unauthorized () = Stdlib.Http.response [] 401L +Stdlib.Http.unauthorized () == Stdlib.Http.response [] 401L -Stdlib.Http.forbidden () = Stdlib.Http.response [] 403L +Stdlib.Http.forbidden () == Stdlib.Http.response [] 403L -Stdlib.Http.success (Stdlib.String.toBytes "test") = Stdlib.Http.response - (Stdlib.String.toBytes "test") - 200L +Stdlib.Http.success (Stdlib.String.toBytes "test") +== Stdlib.Http.response (Stdlib.String.toBytes "test") 200L -Stdlib.Http.responseWithHtml "test" 200L = Stdlib.Http.responseWithHeaders +Stdlib.Http.responseWithHtml "test" 200L +== Stdlib.Http.responseWithHeaders (Stdlib.String.toBytes "test") [ ("Content-Type", "text/html; charset=utf-8") ] 200L -Stdlib.Http.responseWithText "test" 200L = Stdlib.Http.responseWithHeaders +Stdlib.Http.responseWithText "test" 200L +== Stdlib.Http.responseWithHeaders (Stdlib.String.toBytes "test") [ ("Content-Type", "text/plain; charset=utf-8") ] 200L -Stdlib.Http.responseWithJson "test" 200L = Stdlib.Http.responseWithHeaders +Stdlib.Http.responseWithJson "test" 200L +== Stdlib.Http.responseWithHeaders (Stdlib.String.toBytes "test") [ ("Content-Type", "application/json") ] 200L -(Stdlib.Http.redirectTo "") = Stdlib.Http.responseWithHeaders - [] - [ ("Location", "") ] - 302L +(Stdlib.Http.redirectTo "") +== Stdlib.Http.responseWithHeaders [] [ ("Location", "") ] 302L -(Stdlib.Http.redirectTo "bad url") = Stdlib.Http.responseWithHeaders - [] - [ ("Location", "bad url") ] - 302L +(Stdlib.Http.redirectTo "bad url") +== Stdlib.Http.responseWithHeaders [] [ ("Location", "bad url") ] 302L -(Stdlib.Http.redirectTo_v0 "http://someothersite.com") = Stdlib.Http.responseWithHeaders +(Stdlib.Http.redirectTo "http://someothersite.com") +== Stdlib.Http.responseWithHeaders [] [ ("Location", "http://someothersite.com") ] 302L -(Stdlib.Http.redirectTo_v0 "/relativeUrl") = Stdlib.Http.responseWithHeaders - [] - [ ("Location", "/relativeUrl") ] - 302L \ No newline at end of file +(Stdlib.Http.redirectTo "/relativeUrl") +== Stdlib.Http.responseWithHeaders [] [ ("Location", "/relativeUrl") ] 302L \ No newline at end of file diff --git a/backend/testfiles/execution/stdlib/httpclient.dark b/backend/testfiles/execution/stdlib/httpclient.dark index 04c228f2b3..311c97b96a 100644 --- a/backend/testfiles/execution/stdlib/httpclient.dark +++ b/backend/testfiles/execution/stdlib/httpclient.dark @@ -3,525 +3,401 @@ // Tests that don't use the internet module NoInternal = - Stdlib.HttpClient.ContentType.form_v0 = ("content-type", - "application/x-www-form-urlencoded") + Stdlib.HttpClient.ContentType.form + == ("content-type", "application/x-www-form-urlencoded") - Stdlib.HttpClient.ContentType.json_v0 = ("content-type", "application/json") + Stdlib.HttpClient.ContentType.json == ("content-type", "application/json") - Stdlib.HttpClient.ContentType.plainText_v0 = ("content-type", - "text/plain; charset=utf-8") + Stdlib.HttpClient.ContentType.plainText + == ("content-type", "text/plain; charset=utf-8") - Stdlib.HttpClient.ContentType.html_v0 = ("content-type", "text/html; charset=utf-8") + Stdlib.HttpClient.ContentType.html + == ("content-type", "text/html; charset=utf-8") - Stdlib.HttpClient.bearerToken "YWxhZGRpbjpvcGVuc2VzYW1l" = (("authorization", - "bearer YWxhZGRpbjpvcGVuc2VzYW1l")) + Stdlib.HttpClient.bearerToken "YWxhZGRpbjpvcGVuc2VzYW1l" + == (("authorization", "bearer YWxhZGRpbjpvcGVuc2VzYW1l")) - Stdlib.HttpClient.basicAuth "username" "password" = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Ok(("authorization", "basic dXNlcm5hbWU6cGFzc3dvcmQ=")) - - Stdlib.HttpClient.basicAuth "" "" = Stdlib.Result.Result.Ok( - ("authorization", "basic Og==") + Stdlib.HttpClient.basicAuth "username" "password" + == PACKAGE.Darklang.Stdlib.Result.Result.Ok( + ("authorization", "basic dXNlcm5hbWU6cGFzc3dvcmQ=") ) - Stdlib.HttpClient.basicAuth "-" "" = Stdlib.Result.Result.Error - "Username cannot contain a hyphen" + Stdlib.HttpClient.basicAuth "" "" + == Stdlib.Result.Result.Ok(("authorization", "basic Og==")) - Stdlib.HttpClient.basicAuth "" "-" = Stdlib.Result.Result.Ok( - ("authorization", "basic Oi0=") - ) + Stdlib.HttpClient.basicAuth "-" "" + == Stdlib.Result.Result.Error("Username cannot contain a hyphen") - Stdlib.HttpClient.basicAuth ":" "" = Stdlib.Result.Result.Ok( - ("authorization", "basic Ojo=") - ) + Stdlib.HttpClient.basicAuth "" "-" + == Stdlib.Result.Result.Ok(("authorization", "basic Oi0=")) - Stdlib.HttpClient.basicAuth "" ":" = Stdlib.Result.Result.Ok( - ("authorization", "basic Ojo=") - ) + Stdlib.HttpClient.basicAuth ":" "" + == Stdlib.Result.Result.Ok(("authorization", "basic Ojo=")) - Stdlib.HttpClient.basicAuth "hello>" "world" = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Ok(("authorization", "basic aGVsbG8+Ondvcmxk")) + Stdlib.HttpClient.basicAuth "" ":" + == Stdlib.Result.Result.Ok(("authorization", "basic Ojo=")) - Stdlib.HttpClient.basicAuth "hello" "world?" = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Ok(("authorization", "basic aGVsbG86d29ybGQ/")) + Stdlib.HttpClient.basicAuth "hello>" "world" + == PACKAGE.Darklang.Stdlib.Result.Result.Ok( + ("authorization", "basic aGVsbG8+Ondvcmxk") + ) + Stdlib.HttpClient.basicAuth "hello" "world?" + == PACKAGE.Darklang.Stdlib.Result.Result.Ok( + ("authorization", "basic aGVsbG86d29ybGQ/") + ) -// Tests that try to make requests to the internet +module General = + // Tests that try to make requests to the internet -// basic requests work -(((Stdlib.HttpClient.request "get" "https://example.com" [] [])) - |> Stdlib.Result.map (fun response -> response.statusCode)) = Stdlib.Result.Result.Ok - 200L + // basic requests work + (((Stdlib.HttpClient.request "get" "https://example.com" [] [])) + |> Stdlib.Result.map (fun response -> response.statusCode)) + == Stdlib.Result.Result.Ok(200L) -(((Stdlib.HttpClient.request "get" "http://example.com" [] [])) - |> Stdlib.Result.map (fun response -> response.statusCode)) = Stdlib.Result.Result.Ok - 200L + (((Stdlib.HttpClient.request "get" "http://example.com" [] [])) + |> Stdlib.Result.map (fun response -> response.statusCode)) + == Stdlib.Result.Result.Ok(200L) -Stdlib.HttpClient.request "get" "https://darklang.com" [ 1L ] [] = Builtin.testDerrorMessage - "PACKAGE.Darklang.Stdlib.HttpClient.request's 3rd argument (`headers`) should be a List<(String * String)>. However, a List ([ 1]) was passed instead. + Stdlib.HttpClient.request "get" "https://darklang.com" [ 1L ] [] + == Builtin.testDerrorMessage + """PACKAGE.Darklang.Stdlib.HttpClient.request's 3rd argument (`headers`) should be a List<(String * String)>. However, a List ([ 1]) was passed instead. Expected: (headers: List<(String * String)>) -Actual: a List: [\n 1\n]" +Actual: a List: [\n 1\n]""" -Stdlib.HttpClient.request "get" "https://darklang.com" [ ("", "") ] [] = Stdlib - .Result - .Result - .Error( - Stdlib.HttpClient.RequestError.BadHeader(Stdlib.HttpClient.BadHeader.EmptyKey) + Stdlib.HttpClient.request "get" "https://darklang.com" [ ("", "") ] [] + == Stdlib.Result.Result.Error( + Stdlib.HttpClient.RequestError.BadHeader(Stdlib.HttpClient.BadHeader.EmptyKey()) ) -// type errors for bad `method` are OK -Stdlib.HttpClient.request "" "https://darklang.com" [] [] = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Error(Stdlib.HttpClient.RequestError.BadMethod) + // type errors for bad `method` are OK + Stdlib.HttpClient.request "" "https://darklang.com" [] [] + == PACKAGE.Darklang.Stdlib.Result.Result.Error( + Stdlib.HttpClient.RequestError.BadMethod() + ) -Stdlib.HttpClient.request " get " "https://darklang.com" [] [] = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Error(Stdlib.HttpClient.RequestError.BadMethod) + Stdlib.HttpClient.request " get " "https://darklang.com" [] [] + == PACKAGE.Darklang.Stdlib.Result.Result.Error( + Stdlib.HttpClient.RequestError.BadMethod() + ) -Stdlib.HttpClient.request "🇵🇷" "https://darklang.com" [] [] = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Error(Stdlib.HttpClient.RequestError.BadMethod) + Stdlib.HttpClient.request "🇵🇷" "https://darklang.com" [] [] + == PACKAGE.Darklang.Stdlib.Result.Result.Error( + Stdlib.HttpClient.RequestError.BadMethod() + ) -// unsupported protocols -Stdlib.HttpClient.request "get" "ftp://darklang.com" [] [] = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Error( + // unsupported protocols + Stdlib.HttpClient.request "get" "ftp://darklang.com" [] [] + == PACKAGE.Darklang.Stdlib.Result.Result.Error( Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.UnsupportedProtocol + Stdlib.HttpClient.BadUrlDetails.UnsupportedProtocol() ) ) -Stdlib.HttpClient.request "put" "file:///etc/passwd" [] [] = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Error( + Stdlib.HttpClient.request "put" "file:///etc/passwd" [] [] + == PACKAGE.Darklang.Stdlib.Result.Result.Error( Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.UnsupportedProtocol + Stdlib.HttpClient.BadUrlDetails.UnsupportedProtocol() ) ) -Stdlib.HttpClient.request "put" "/just-a-path" [] [] = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Error( + Stdlib.HttpClient.request "put" "/just-a-path" [] [] + == PACKAGE.Darklang.Stdlib.Result.Result.Error( Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.UnsupportedProtocol + Stdlib.HttpClient.BadUrlDetails.UnsupportedProtocol() ) ) -// totally bogus URLs -Stdlib.HttpClient.request "get" "" [] [] = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Error( - Stdlib.HttpClient.RequestError.BadUrl(Stdlib.HttpClient.BadUrlDetails.InvalidUri) + // totally bogus URLs + Stdlib.HttpClient.request "get" "" [] [] + == PACKAGE.Darklang.Stdlib.Result.Result.Error( + Stdlib.HttpClient.RequestError.BadUrl( + Stdlib.HttpClient.BadUrlDetails.InvalidUri() + ) ) -Stdlib.HttpClient.request "post" "{ ] nonsense ^#( :" [] [] = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Error( - Stdlib.HttpClient.RequestError.BadUrl(Stdlib.HttpClient.BadUrlDetails.InvalidUri) + Stdlib.HttpClient.request "post" "{ ] nonsense ^#( :" [] [] + == PACKAGE.Darklang.Stdlib.Result.Result.Error( + Stdlib.HttpClient.RequestError.BadUrl( + Stdlib.HttpClient.BadUrlDetails.InvalidUri() + ) ) -// URLs we can't actually communicate with -Stdlib.HttpClient.request "get" "http://google.com:79" [] [] = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Error(Stdlib.HttpClient.RequestError.Timeout) + // URLs we can't actually communicate with + Stdlib.HttpClient.request "get" "http://google.com:79" [] [] + == PACKAGE.Darklang.Stdlib.Result.Result.Error( + Stdlib.HttpClient.RequestError.Timeout() + ) // Check for banned urls in the host name module Disallowed = - Stdlib.HttpClient.request "get" "http://0.0.0.0" [] [] = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Error( - Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.InvalidHost - ) + Stdlib.HttpClient.request "get" "http://0.0.0.0" [] [] + == PACKAGE.Darklang.Stdlib.Result.Result.Error( + Stdlib.HttpClient.RequestError.BadUrl( + Stdlib.HttpClient.BadUrlDetails.InvalidHost() ) + ) - Stdlib.HttpClient.request "get" "http://0" [] [] = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Error( - Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.InvalidHost - ) + Stdlib.HttpClient.request "get" "http://0" [] [] + == PACKAGE.Darklang.Stdlib.Result.Result.Error( + Stdlib.HttpClient.RequestError.BadUrl( + Stdlib.HttpClient.BadUrlDetails.InvalidHost() ) + ) // Check for banned urls in the host name module Disallowed = - Stdlib.HttpClient.request "get" "http://0.0.0.0" [] [] = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Error( - Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.InvalidHost - ) - ) - - Stdlib.HttpClient.request "get" "http://0" [] [] = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Error( - Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.InvalidHost - ) - ) - - Stdlib.HttpClient.request "get" "http://[0:0:0:0:0:0:0:0]" [] [] = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Error(Stdlib.HttpClient.RequestError.NetworkError) - - Stdlib.HttpClient.request "get" "localhost" [] [] = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Error( - Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.InvalidUri - ) - ) - - Stdlib.HttpClient.request "get" "http://localhost" [] [] = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Error( - Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.InvalidHost - ) - ) - - Stdlib.HttpClient.request "get" "http://127.0.0.1" [] [] = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Error( - Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.InvalidHost - ) - ) - - Stdlib.HttpClient.request "get" "http://[::1]" [] [] = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Error( - Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.InvalidHost - ) - ) - - Stdlib.HttpClient.request "get" "http://[0:0:0:0:0:0:0:1]" [] [] = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Error( - Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.InvalidHost - ) + Stdlib.HttpClient.request "get" "http://0.0.0.0" [] [] + == PACKAGE.Darklang.Stdlib.Result.Result.Error( + Stdlib.HttpClient.RequestError.BadUrl( + Stdlib.HttpClient.BadUrlDetails.InvalidHost() + ) + ) + + Stdlib.HttpClient.request "get" "http://0" [] [] + == PACKAGE.Darklang.Stdlib.Result.Result.Error( + Stdlib.HttpClient.RequestError.BadUrl( + Stdlib.HttpClient.BadUrlDetails.InvalidHost() + ) + ) + + Stdlib.HttpClient.request "get" "http://[0:0:0:0:0:0:0:0]" [] [] + == PACKAGE.Darklang.Stdlib.Result.Result.Error( + Stdlib.HttpClient.RequestError.NetworkError() + ) + + Stdlib.HttpClient.request "get" "localhost" [] [] + == PACKAGE.Darklang.Stdlib.Result.Result.Error( + Stdlib.HttpClient.RequestError.BadUrl( + Stdlib.HttpClient.BadUrlDetails.InvalidUri() + ) + ) + + Stdlib.HttpClient.request "get" "http://localhost" [] [] + == PACKAGE.Darklang.Stdlib.Result.Result.Error( + Stdlib.HttpClient.RequestError.BadUrl( + Stdlib.HttpClient.BadUrlDetails.InvalidHost() ) + ) + + Stdlib.HttpClient.request "get" "http://127.0.0.1" [] [] + == PACKAGE.Darklang.Stdlib.Result.Result.Error( + Stdlib.HttpClient.RequestError.BadUrl( + Stdlib.HttpClient.BadUrlDetails.InvalidHost() + ) + ) + + Stdlib.HttpClient.request "get" "http://[::1]" [] [] + == PACKAGE.Darklang.Stdlib.Result.Result.Error( + Stdlib.HttpClient.RequestError.BadUrl( + Stdlib.HttpClient.BadUrlDetails.InvalidHost() + ) + ) + + Stdlib.HttpClient.request "get" "http://[0:0:0:0:0:0:0:1]" [] [] + == PACKAGE.Darklang.Stdlib.Result.Result.Error( + Stdlib.HttpClient.RequestError.BadUrl( + Stdlib.HttpClient.BadUrlDetails.InvalidHost() + ) + ) Stdlib.HttpClient.request "get" "http://[0000:0000:0000:0000:0000:0000:0000:0001]" [] - [] = Stdlib.Result.Result.Error( + [] + == Stdlib.Result.Result.Error( Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.InvalidHost + Stdlib.HttpClient.BadUrlDetails.InvalidHost() ) ) - Stdlib.HttpClient.request "get" "http://127.0.0.17" [] [] = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Error( - Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.InvalidHost - ) + Stdlib.HttpClient.request "get" "http://127.0.0.17" [] [] + == PACKAGE.Darklang.Stdlib.Result.Result.Error( + Stdlib.HttpClient.RequestError.BadUrl( + Stdlib.HttpClient.BadUrlDetails.InvalidHost() ) + ) - Stdlib.HttpClient.request "get" "http://[::ffff:7f00:11]" [] [] = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Error( - Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.InvalidHost - ) + Stdlib.HttpClient.request "get" "http://[::ffff:7f00:11]" [] [] + == PACKAGE.Darklang.Stdlib.Result.Result.Error( + Stdlib.HttpClient.RequestError.BadUrl( + Stdlib.HttpClient.BadUrlDetails.InvalidHost() ) + ) - Stdlib.HttpClient.request "get" "http://[0:0:0:0:0:ffff:7f00:0011]" [] [] = Stdlib - .Result - .Result - .Error( - Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.InvalidHost - ) + Stdlib.HttpClient.request "get" "http://[0:0:0:0:0:ffff:7f00:0011]" [] [] + == Stdlib.Result.Result.Error( + Stdlib.HttpClient.RequestError.BadUrl( + Stdlib.HttpClient.BadUrlDetails.InvalidHost() ) + ) Stdlib.HttpClient.request "get" "http://[0000:0000:0000:0000:0000:ffff:7f00:0011]" [] - [] = Stdlib.Result.Result.Error( + [] + == Stdlib.Result.Result.Error( Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.InvalidHost + Stdlib.HttpClient.BadUrlDetails.InvalidHost() ) ) - Stdlib.HttpClient.request "get" "http://127.255.174.17" [] [] = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Error( - Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.InvalidHost - ) + Stdlib.HttpClient.request "get" "http://127.255.174.17" [] [] + == PACKAGE.Darklang.Stdlib.Result.Result.Error( + Stdlib.HttpClient.RequestError.BadUrl( + Stdlib.HttpClient.BadUrlDetails.InvalidHost() ) + ) - Stdlib.HttpClient.request "get" "http://metadata.google.internal" [] [] = Stdlib - .Result - .Result - .Error( - Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.InvalidHost - ) + Stdlib.HttpClient.request "get" "http://metadata.google.internal" [] [] + == Stdlib.Result.Result.Error( + Stdlib.HttpClient.RequestError.BadUrl( + Stdlib.HttpClient.BadUrlDetails.InvalidHost() ) + ) - Stdlib.HttpClient.request "get" "http://metadata" [] [] = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Error( - Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.InvalidHost - ) + Stdlib.HttpClient.request "get" "http://metadata" [] [] + == PACKAGE.Darklang.Stdlib.Result.Result.Error( + Stdlib.HttpClient.RequestError.BadUrl( + Stdlib.HttpClient.BadUrlDetails.InvalidHost() ) + ) - Stdlib.HttpClient.request "get" "http://169.254.169.254" [] [] = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Error( - Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.InvalidHost - ) + Stdlib.HttpClient.request "get" "http://169.254.169.254" [] [] + == PACKAGE.Darklang.Stdlib.Result.Result.Error( + Stdlib.HttpClient.RequestError.BadUrl( + Stdlib.HttpClient.BadUrlDetails.InvalidHost() ) + ) - Stdlib.HttpClient.request "get" "http://[::ffff:a9fe:a9fe]" [] [] = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Error( - Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.InvalidHost - ) + Stdlib.HttpClient.request "get" "http://[::ffff:a9fe:a9fe]" [] [] + == PACKAGE.Darklang.Stdlib.Result.Result.Error( + Stdlib.HttpClient.RequestError.BadUrl( + Stdlib.HttpClient.BadUrlDetails.InvalidHost() ) + ) - Stdlib.HttpClient.request "get" "http://[0:0:0:0:0:ffff:a9fe:a9fe]" [] [] = Stdlib - .Result - .Result - .Error( - Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.InvalidHost - ) + Stdlib.HttpClient.request "get" "http://[0:0:0:0:0:ffff:a9fe:a9fe]" [] [] + == Stdlib.Result.Result.Error( + Stdlib.HttpClient.RequestError.BadUrl( + Stdlib.HttpClient.BadUrlDetails.InvalidHost() ) + ) Stdlib.HttpClient.request "get" "http://[0000:0000:0000:0000:0000:ffff:a9fe:a9fe]" [] - [] = Stdlib.Result.Result.Error( + [] + == Stdlib.Result.Result.Error( Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.InvalidHost + Stdlib.HttpClient.BadUrlDetails.InvalidHost() ) ) - Stdlib.HttpClient.request "get" "http://169.254.0.0" [] [] = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Error( - Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.InvalidHost - ) + Stdlib.HttpClient.request "get" "http://169.254.0.0" [] [] + == PACKAGE.Darklang.Stdlib.Result.Result.Error( + Stdlib.HttpClient.RequestError.BadUrl( + Stdlib.HttpClient.BadUrlDetails.InvalidHost() ) + ) - Stdlib.HttpClient.request "get" "http://172.16.0.1" [] [] = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Error( - Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.InvalidHost - ) + Stdlib.HttpClient.request "get" "http://172.16.0.1" [] [] + == PACKAGE.Darklang.Stdlib.Result.Result.Error( + Stdlib.HttpClient.RequestError.BadUrl( + Stdlib.HttpClient.BadUrlDetails.InvalidHost() ) + ) - Stdlib.HttpClient.request "get" "http://[::ffff:ac10:1]" [] [] = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Error( - Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.InvalidHost - ) + Stdlib.HttpClient.request "get" "http://[::ffff:ac10:1]" [] [] + == PACKAGE.Darklang.Stdlib.Result.Result.Error( + Stdlib.HttpClient.RequestError.BadUrl( + Stdlib.HttpClient.BadUrlDetails.InvalidHost() ) + ) - Stdlib.HttpClient.request "get" "http://[0:0:0:0:0:ffff:ac10:0001]" [] [] = Stdlib - .Result - .Result - .Error( - Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.InvalidHost - ) + Stdlib.HttpClient.request "get" "http://[0:0:0:0:0:ffff:ac10:0001]" [] [] + == Stdlib.Result.Result.Error( + Stdlib.HttpClient.RequestError.BadUrl( + Stdlib.HttpClient.BadUrlDetails.InvalidHost() ) + ) Stdlib.HttpClient.request "get" "http://[0000:0000:0000:0000:0000:ffff:ac10:0001]" [] - [] = Stdlib.Result.Result.Error( + [] + == Stdlib.Result.Result.Error( Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.InvalidHost + Stdlib.HttpClient.BadUrlDetails.InvalidHost() ) ) - Stdlib.HttpClient.request "get" "http://192.168.1.1" [] [] = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Error( - Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.InvalidHost - ) + Stdlib.HttpClient.request "get" "http://192.168.1.1" [] [] + == PACKAGE.Darklang.Stdlib.Result.Result.Error( + Stdlib.HttpClient.RequestError.BadUrl( + Stdlib.HttpClient.BadUrlDetails.InvalidHost() ) + ) - Stdlib.HttpClient.request "get" "http://[::ffff:c0a8:101]" [] [] = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Error( - Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.InvalidHost - ) + Stdlib.HttpClient.request "get" "http://[::ffff:c0a8:101]" [] [] + == PACKAGE.Darklang.Stdlib.Result.Result.Error( + Stdlib.HttpClient.RequestError.BadUrl( + Stdlib.HttpClient.BadUrlDetails.InvalidHost() ) + ) - Stdlib.HttpClient.request "get" "http://[0:0:0:0:0:ffff:c0a8:0101]" [] [] = Stdlib - .Result - .Result - .Error( - Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.InvalidHost - ) + Stdlib.HttpClient.request "get" "http://[0:0:0:0:0:ffff:c0a8:0101]" [] [] + == Stdlib.Result.Result.Error( + Stdlib.HttpClient.RequestError.BadUrl( + Stdlib.HttpClient.BadUrlDetails.InvalidHost() ) + ) Stdlib.HttpClient.request "get" "http://[0000:0000:0000:0000:0000:ffff:c0a8:0101]" [] - [] = Stdlib.Result.Result.Error( + [] + == Stdlib.Result.Result.Error( Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.InvalidHost + Stdlib.HttpClient.BadUrlDetails.InvalidHost() ) ) // Check for sneaky banned urls - blocked via connection callback // 127.0.0.1 - Stdlib.HttpClient.request "get" "http://localtest.me" [] [] = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Error(Stdlib.HttpClient.RequestError.NetworkError) + Stdlib.HttpClient.request "get" "http://localtest.me" [] [] + == PACKAGE.Darklang.Stdlib.Result.Result.Error( + Stdlib.HttpClient.RequestError.NetworkError() + ) // 0.0.0.0 - Stdlib.HttpClient.request "get" "http://c.cx" [] [] = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Error(Stdlib.HttpClient.RequestError.NetworkError) + Stdlib.HttpClient.request "get" "http://c.cx" [] [] + == PACKAGE.Darklang.Stdlib.Result.Result.Error( + Stdlib.HttpClient.RequestError.NetworkError() + ) // invalid headers Stdlib.HttpClient.request "get" "http://google.com" [ ("Metadata-Flavor", "Google") ] - [] = Stdlib.Result.Result.Error( + [] + == Stdlib.Result.Result.Error( Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.InvalidRequest + Stdlib.HttpClient.BadUrlDetails.InvalidRequest() ) ) @@ -529,9 +405,10 @@ module Disallowed = "get" "http://google.com" [ ("metadata-flavor", "Google") ] - [] = Stdlib.Result.Result.Error( + [] + == Stdlib.Result.Result.Error( Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.InvalidRequest + Stdlib.HttpClient.BadUrlDetails.InvalidRequest() ) ) @@ -539,9 +416,10 @@ module Disallowed = "get" "http://google.com" [ ("Metadata-Flavor", "google") ] - [] = Stdlib.Result.Result.Error( + [] + == Stdlib.Result.Result.Error( Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.InvalidRequest + Stdlib.HttpClient.BadUrlDetails.InvalidRequest() ) ) @@ -549,9 +427,10 @@ module Disallowed = "get" "http://google.com" [ ("Metadata-Flavor", " Google ") ] - [] = Stdlib.Result.Result.Error( + [] + == Stdlib.Result.Result.Error( Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.InvalidRequest + Stdlib.HttpClient.BadUrlDetails.InvalidRequest() ) ) @@ -559,9 +438,10 @@ module Disallowed = "get" "http://google.com" [ ("X-Google-Metadata-Request", " True ") ] - [] = Stdlib.Result.Result.Error( + [] + == Stdlib.Result.Result.Error( Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.InvalidRequest + Stdlib.HttpClient.BadUrlDetails.InvalidRequest() ) ) @@ -569,22 +449,19 @@ module Disallowed = "get" "http://google.com" [ (" x-Google-metaData-Request", " True ") ] - [] = Stdlib.Result.Result.Error( + [] + == Stdlib.Result.Result.Error( Stdlib.HttpClient.RequestError.BadUrl( - Stdlib.HttpClient.BadUrlDetails.InvalidRequest + Stdlib.HttpClient.BadUrlDetails.InvalidRequest() ) ) module BadSSL = - Stdlib.HttpClient.request "get" "http://thenonexistingurlforsure.com" [] [] = Stdlib - .Result - .Result - .Error(Stdlib.HttpClient.RequestError.NetworkError) - - Stdlib.HttpClient.request "get" "https://self-signed.badssl.com" [] [] = Stdlib - .Result - .Result - .Error(Stdlib.HttpClient.RequestError.NetworkError) + Stdlib.HttpClient.request "get" "http://thenonexistingurlforsure.com" [] [] + == Stdlib.Result.Result.Error(Stdlib.HttpClient.RequestError.NetworkError()) + + Stdlib.HttpClient.request "get" "https://self-signed.badssl.com" [] [] + == Stdlib.Result.Result.Error(Stdlib.HttpClient.RequestError.NetworkError()) diff --git a/backend/testfiles/execution/stdlib/int128.dark b/backend/testfiles/execution/stdlib/int128.dark index 2523f92d01..2164948fce 100644 --- a/backend/testfiles/execution/stdlib/int128.dark +++ b/backend/testfiles/execution/stdlib/int128.dark @@ -1,275 +1,273 @@ -Stdlib.Int128.absoluteValue_v0 -5Q = 5Q -Stdlib.Int128.absoluteValue_v0 5Q = 5Q +Stdlib.Int128.absoluteValue -5Q == 5Q +Stdlib.Int128.absoluteValue 5Q == 5Q -Stdlib.Int128.absoluteValue_v0 -170141183460469231731687303715884105728Q = Builtin.testDerrorMessage +Stdlib.Int128.absoluteValue -170141183460469231731687303715884105728Q == Builtin.testDerrorMessage "Out of range" -Stdlib.Int128.max_v0 5Q 6Q = 6Q -Stdlib.Int128.max_v0 10Q 1Q = 10Q -Stdlib.Int128.max_v0 -5Q 6Q = 6Q +Stdlib.Int128.max 5Q 6Q == 6Q +Stdlib.Int128.max 10Q 1Q == 10Q +Stdlib.Int128.max -5Q 6Q == 6Q -Stdlib.Int128.max_v0 +Stdlib.Int128.max 170141183460469231731687303715884105727Q - -170141183460469231731687303715884105728Q = 170141183460469231731687303715884105727Q + -170141183460469231731687303715884105728Q == 170141183460469231731687303715884105727Q -Stdlib.Int128.min_v0 5Q 6Q = 5Q -Stdlib.Int128.min_v0 50Q -10Q = -10Q -Stdlib.Int128.min_v0 -5Q 6Q = -5Q +Stdlib.Int128.min 5Q 6Q == 5Q +Stdlib.Int128.min 50Q -10Q == -10Q +Stdlib.Int128.min -5Q 6Q == -5Q -Stdlib.Int128.min_v0 +Stdlib.Int128.min 170141183460469231731687303715884105727Q - -170141183460469231731687303715884105728Q = -170141183460469231731687303715884105728Q - - -Stdlib.Int128.clamp_v0 -5Q -2Q 5Q = -2Q -Stdlib.Int128.clamp_v0 -3Q -2Q 1Q = -2Q -Stdlib.Int128.clamp_v0 -5Q 1Q 1Q = 1Q -Stdlib.Int128.clamp_v0 1Q 2Q 1Q = 1Q -Stdlib.Int128.clamp_v0 3Q 0Q 2Q = 2Q -Stdlib.Int128.clamp_v0 -100Q 0Q 0Q = 0Q -Stdlib.Int128.clamp_v0 100Q 0Q 0Q = 0Q -Stdlib.Int128.clamp_v0 -100Q 0Q -1Q = -1Q -Stdlib.Int128.clamp_v0 100Q 0Q -1Q = 0Q -Stdlib.Int128.clamp_v0 -100Q -1Q 0Q = -1Q -Stdlib.Int128.clamp_v0 -100Q 1Q 0Q = 0Q -Stdlib.Int128.clamp_v0 100Q 1Q 0Q = 1Q - -Stdlib.Int128.negate_v0 -5Q = 5Q -Stdlib.Int128.negate_v0 5Q = -5Q -Stdlib.Int128.negate_v0 0Q = 0Q -Stdlib.Int128.negate_v0 -0Q = 0Q - -Stdlib.Int128.negate_v0 -170141183460469231731687303715884105728Q = Builtin.testDerrorMessage + -170141183460469231731687303715884105728Q == -170141183460469231731687303715884105728Q + + +Stdlib.Int128.clamp -5Q -2Q 5Q == -2Q +Stdlib.Int128.clamp -3Q -2Q 1Q == -2Q +Stdlib.Int128.clamp -5Q 1Q 1Q == 1Q +Stdlib.Int128.clamp 1Q 2Q 1Q == 1Q +Stdlib.Int128.clamp 3Q 0Q 2Q == 2Q +Stdlib.Int128.clamp -100Q 0Q 0Q == 0Q +Stdlib.Int128.clamp 100Q 0Q 0Q == 0Q +Stdlib.Int128.clamp -100Q 0Q -1Q == -1Q +Stdlib.Int128.clamp 100Q 0Q -1Q == 0Q +Stdlib.Int128.clamp -100Q -1Q 0Q == -1Q +Stdlib.Int128.clamp -100Q 1Q 0Q == 0Q +Stdlib.Int128.clamp 100Q 1Q 0Q == 1Q + +Stdlib.Int128.negate -5Q == 5Q +Stdlib.Int128.negate 5Q == -5Q +Stdlib.Int128.negate 0Q == 0Q +Stdlib.Int128.negate -0Q == 0Q + +Stdlib.Int128.negate -170141183460469231731687303715884105728Q == Builtin.testDerrorMessage "Out of range" -Stdlib.Int128.remainder_v0 15Q 6Q = Stdlib.Result.Result.Ok 3Q +Stdlib.Int128.remainder 15Q 6Q == Stdlib.Result.Result.Ok(3Q) -Stdlib.Int128.remainder_v0 20Q 8Q = Stdlib.Result.Result.Ok 4Q +Stdlib.Int128.remainder 20Q 8Q == Stdlib.Result.Result.Ok(4Q) -Stdlib.Int128.remainder_v0 -20Q 8Q = Stdlib.Result.Result.Ok -4Q +Stdlib.Int128.remainder -20Q 8Q == Stdlib.Result.Result.Ok(-4Q) -Stdlib.Int128.remainder_v0 -20Q -8Q = Stdlib.Result.Result.Ok -4Q +Stdlib.Int128.remainder -20Q -8Q == Stdlib.Result.Result.Ok(-4Q) -Stdlib.Int128.remainder_v0 -15Q 6Q = Stdlib.Result.Result.Ok -3Q +Stdlib.Int128.remainder -15Q 6Q == Stdlib.Result.Result.Ok(-3Q) -Stdlib.Int128.remainder_v0 5Q 0Q = Builtin.testDerrorMessage "Division by zero" +Stdlib.Int128.remainder 5Q 0Q == Builtin.testDerrorMessage "Division by zero" -Stdlib.Int128.add_v0 10Q 9Q = 19Q -Stdlib.Int128.add_v0 88Q 9Q = 97Q -Stdlib.Int128.add_v0 -1Q 2Q = 1Q -Stdlib.Int128.add_v0 1Q 0Q = 1Q -Stdlib.Int128.add_v0 -55Q 55Q = 0Q -Stdlib.Int128.add_v0 55Q 55Q = 110Q -Stdlib.Int128.add_v0 9223372036854775807Q 2Q = 9223372036854775809Q +Stdlib.Int128.add 10Q 9Q == 19Q +Stdlib.Int128.add 88Q 9Q == 97Q +Stdlib.Int128.add -1Q 2Q == 1Q +Stdlib.Int128.add 1Q 0Q == 1Q +Stdlib.Int128.add -55Q 55Q == 0Q +Stdlib.Int128.add 55Q 55Q == 110Q +Stdlib.Int128.add 9223372036854775807Q 2Q == 9223372036854775809Q -Stdlib.Int128.add_v0 170141183460469231731687303715884105726Q 4Q = Builtin.testDerrorMessage +Stdlib.Int128.add 170141183460469231731687303715884105726Q 4Q == Builtin.testDerrorMessage "Out of range" -Stdlib.Int128.subtract_v0 10Q 9Q = 1Q -Stdlib.Int128.subtract_v0 88Q 9Q = 79Q -Stdlib.Int128.subtract_v0 0Q 1Q = -1Q -Stdlib.Int128.subtract_v0 1Q 0Q = 1Q -Stdlib.Int128.subtract_v0 -55Q -55Q = 0Q +Stdlib.Int128.subtract 10Q 9Q == 1Q +Stdlib.Int128.subtract 88Q 9Q == 79Q +Stdlib.Int128.subtract 0Q 1Q == -1Q +Stdlib.Int128.subtract 1Q 0Q == 1Q +Stdlib.Int128.subtract -55Q -55Q == 0Q -Stdlib.Int128.subtract_v0 -55Q 170141183460469231731687303715884105726Q = Builtin.testDerrorMessage +Stdlib.Int128.subtract -55Q 170141183460469231731687303715884105726Q == Builtin.testDerrorMessage "Out of range" -Stdlib.Int128.multiply_v0 8Q 8Q = 64Q -Stdlib.Int128.multiply_v0 1Q 0Q = 0Q +Stdlib.Int128.multiply 8Q 8Q == 64Q +Stdlib.Int128.multiply 1Q 0Q == 0Q -Stdlib.Int128.divide_v0 10Q 5Q = 2Q -Stdlib.Int128.divide_v0 17Q 3Q = 5Q -Stdlib.Int128.divide_v0 -8Q 5Q = -1Q -Stdlib.Int128.divide_v0 0Q 1Q = 0Q +Stdlib.Int128.divide 10Q 5Q == 2Q +Stdlib.Int128.divide 17Q 3Q == 5Q +Stdlib.Int128.divide -8Q 5Q == -1Q +Stdlib.Int128.divide 0Q 1Q == 0Q -Stdlib.Int128.divide_v0 1Q 0Q = Builtin.testDerrorMessage "Division by zero" +Stdlib.Int128.divide 1Q 0Q == Builtin.testDerrorMessage "Division by zero" -Stdlib.Int128.divide_v0 -170141183460469231731687303715884105728Q -1Q = Builtin.testDerrorMessage +Stdlib.Int128.divide -170141183460469231731687303715884105728Q -1Q == Builtin.testDerrorMessage "Out of range" -Stdlib.Int128.greaterThan_v0 20Q 1Q = true +Stdlib.Int128.greaterThan 20Q 1Q == true -Stdlib.Int128.greaterThan_v0 20Q 170141183460469231731687303715884105727Q = false +Stdlib.Int128.greaterThan 20Q 170141183460469231731687303715884105727Q == false -Stdlib.Int128.greaterThanOrEqualTo_v0 0Q 1Q = false -Stdlib.Int128.greaterThanOrEqualTo_v0 1Q 0Q = true -Stdlib.Int128.greaterThanOrEqualTo_v0 6Q 1Q = true -Stdlib.Int128.greaterThanOrEqualTo_v0 6Q 8Q = false -Stdlib.Int128.greaterThanOrEqualTo_v0 -5Q -20Q = true -Stdlib.Int128.greaterThanOrEqualTo_v0 -20Q -1Q = false -Stdlib.Int128.greaterThanOrEqualTo_v0 -20Q -20Q = true +Stdlib.Int128.greaterThanOrEqualTo 0Q 1Q == false +Stdlib.Int128.greaterThanOrEqualTo 1Q 0Q == true +Stdlib.Int128.greaterThanOrEqualTo 6Q 1Q == true +Stdlib.Int128.greaterThanOrEqualTo 6Q 8Q == false +Stdlib.Int128.greaterThanOrEqualTo -5Q -20Q == true +Stdlib.Int128.greaterThanOrEqualTo -20Q -1Q == false +Stdlib.Int128.greaterThanOrEqualTo -20Q -20Q == true -Stdlib.Int128.greaterThanOrEqualTo_v0 -170141183460469231731687303715884105728Q -20Q = false +Stdlib.Int128.greaterThanOrEqualTo -170141183460469231731687303715884105728Q -20Q == false -Stdlib.Int128.lessThanOrEqualTo_v0 6Q 8Q = true -Stdlib.Int128.lessThanOrEqualTo_v0 10Q 1Q = false -Stdlib.Int128.lessThanOrEqualTo_v0 0Q 1Q = true -Stdlib.Int128.lessThanOrEqualTo_v0 1Q 0Q = false +Stdlib.Int128.lessThanOrEqualTo 6Q 8Q == true +Stdlib.Int128.lessThanOrEqualTo 10Q 1Q == false +Stdlib.Int128.lessThanOrEqualTo 0Q 1Q == true +Stdlib.Int128.lessThanOrEqualTo 1Q 0Q == false -Stdlib.Int128.lessThan_v0 +Stdlib.Int128.lessThan -170141183460469231731687303715884105728Q - 170141183460469231731687303715884105727Q = true + 170141183460469231731687303715884105727Q == true -Stdlib.Int128.lessThan_v0 6Q 8Q = true -Stdlib.Int128.lessThan_v0 10Q 1Q = false -Stdlib.Int128.lessThan_v0 0Q 1Q = true -Stdlib.Int128.lessThan_v0 1Q 0Q = false +Stdlib.Int128.lessThan 6Q 8Q == true +Stdlib.Int128.lessThan 10Q 1Q == false +Stdlib.Int128.lessThan 0Q 1Q == true +Stdlib.Int128.lessThan 1Q 0Q == false -Stdlib.Int128.lessThan_v0 +Stdlib.Int128.lessThan -170141183460469231731687303715884105728Q - 170141183460469231731687303715884105727Q = true + 170141183460469231731687303715884105727Q == true -Stdlib.Int128.toString 0Q = "0" -Stdlib.Int128.toString 1Q = "1" -Stdlib.Int128.toString -1Q = "-1" -Stdlib.Int128.toString -170141183460469231731687303715884105728Q = "-170141183460469231731687303715884105728" -Stdlib.Int128.toString 170141183460469231731687303715884105727Q = "170141183460469231731687303715884105727" +Stdlib.Int128.toString 0Q == "0" +Stdlib.Int128.toString 1Q == "1" +Stdlib.Int128.toString -1Q == "-1" +Stdlib.Int128.toString -170141183460469231731687303715884105728Q == "-170141183460469231731687303715884105728" +Stdlib.Int128.toString 170141183460469231731687303715884105727Q == "170141183460469231731687303715884105727" -Stdlib.Int128.toFloat_v0 2Q = 2.0 -Stdlib.Int128.toFloat_v0 170141183460469231731687303715884105727Q = 170141183460469231731687303715884105727.0 -Stdlib.Int128.toFloat_v0 -170141183460469231731687303715884105728Q = -170141183460469231731687303715884105728.0 -Stdlib.Int128.toFloat_v0 -10Q = -10.0 +Stdlib.Int128.toFloat 2Q == 2.0 +Stdlib.Int128.toFloat 170141183460469231731687303715884105727Q == 170141183460469231731687303715884105727.0 +Stdlib.Int128.toFloat -170141183460469231731687303715884105728Q == -170141183460469231731687303715884105728.0 +Stdlib.Int128.toFloat -10Q == -10.0 -Stdlib.Int128.sqrt_v0 4Q = 2.0 -Stdlib.Int128.sqrt_v0 100Q = 10.0 -Stdlib.Int128.sqrt_v0 86Q = 9.273618495495704 +Stdlib.Int128.sqrt 4Q == 2.0 +Stdlib.Int128.sqrt 100Q == 10.0 +Stdlib.Int128.sqrt 86Q == 9.273618495495704 -Stdlib.Int128.mod_v0 15Q 5Q = 0Q -Stdlib.Int128.mod_v0 15Q 6Q = 3Q -Stdlib.Int128.mod_v0 0Q 15Q = 0Q -Stdlib.Int128.mod_v0 -1Q 2Q = 1Q -Stdlib.Int128.mod_v0 -128Q 53Q = 31Q -Stdlib.Int128.mod_v0 127Q 3Q = 1Q +Stdlib.Int128.mod 15Q 5Q == 0Q +Stdlib.Int128.mod 15Q 6Q == 3Q +Stdlib.Int128.mod 0Q 15Q == 0Q +Stdlib.Int128.mod -1Q 2Q == 1Q +Stdlib.Int128.mod -128Q 53Q == 31Q +Stdlib.Int128.mod 127Q 3Q == 1Q -Stdlib.Int128.mod_v0 5Q 0Q = Builtin.testDerrorMessage "Zero modulus" +Stdlib.Int128.mod 5Q 0Q == Builtin.testDerrorMessage "Zero modulus" -Stdlib.Int128.mod_v0 5Q -5Q = Builtin.testDerrorMessage "Negative modulus" +Stdlib.Int128.mod 5Q -5Q == Builtin.testDerrorMessage "Negative modulus" -Stdlib.Int128.parse_v0 "0" = Stdlib.Result.Result.Ok 0Q +Stdlib.Int128.parse "0" == Stdlib.Result.Result.Ok(0Q) -Stdlib.Int128.parse_v0 "1" = Stdlib.Result.Result.Ok 1Q +Stdlib.Int128.parse "1" == Stdlib.Result.Result.Ok(1Q) -Stdlib.Int128.parse_v0 " 1" = Stdlib.Result.Result.Ok 1Q +Stdlib.Int128.parse " 1" == Stdlib.Result.Result.Ok(1Q) -Stdlib.Int128.parse_v0 "1 " = Stdlib.Result.Result.Ok 1Q +Stdlib.Int128.parse "1 " == Stdlib.Result.Result.Ok(1Q) -Stdlib.Int128.parse_v0 "+1" = Stdlib.Result.Result.Ok 1Q +Stdlib.Int128.parse "+1" == Stdlib.Result.Result.Ok(1Q) -Stdlib.Int128.parse_v0 " +1 " = Stdlib.Result.Result.Ok 1Q +Stdlib.Int128.parse " +1 " == Stdlib.Result.Result.Ok(1Q) -Stdlib.Int128.parse_v0 "-1" = Stdlib.Result.Result.Ok -1Q +Stdlib.Int128.parse "-1" == Stdlib.Result.Result.Ok(-1Q) -Stdlib.Int128.parse_v0 "078" = Stdlib.Result.Result.Ok 78Q // "octal" format ignored +Stdlib.Int128.parse "078" == Stdlib.Result.Result.Ok(78Q) // "octal" format ignored -Stdlib.Int128.parse_v0 "-00001" = Stdlib.Result.Result.Ok -1Q +Stdlib.Int128.parse "-00001" == Stdlib.Result.Result.Ok(-1Q) -Stdlib.Int128.parse_v0 "170141183460469231731687303715884105727" = Stdlib.Result.Result.Ok - 170141183460469231731687303715884105727Q +Stdlib.Int128.parse "170141183460469231731687303715884105727" == Stdlib.Result.Result.Ok(170141183460469231731687303715884105727Q) -Stdlib.Int128.parse_v0 "-170141183460469231731687303715884105728" = Stdlib.Result.Result.Ok - -170141183460469231731687303715884105728Q +Stdlib.Int128.parse "-170141183460469231731687303715884105728" == Stdlib.Result.Result.Ok(-170141183460469231731687303715884105728Q) -Stdlib.Int128.parse_v0 "170141183460469231731687303715884105729" = Stdlib.Result.Result.Error - Stdlib.Int128.ParseError.OutOfRange +Stdlib.Int128.parse "170141183460469231731687303715884105729" == Stdlib.Result.Result.Error( + Stdlib.Int128.ParseError.OutOfRange()) -Stdlib.Int128.parse_v0 "-170141183460469231731687303715884105729" = Stdlib.Result.Result.Error - Stdlib.Int128.ParseError.OutOfRange +Stdlib.Int128.parse "-170141183460469231731687303715884105729" == Stdlib.Result.Result.Error( + Stdlib.Int128.ParseError.OutOfRange()) -Stdlib.Int128.parse_v0 "1 2 3" = Stdlib.Result.Result.Error - Stdlib.Int128.ParseError.BadFormat +Stdlib.Int128.parse "1 2 3" == Stdlib.Result.Result.Error( + Stdlib.Int128.ParseError.BadFormat()) -Stdlib.Int128.parse_v0 "+ 1" = Stdlib.Result.Result.Error - Stdlib.Int128.ParseError.BadFormat +Stdlib.Int128.parse "+ 1" == Stdlib.Result.Result.Error( + Stdlib.Int128.ParseError.BadFormat()) -Stdlib.Int128.parse_v0 "- 1" = Stdlib.Result.Result.Error - Stdlib.Int128.ParseError.BadFormat +Stdlib.Int128.parse "- 1" == Stdlib.Result.Result.Error( + Stdlib.Int128.ParseError.BadFormat()) -Stdlib.Int128.parse_v0 "0xA" = Stdlib.Result.Result.Error - Stdlib.Int128.ParseError.BadFormat +Stdlib.Int128.parse "0xA" == Stdlib.Result.Result.Error( + Stdlib.Int128.ParseError.BadFormat()) -Stdlib.Int128.parse_v0 "0x123" = Stdlib.Result.Result.Error - Stdlib.Int128.ParseError.BadFormat +Stdlib.Int128.parse "0x123" == Stdlib.Result.Result.Error( + Stdlib.Int128.ParseError.BadFormat()) -Stdlib.Int128.parse_v0 "0b0100" = Stdlib.Result.Result.Error - Stdlib.Int128.ParseError.BadFormat +Stdlib.Int128.parse "0b0100" == Stdlib.Result.Result.Error( + Stdlib.Int128.ParseError.BadFormat()) -Stdlib.Int128.parse_v0 "pi" = Stdlib.Result.Result.Error - Stdlib.Int128.ParseError.BadFormat +Stdlib.Int128.parse "pi" == Stdlib.Result.Result.Error( + Stdlib.Int128.ParseError.BadFormat()) -Stdlib.Int128.parse_v0 "PACKAGE.Darklang.Stdlib.Math.pi" = Stdlib.Result.Result.Error - Stdlib.Int128.ParseError.BadFormat +Stdlib.Int128.parse "PACKAGE.Darklang.Stdlib.Math.pi" == Stdlib.Result.Result.Error( + Stdlib.Int128.ParseError.BadFormat()) -Stdlib.Int128.parse_v0 "1.23E+04" = Stdlib.Result.Result.Error - Stdlib.Int128.ParseError.BadFormat +Stdlib.Int128.parse "1.23E+04" == Stdlib.Result.Result.Error( + Stdlib.Int128.ParseError.BadFormat()) -Stdlib.Int128.parse_v0 "" = Stdlib.Result.Result.Error - Stdlib.Int128.ParseError.BadFormat +Stdlib.Int128.parse "" == Stdlib.Result.Result.Error( + Stdlib.Int128.ParseError.BadFormat()) -Stdlib.Int128.parse_v0 "1Q" = Stdlib.Result.Result.Error - Stdlib.Int128.ParseError.BadFormat +Stdlib.Int128.parse "1Q" == Stdlib.Result.Result.Error( + Stdlib.Int128.ParseError.BadFormat()) -Stdlib.Int128.parse_v0 "one" = Stdlib.Result.Result.Error - Stdlib.Int128.ParseError.BadFormat +Stdlib.Int128.parse "one" == Stdlib.Result.Result.Error( + Stdlib.Int128.ParseError.BadFormat()) -Stdlib.Int128.parse_v0 "XQV" = Stdlib.Result.Result.Error - Stdlib.Int128.ParseError.BadFormat +Stdlib.Int128.parse "XQV" == Stdlib.Result.Result.Error( + Stdlib.Int128.ParseError.BadFormat()) -Stdlib.Int128.fromInt8_v0 0y = 0Q +Stdlib.Int128.fromInt8 0y == 0Q -Stdlib.Int128.fromInt8_v0 1y = 1Q +Stdlib.Int128.fromInt8 1y == 1Q -Stdlib.Int128.fromInt8_v0 127y = 127Q +Stdlib.Int128.fromInt8 127y == 127Q -Stdlib.Int128.fromInt8_v0 -128y = -128Q +Stdlib.Int128.fromInt8 -128y == -128Q -Stdlib.Int128.fromUInt8_v0 0uy = 0Q +Stdlib.Int128.fromUInt8 0uy == 0Q -Stdlib.Int128.fromUInt8_v0 1uy = 1Q +Stdlib.Int128.fromUInt8 1uy == 1Q -Stdlib.Int128.fromUInt8_v0 255uy = 255Q +Stdlib.Int128.fromUInt8 255uy == 255Q -Stdlib.Int128.fromInt16_v0 0s = 0Q +Stdlib.Int128.fromInt16 0s == 0Q -Stdlib.Int128.fromInt16_v0 1s = 1Q +Stdlib.Int128.fromInt16 1s == 1Q -Stdlib.Int128.fromInt16_v0 32767s = 32767Q +Stdlib.Int128.fromInt16 32767s == 32767Q -Stdlib.Int128.fromInt16_v0 -32768s = -32768Q +Stdlib.Int128.fromInt16 -32768s == -32768Q -Stdlib.Int128.fromUInt16_v0 0us = 0Q +Stdlib.Int128.fromUInt16 0us == 0Q -Stdlib.Int128.fromUInt16_v0 1us = 1Q +Stdlib.Int128.fromUInt16 1us == 1Q -Stdlib.Int128.fromUInt16_v0 65535us = 65535Q +Stdlib.Int128.fromUInt16 65535us == 65535Q -Stdlib.Int128.fromInt32_v0 0l = 0Q +Stdlib.Int128.fromInt32 0l == 0Q -Stdlib.Int128.fromInt32_v0 1l = 1Q +Stdlib.Int128.fromInt32 1l == 1Q -Stdlib.Int128.fromInt32_v0 2147483647l = 2147483647Q +Stdlib.Int128.fromInt32 2147483647l == 2147483647Q -Stdlib.Int128.fromInt32_v0 -2147483648l = -2147483648Q +Stdlib.Int128.fromInt32 -2147483648l == -2147483648Q -Stdlib.Int128.fromUInt32_v0 0ul = 0Q +Stdlib.Int128.fromUInt32 0ul == 0Q -Stdlib.Int128.fromUInt32_v0 1ul = 1Q +Stdlib.Int128.fromUInt32 1ul == 1Q -Stdlib.Int128.fromUInt32_v0 4294967295ul = 4294967295Q +Stdlib.Int128.fromUInt32 4294967295ul == 4294967295Q -Stdlib.Int128.fromInt64_v0 0L = 0Q +Stdlib.Int128.fromInt64 0L == 0Q -Stdlib.Int128.fromInt64_v0 1L = 1Q +Stdlib.Int128.fromInt64 1L == 1Q -Stdlib.Int128.fromInt64_v0 9223372036854775807L = 9223372036854775807Q +Stdlib.Int128.fromInt64 9223372036854775807L == 9223372036854775807Q -Stdlib.Int128.fromInt64_v0 -9223372036854775808L = -9223372036854775808Q +Stdlib.Int128.fromInt64 -9223372036854775808L == -9223372036854775808Q -Stdlib.Int128.fromUInt64_v0 0UL = 0Q +Stdlib.Int128.fromUInt64 0UL == 0Q -Stdlib.Int128.fromUInt64_v0 1UL = 1Q +Stdlib.Int128.fromUInt64 1UL == 1Q -Stdlib.Int128.fromUInt64_v0 18446744073709551615UL = 18446744073709551615Q \ No newline at end of file +Stdlib.Int128.fromUInt64 18446744073709551615UL == 18446744073709551615Q \ No newline at end of file diff --git a/backend/testfiles/execution/stdlib/int16.dark b/backend/testfiles/execution/stdlib/int16.dark index 22647f7669..2b68e28894 100644 --- a/backend/testfiles/execution/stdlib/int16.dark +++ b/backend/testfiles/execution/stdlib/int16.dark @@ -1,329 +1,335 @@ -Stdlib.Int16.absoluteValue_v0 -5s = 5s -Stdlib.Int16.absoluteValue_v0 5s = 5s +Stdlib.Int16.absoluteValue -5s == 5s +Stdlib.Int16.absoluteValue 5s == 5s -Stdlib.Int16.absoluteValue_v0 -32768s = Builtin.testDerrorMessage "Out of range" +Stdlib.Int16.absoluteValue -32768s == Builtin.testDerrorMessage "Out of range" -Stdlib.Int16.clamp_v0 -5s -2s 5s = -2s -Stdlib.Int16.clamp_v0 -3s -2s 1s = -2s -Stdlib.Int16.clamp_v0 -5s 1s 1s = 1s -Stdlib.Int16.clamp_v0 1s 2s 1s = 1s -Stdlib.Int16.clamp_v0 3s 0s 2s = 2s +Stdlib.Int16.clamp -5s -2s 5s == -2s +Stdlib.Int16.clamp -3s -2s 1s == -2s +Stdlib.Int16.clamp -5s 1s 1s == 1s +Stdlib.Int16.clamp 1s 2s 1s == 1s +Stdlib.Int16.clamp 3s 0s 2s == 2s -Stdlib.Int16.max_v0 5s 6s = 6s -Stdlib.Int16.max_v0 10s 1s = 10s -Stdlib.Int16.max_v0 -5s 6s = 6s -Stdlib.Int16.max_v0 32767s -32768s = 32767s +Stdlib.Int16.max 5s 6s == 6s +Stdlib.Int16.max 10s 1s == 10s +Stdlib.Int16.max -5s 6s == 6s +Stdlib.Int16.max 32767s -32768s == 32767s -Stdlib.Int16.min_v0 5s 6s = 5s -Stdlib.Int16.min_v0 50s -10s = -10s -Stdlib.Int16.min_v0 -5s 6s = -5s -Stdlib.Int16.min_v0 32767s -32768s = -32768s +Stdlib.Int16.min 5s 6s == 5s +Stdlib.Int16.min 50s -10s == -10s +Stdlib.Int16.min -5s 6s == -5s +Stdlib.Int16.min 32767s -32768s == -32768s -Stdlib.Int16.clamp_v0 -100s 0s 0s = 0s -Stdlib.Int16.clamp_v0 100s 0s 0s = 0s -Stdlib.Int16.clamp_v0 -100s 0s -1s = -1s -Stdlib.Int16.clamp_v0 100s 0s -1s = 0s -Stdlib.Int16.clamp_v0 -100s -1s 0s = -1s -Stdlib.Int16.clamp_v0 -100s 1s 0s = 0s -Stdlib.Int16.clamp_v0 100s 1s 0s = 1s +Stdlib.Int16.clamp -100s 0s 0s == 0s +Stdlib.Int16.clamp 100s 0s 0s == 0s +Stdlib.Int16.clamp -100s 0s -1s == -1s +Stdlib.Int16.clamp 100s 0s -1s == 0s +Stdlib.Int16.clamp -100s -1s 0s == -1s +Stdlib.Int16.clamp -100s 1s 0s == 0s +Stdlib.Int16.clamp 100s 1s 0s == 1s -Stdlib.Int16.add_v0 10s 9s = 19s -Stdlib.Int16.add_v0 88s 9s = 97s -Stdlib.Int16.add_v0 -1s 2s = 1s -Stdlib.Int16.add_v0 1s 0s = 1s -Stdlib.Int16.add_v0 -55s 55s = 0s -Stdlib.Int16.add_v0 30000s 2767s = 32767s -Stdlib.Int16.add_v0 -30000s -2768s = -32768s +Stdlib.Int16.add 10s 9s == 19s +Stdlib.Int16.add 88s 9s == 97s +Stdlib.Int16.add -1s 2s == 1s +Stdlib.Int16.add 1s 0s == 1s +Stdlib.Int16.add -55s 55s == 0s +Stdlib.Int16.add 30000s 2767s == 32767s +Stdlib.Int16.add -30000s -2768s == -32768s -Stdlib.Int16.add_v0 -30000s -2769s = Builtin.testDerrorMessage "Out of range" +Stdlib.Int16.add -30000s -2769s == Builtin.testDerrorMessage "Out of range" -Stdlib.Int16.add_v0 30000s 2768s = Builtin.testDerrorMessage "Out of range" +Stdlib.Int16.add 30000s 2768s == Builtin.testDerrorMessage "Out of range" -Stdlib.Int16.subtract_v0 10s 9s = 1s -Stdlib.Int16.subtract_v0 88s 9s = 79s -Stdlib.Int16.subtract_v0 0s 1s = -1s -Stdlib.Int16.subtract_v0 1s 0s = 1s -Stdlib.Int16.subtract_v0 -55s -55s = 0s +Stdlib.Int16.subtract 10s 9s == 1s +Stdlib.Int16.subtract 88s 9s == 79s +Stdlib.Int16.subtract 0s 1s == -1s +Stdlib.Int16.subtract 1s 0s == 1s +Stdlib.Int16.subtract -55s -55s == 0s -Stdlib.Int16.subtract_v0 -2769s 30000s = Builtin.testDerrorMessage "Out of range" +Stdlib.Int16.subtract -2769s 30000s == Builtin.testDerrorMessage "Out of range" -Stdlib.Int16.multiply_v0 8s 8s = 64s -Stdlib.Int16.multiply_v0 1s 0s = 0s +Stdlib.Int16.multiply 8s 8s == 64s +Stdlib.Int16.multiply 1s 0s == 0s -Stdlib.Int16.multiply_v0 5145s 5145s = Builtin.testDerrorMessage "Out of range" +Stdlib.Int16.multiply 5145s 5145s == Builtin.testDerrorMessage "Out of range" -Stdlib.Int16.power_v0 2s 3s = 8s -Stdlib.Int16.power_v0 0s 1s = 0s -Stdlib.Int16.power_v0 1s 0s = 1s -Stdlib.Int16.power_v0 0s 0s = 1s -Stdlib.Int16.power_v0 -2s 5s = -32s -Stdlib.Int16.power_v0 -1s 5s = -1s -Stdlib.Int16.power_v0 -1s 6s = 1s -Stdlib.Int16.power_v0 1s 32767s = 1s +Stdlib.Int16.power 2s 3s == 8s +Stdlib.Int16.power 0s 1s == 0s +Stdlib.Int16.power 1s 0s == 1s +Stdlib.Int16.power 0s 0s == 1s +Stdlib.Int16.power -2s 5s == -32s +Stdlib.Int16.power -1s 5s == -1s +Stdlib.Int16.power -1s 6s == 1s +Stdlib.Int16.power 1s 32767s == 1s -Stdlib.Int16.power_v0 2s 15s = Builtin.testDerrorMessage "Out of range" +Stdlib.Int16.power 2s 15s == Builtin.testDerrorMessage "Out of range" -Stdlib.Int16.power_v0 120s 20s = Builtin.testDerrorMessage "Out of range" +Stdlib.Int16.power 120s 20s == Builtin.testDerrorMessage "Out of range" -Stdlib.Int16.power_v0 2s -3s = Builtin.testDerrorMessage "Negative exponent" +Stdlib.Int16.power 2s -3s == Builtin.testDerrorMessage "Negative exponent" -Stdlib.Int16.divide_v0 10s 5s = 2s -Stdlib.Int16.divide_v0 17s 3s = 5s -Stdlib.Int16.divide_v0 -8s 5s = -1s -Stdlib.Int16.divide_v0 0s 1s = 0s +Stdlib.Int16.divide 10s 5s == 2s +Stdlib.Int16.divide 17s 3s == 5s +Stdlib.Int16.divide -8s 5s == -1s +Stdlib.Int16.divide 0s 1s == 0s -Stdlib.Int16.divide_v0 1s 0s = Builtin.testDerrorMessage "Division by zero" +Stdlib.Int16.divide 1s 0s == Builtin.testDerrorMessage "Division by zero" -Stdlib.Int16.divide_v0 -32768s -1s = Builtin.testDerrorMessage "Out of range" +Stdlib.Int16.divide -32768s -1s == Builtin.testDerrorMessage "Out of range" -Stdlib.Int16.divide_v0 -32768s 1s = -32768s +Stdlib.Int16.divide -32768s 1s == -32768s -Stdlib.Int16.negate_v0 -5s = 5s -Stdlib.Int16.negate_v0 5s = -5s -Stdlib.Int16.negate_v0 0s = 0s -Stdlib.Int16.negate_v0 -0s = 0s +Stdlib.Int16.negate -5s == 5s +Stdlib.Int16.negate 5s == -5s +Stdlib.Int16.negate 0s == 0s +Stdlib.Int16.negate -0s == 0s -Stdlib.Int16.negate_v0 -32768s = Builtin.testDerrorMessage "Out of range" +Stdlib.Int16.negate -32768s == Builtin.testDerrorMessage "Out of range" -Stdlib.Int16.greaterThan_v0 20s 1s = true -Stdlib.Int16.greaterThan_v0 20s 130s = false +Stdlib.Int16.greaterThan 20s 1s == true +Stdlib.Int16.greaterThan 20s 130s == false -Stdlib.Int16.greaterThanOrEqualTo_v0 0s 1s = false -Stdlib.Int16.greaterThanOrEqualTo_v0 1s 0s = true -Stdlib.Int16.greaterThanOrEqualTo_v0 6s 1s = true -Stdlib.Int16.greaterThanOrEqualTo_v0 6s 8s = false -Stdlib.Int16.greaterThanOrEqualTo_v0 -5s -20s = true -Stdlib.Int16.greaterThanOrEqualTo_v0 -20s -1s = false -Stdlib.Int16.greaterThanOrEqualTo_v0 -20s -20s = true -Stdlib.Int16.greaterThanOrEqualTo_v0 -130s -20s = false -Stdlib.Int16.lessThanOrEqualTo_v0 6s 8s = true -Stdlib.Int16.lessThanOrEqualTo_v0 10s 1s = false +Stdlib.Int16.greaterThanOrEqualTo 0s 1s == false +Stdlib.Int16.greaterThanOrEqualTo 1s 0s == true +Stdlib.Int16.greaterThanOrEqualTo 6s 1s == true +Stdlib.Int16.greaterThanOrEqualTo 6s 8s == false +Stdlib.Int16.greaterThanOrEqualTo -5s -20s == true +Stdlib.Int16.greaterThanOrEqualTo -20s -1s == false +Stdlib.Int16.greaterThanOrEqualTo -20s -20s == true +Stdlib.Int16.greaterThanOrEqualTo -130s -20s == false +Stdlib.Int16.lessThanOrEqualTo 6s 8s == true +Stdlib.Int16.lessThanOrEqualTo 10s 1s == false -Stdlib.Int16.lessThan_v0 6s 8s = true -Stdlib.Int16.lessThan_v0 10s 1s = false -Stdlib.Int16.lessThan_v0 0s 1s = true -Stdlib.Int16.lessThan_v0 1s 0s = false -Stdlib.Int16.lessThan_v0 -100s 22544s = true -Stdlib.Int16.lessThan_v0 -999s -9999s = false -Stdlib.Int16.lessThan_v0 -8888s -8888s = false +Stdlib.Int16.lessThan 6s 8s == true +Stdlib.Int16.lessThan 10s 1s == false +Stdlib.Int16.lessThan 0s 1s == true +Stdlib.Int16.lessThan 1s 0s == false +Stdlib.Int16.lessThan -100s 22544s == true +Stdlib.Int16.lessThan -999s -9999s == false +Stdlib.Int16.lessThan -8888s -8888s == false -Stdlib.Int16.lessThanOrEqualTo_v0 0s 1s = true -Stdlib.Int16.lessThanOrEqualTo_v0 1s 0s = false -Stdlib.Int16.lessThanOrEqualTo_v0 -100s 22544s = true -Stdlib.Int16.lessThanOrEqualTo_v0 -999s -9999s = false -Stdlib.Int16.lessThanOrEqualTo_v0 -8888s -8888s = true +Stdlib.Int16.lessThanOrEqualTo 0s 1s == true +Stdlib.Int16.lessThanOrEqualTo 1s 0s == false +Stdlib.Int16.lessThanOrEqualTo -100s 22544s == true +Stdlib.Int16.lessThanOrEqualTo -999s -9999s == false +Stdlib.Int16.lessThanOrEqualTo -8888s -8888s == true -Stdlib.Int16.toString 0s = "0" -Stdlib.Int16.toString 1s = "1" -Stdlib.Int16.toString -1s = "-1" -Stdlib.Int16.toString -32768s = "-32768" // Int16 lower limit -Stdlib.Int16.toString 32767s = "32767" // Int16 upper limit +Stdlib.Int16.toString 0s == "0" +Stdlib.Int16.toString 1s == "1" +Stdlib.Int16.toString -1s == "-1" +Stdlib.Int16.toString -32768s == "-32768" // Int16 lower limit +Stdlib.Int16.toString 32767s == "32767" // Int16 upper limit -Stdlib.Int16.toFloat_v0 2s = 2.0 -Stdlib.Int16.toFloat_v0 -10s = -10.0 +Stdlib.Int16.toFloat 2s == 2.0 +Stdlib.Int16.toFloat -10s == -10.0 -(Stdlib.List.range_v0 1L 5L) -|> Stdlib.List.map_v0 (fun x -> Stdlib.Int16.random 1s 2s) -|> Stdlib.List.map_v0 (fun x -> +(Stdlib.List.range 1L 5L) +|> Stdlib.List.map (fun x -> Stdlib.Int16.random 1s 2s) +|> Stdlib.List.map (fun x -> (Stdlib.Int16.greaterThanOrEqualTo x 1s) - && (Stdlib.Int16.lessThanOrEqualTo x 2s)) = [ true; true; true; true; true ] + && (Stdlib.Int16.lessThanOrEqualTo x 2s)) +== [ true; true; true; true; true ] -(Stdlib.List.range_v0 1L 5L) -|> Stdlib.List.map_v0 (fun x -> Stdlib.Int16.random 10s 20s) -|> Stdlib.List.map_v0 (fun x -> +(Stdlib.List.range 1L 5L) +|> Stdlib.List.map (fun x -> Stdlib.Int16.random 10s 20s) +|> Stdlib.List.map (fun x -> (Stdlib.Int16.greaterThanOrEqualTo x 10s) - && (Stdlib.Int16.lessThanOrEqualTo x 20s)) = [ true; true; true; true; true ] + && (Stdlib.Int16.lessThanOrEqualTo x 20s)) +== [ true; true; true; true; true ] -(Stdlib.List.range_v0 1L 5L) -|> Stdlib.List.map_v0 (fun x -> Stdlib.Int16.random 2s 1s) -|> Stdlib.List.map_v0 (fun x -> +(Stdlib.List.range 1L 5L) +|> Stdlib.List.map (fun x -> Stdlib.Int16.random 2s 1s) +|> Stdlib.List.map (fun x -> (Stdlib.Int16.greaterThanOrEqualTo x 1s) - && (Stdlib.Int16.lessThanOrEqualTo x 2s)) = [ true; true; true; true; true ] + && (Stdlib.Int16.lessThanOrEqualTo x 2s)) +== [ true; true; true; true; true ] -(Stdlib.List.range_v0 1L 5L) -|> Stdlib.List.map_v0 (fun x -> Stdlib.Int16.random 20s 10s) -|> Stdlib.List.map_v0 (fun x -> +(Stdlib.List.range 1L 5L) +|> Stdlib.List.map (fun x -> Stdlib.Int16.random 20s 10s) +|> Stdlib.List.map (fun x -> (Stdlib.Int16.greaterThanOrEqualTo x 10s) - && (Stdlib.Int16.lessThanOrEqualTo x 20s)) = [ true; true; true; true; true ] + && (Stdlib.Int16.lessThanOrEqualTo x 20s)) +== [ true; true; true; true; true ] -((Stdlib.List.range_v0 1L 100L) - |> Stdlib.List.map_v0 (fun x -> Stdlib.Int16.random 0s 1s) - |> Stdlib.List.unique_v0) = [ 0s; 1s ] +((Stdlib.List.range 1L 100L) + |> Stdlib.List.map (fun x -> Stdlib.Int16.random 0s 1s) + |> Stdlib.List.unique) +== [ 0s; 1s ] -((Stdlib.List.range_v0 1L 100L) - |> Stdlib.List.map_v0 (fun x -> Stdlib.Int16.random 0s 2s) - |> Stdlib.List.unique_v0) = [ 0s; 1s; 2s ] +((Stdlib.List.range 1L 100L) + |> Stdlib.List.map (fun x -> Stdlib.Int16.random 0s 2s) + |> Stdlib.List.unique) +== [ 0s; 1s; 2s ] -Stdlib.Int16.parse_v0 "0" = Stdlib.Result.Result.Ok 0s +Stdlib.Int16.parse "0" == Stdlib.Result.Result.Ok(0s) -Stdlib.Int16.parse_v0 "1" = Stdlib.Result.Result.Ok 1s +Stdlib.Int16.parse "1" == Stdlib.Result.Result.Ok(1s) -Stdlib.Int16.parse_v0 " 1" = Stdlib.Result.Result.Ok 1s +Stdlib.Int16.parse " 1" == Stdlib.Result.Result.Ok(1s) -Stdlib.Int16.parse_v0 "1 " = Stdlib.Result.Result.Ok 1s +Stdlib.Int16.parse "1 " == Stdlib.Result.Result.Ok(1s) -Stdlib.Int16.parse_v0 "+1" = Stdlib.Result.Result.Ok 1s +Stdlib.Int16.parse "+1" == Stdlib.Result.Result.Ok(1s) -Stdlib.Int16.parse_v0 " +1 " = Stdlib.Result.Result.Ok 1s +Stdlib.Int16.parse " +1 " == Stdlib.Result.Result.Ok(1s) -Stdlib.Int16.parse_v0 "-1" = Stdlib.Result.Result.Ok -1s +Stdlib.Int16.parse "-1" == Stdlib.Result.Result.Ok(-1s) -Stdlib.Int16.parse_v0 "078" = Stdlib.Result.Result.Ok 78s // "octal" format ignored +Stdlib.Int16.parse "078" == Stdlib.Result.Result.Ok(78s) // "octal" format ignored -Stdlib.Int16.parse_v0 "-00001" = Stdlib.Result.Result.Ok -1s +Stdlib.Int16.parse "-00001" == Stdlib.Result.Result.Ok(-1s) -Stdlib.Int16.parse_v0 "32767" = Stdlib.Result.Result.Ok 32767s +Stdlib.Int16.parse "32767" == Stdlib.Result.Result.Ok(32767s) -Stdlib.Int16.parse_v0 "-32768" = Stdlib.Result.Result.Ok -32768s +Stdlib.Int16.parse "-32768" == Stdlib.Result.Result.Ok(-32768s) -Stdlib.Int16.parse_v0 "32768" = Stdlib.Result.Result.Error - Stdlib.Int16.ParseError.OutOfRange +Stdlib.Int16.parse "32768" +== Stdlib.Result.Result.Error(Stdlib.Int16.ParseError.OutOfRange()) -Stdlib.Int16.parse_v0 "-32769" = Stdlib.Result.Result.Error - Stdlib.Int16.ParseError.OutOfRange +Stdlib.Int16.parse "-32769" +== Stdlib.Result.Result.Error(Stdlib.Int16.ParseError.OutOfRange()) -Stdlib.Int16.parse_v0 "1 2 3" = Stdlib.Result.Result.Error - Stdlib.Int16.ParseError.BadFormat +Stdlib.Int16.parse "1 2 3" +== Stdlib.Result.Result.Error(Stdlib.Int16.ParseError.BadFormat()) -Stdlib.Int16.parse_v0 "+ 1" = Stdlib.Result.Result.Error - Stdlib.Int16.ParseError.BadFormat +Stdlib.Int16.parse "+ 1" +== Stdlib.Result.Result.Error(Stdlib.Int16.ParseError.BadFormat()) -Stdlib.Int16.parse_v0 "- 1" = Stdlib.Result.Result.Error - Stdlib.Int16.ParseError.BadFormat +Stdlib.Int16.parse "- 1" +== Stdlib.Result.Result.Error(Stdlib.Int16.ParseError.BadFormat()) -Stdlib.Int16.parse_v0 "0xA" = Stdlib.Result.Result.Error - Stdlib.Int16.ParseError.BadFormat +Stdlib.Int16.parse "0xA" +== Stdlib.Result.Result.Error(Stdlib.Int16.ParseError.BadFormat()) -Stdlib.Int16.parse_v0 "0x123" = Stdlib.Result.Result.Error - Stdlib.Int16.ParseError.BadFormat +Stdlib.Int16.parse "0x123" +== Stdlib.Result.Result.Error(Stdlib.Int16.ParseError.BadFormat()) -Stdlib.Int16.parse_v0 "0b0100" = Stdlib.Result.Result.Error - Stdlib.Int16.ParseError.BadFormat +Stdlib.Int16.parse "0b0100" +== Stdlib.Result.Result.Error(Stdlib.Int16.ParseError.BadFormat()) -Stdlib.Int16.parse_v0 "pi" = Stdlib.Result.Result.Error - Stdlib.Int16.ParseError.BadFormat +Stdlib.Int16.parse "pi" +== Stdlib.Result.Result.Error(Stdlib.Int16.ParseError.BadFormat()) -Stdlib.Int16.parse_v0 "PACKAGE.Darklang.Stdlib.Math.pi" = Stdlib.Result.Result.Error - Stdlib.Int16.ParseError.BadFormat +Stdlib.Int16.parse "PACKAGE.Darklang.Stdlib.Math.pi" +== Stdlib.Result.Result.Error(Stdlib.Int16.ParseError.BadFormat()) -Stdlib.Int16.parse_v0 "1.23E+04" = Stdlib.Result.Result.Error - Stdlib.Int16.ParseError.BadFormat +Stdlib.Int16.parse "1.23E+04" +== Stdlib.Result.Result.Error(Stdlib.Int16.ParseError.BadFormat()) -Stdlib.Int16.parse_v0 "" = Stdlib.Result.Result.Error - Stdlib.Int16.ParseError.BadFormat +Stdlib.Int16.parse "" +== Stdlib.Result.Result.Error(Stdlib.Int16.ParseError.BadFormat()) -Stdlib.Int16.parse_v0 "1I" = Stdlib.Result.Result.Error - Stdlib.Int16.ParseError.BadFormat +Stdlib.Int16.parse "1I" +== Stdlib.Result.Result.Error(Stdlib.Int16.ParseError.BadFormat()) -Stdlib.Int16.parse_v0 "one" = Stdlib.Result.Result.Error - Stdlib.Int16.ParseError.BadFormat +Stdlib.Int16.parse "one" +== Stdlib.Result.Result.Error(Stdlib.Int16.ParseError.BadFormat()) -Stdlib.Int16.parse_v0 "XIV" = Stdlib.Result.Result.Error - Stdlib.Int16.ParseError.BadFormat +Stdlib.Int16.parse "XIV" +== Stdlib.Result.Result.Error(Stdlib.Int16.ParseError.BadFormat()) -Stdlib.Int16.fromInt8_v0 0y = 0s +Stdlib.Int16.fromInt8 0y == 0s -Stdlib.Int16.fromInt8_v0 1y = 1s +Stdlib.Int16.fromInt8 1y == 1s -Stdlib.Int16.fromInt8_v0 127y = 127s +Stdlib.Int16.fromInt8 127y == 127s -Stdlib.Int16.fromInt8_v0 (-1y) = -1s +Stdlib.Int16.fromInt8 (-1y) == -1s -Stdlib.Int16.fromInt8_v0 (-128y) = -128s +Stdlib.Int16.fromInt8 (-128y) == -128s -Stdlib.Int16.fromUInt8_v0 0uy = 0s +Stdlib.Int16.fromUInt8 0uy == 0s -Stdlib.Int16.fromUInt8_v0 1uy = 1s +Stdlib.Int16.fromUInt8 1uy == 1s -Stdlib.Int16.fromUInt8_v0 255uy = 255s +Stdlib.Int16.fromUInt8 255uy == 255s -Stdlib.Int16.fromUInt16_v0 0us = Stdlib.Option.Option.Some 0s +Stdlib.Int16.fromUInt16 0us == Stdlib.Option.Option.Some(0s) -Stdlib.Int16.fromUInt16_v0 1us = Stdlib.Option.Option.Some 1s +Stdlib.Int16.fromUInt16 1us == Stdlib.Option.Option.Some(1s) -Stdlib.Int16.fromUInt16_v0 32767us = Stdlib.Option.Option.Some 32767s +Stdlib.Int16.fromUInt16 32767us == Stdlib.Option.Option.Some(32767s) -Stdlib.Int16.fromInt32_v0 0l = Stdlib.Option.Option.Some 0s +Stdlib.Int16.fromInt32 0l == Stdlib.Option.Option.Some(0s) -Stdlib.Int16.fromInt32_v0 1l = Stdlib.Option.Option.Some 1s +Stdlib.Int16.fromInt32 1l == Stdlib.Option.Option.Some(1s) -Stdlib.Int16.fromInt32_v0 32767l = Stdlib.Option.Option.Some 32767s +Stdlib.Int16.fromInt32 32767l == Stdlib.Option.Option.Some(32767s) -Stdlib.Int16.fromInt32_v0 32768l = Stdlib.Option.Option.None +Stdlib.Int16.fromInt32 32768l == Stdlib.Option.Option.None() -Stdlib.Int16.fromInt32_v0 (-1l) = Stdlib.Option.Option.Some -1s +Stdlib.Int16.fromInt32 (-1l) == Stdlib.Option.Option.Some(-1s) -Stdlib.Int16.fromInt32_v0 (-32768l) = Stdlib.Option.Option.Some -32768s +Stdlib.Int16.fromInt32 (-32768l) == Stdlib.Option.Option.Some(-32768s) -Stdlib.Int16.fromInt32_v0 (-32769l) = Stdlib.Option.Option.None +Stdlib.Int16.fromInt32 (-32769l) == Stdlib.Option.Option.None() -Stdlib.Int16.fromUInt32_v0 0ul = Stdlib.Option.Option.Some 0s +Stdlib.Int16.fromUInt32 0ul == Stdlib.Option.Option.Some(0s) -Stdlib.Int16.fromUInt32_v0 1ul = Stdlib.Option.Option.Some 1s +Stdlib.Int16.fromUInt32 1ul == Stdlib.Option.Option.Some(1s) -Stdlib.Int16.fromUInt32_v0 32767ul = Stdlib.Option.Option.Some 32767s +Stdlib.Int16.fromUInt32 32767ul == Stdlib.Option.Option.Some(32767s) -Stdlib.Int16.fromUInt32_v0 32768ul = Stdlib.Option.Option.None -Stdlib.Int16.fromUInt32_v0 65535ul = Stdlib.Option.Option.None +Stdlib.Int16.fromUInt32 32768ul == Stdlib.Option.Option.None() +Stdlib.Int16.fromUInt32 65535ul == Stdlib.Option.Option.None() -Stdlib.Int16.fromInt64_v0 0L = Stdlib.Option.Option.Some 0s +Stdlib.Int16.fromInt64 0L == Stdlib.Option.Option.Some(0s) -Stdlib.Int16.fromInt64_v0 1L = Stdlib.Option.Option.Some 1s +Stdlib.Int16.fromInt64 1L == Stdlib.Option.Option.Some(1s) -Stdlib.Int16.fromInt64_v0 32767L = Stdlib.Option.Option.Some 32767s +Stdlib.Int16.fromInt64 32767L == Stdlib.Option.Option.Some(32767s) -Stdlib.Int16.fromInt64_v0 32768L = Stdlib.Option.Option.None +Stdlib.Int16.fromInt64 32768L == Stdlib.Option.Option.None() -Stdlib.Int16.fromInt64_v0 (-1L) = Stdlib.Option.Option.Some -1s +Stdlib.Int16.fromInt64 (-1L) == Stdlib.Option.Option.Some(-1s) -Stdlib.Int16.fromInt64_v0 (-32768L) = Stdlib.Option.Option.Some -32768s +Stdlib.Int16.fromInt64 (-32768L) == Stdlib.Option.Option.Some(-32768s) -Stdlib.Int16.fromInt64_v0 (-32769L) = Stdlib.Option.Option.None +Stdlib.Int16.fromInt64 (-32769L) == Stdlib.Option.Option.None() -Stdlib.Int16.fromUInt64_v0 0UL = Stdlib.Option.Option.Some 0s +Stdlib.Int16.fromUInt64 0UL == Stdlib.Option.Option.Some(0s) -Stdlib.Int16.fromUInt64_v0 1UL = Stdlib.Option.Option.Some 1s +Stdlib.Int16.fromUInt64 1UL == Stdlib.Option.Option.Some(1s) -Stdlib.Int16.fromUInt64_v0 32767UL = Stdlib.Option.Option.Some 32767s +Stdlib.Int16.fromUInt64 32767UL == Stdlib.Option.Option.Some(32767s) -Stdlib.Int16.fromUInt64_v0 32768UL = Stdlib.Option.Option.None +Stdlib.Int16.fromUInt64 32768UL == Stdlib.Option.Option.None() -Stdlib.Int16.fromInt128_v0 0Q = Stdlib.Option.Option.Some 0s +Stdlib.Int16.fromInt128 0Q == Stdlib.Option.Option.Some(0s) -Stdlib.Int16.fromInt128_v0 1Q = Stdlib.Option.Option.Some 1s +Stdlib.Int16.fromInt128 1Q == Stdlib.Option.Option.Some(1s) -Stdlib.Int16.fromInt128_v0 32767Q = Stdlib.Option.Option.Some 32767s +Stdlib.Int16.fromInt128 32767Q == Stdlib.Option.Option.Some(32767s) -Stdlib.Int16.fromInt128_v0 32768Q = Stdlib.Option.Option.None +Stdlib.Int16.fromInt128 32768Q == Stdlib.Option.Option.None() -Stdlib.Int16.fromInt128_v0 (-1Q) = Stdlib.Option.Option.Some -1s +Stdlib.Int16.fromInt128 (-1Q) == Stdlib.Option.Option.Some(-1s) -Stdlib.Int16.fromInt128_v0 (-32768Q) = Stdlib.Option.Option.Some -32768s +Stdlib.Int16.fromInt128 (-32768Q) == Stdlib.Option.Option.Some(-32768s) -Stdlib.Int16.fromInt128_v0 (-32769Q) = Stdlib.Option.Option.None +Stdlib.Int16.fromInt128 (-32769Q) == Stdlib.Option.Option.None() -Stdlib.Int16.fromUInt128_v0 0Z = Stdlib.Option.Option.Some 0s +Stdlib.Int16.fromUInt128 0Z == Stdlib.Option.Option.Some(0s) -Stdlib.Int16.fromUInt128_v0 1Z = Stdlib.Option.Option.Some 1s +Stdlib.Int16.fromUInt128 1Z == Stdlib.Option.Option.Some(1s) -Stdlib.Int16.fromUInt128_v0 32767Z = Stdlib.Option.Option.Some 32767s +Stdlib.Int16.fromUInt128 32767Z == Stdlib.Option.Option.Some(32767s) -Stdlib.Int16.fromUInt128_v0 32768Z = Stdlib.Option.Option.None \ No newline at end of file +Stdlib.Int16.fromUInt128 32768Z == Stdlib.Option.Option.None() \ No newline at end of file diff --git a/backend/testfiles/execution/stdlib/int32.dark b/backend/testfiles/execution/stdlib/int32.dark index b9b53eca29..ba4ad0139f 100644 --- a/backend/testfiles/execution/stdlib/int32.dark +++ b/backend/testfiles/execution/stdlib/int32.dark @@ -1,331 +1,330 @@ -Stdlib.Int32.absoluteValue_v0 -5l = 5l -Stdlib.Int32.absoluteValue_v0 5l = 5l +Stdlib.Int32.absoluteValue -5l == 5l +Stdlib.Int32.absoluteValue 5l == 5l -Stdlib.Int32.max_v0 5l 6l = 6l -Stdlib.Int32.max_v0 10l 1l = 10l -Stdlib.Int32.max_v0 -5l 6l = 6l -Stdlib.Int32.max_v0 -100l -20000l = -100l -Stdlib.Int32.max_v0 250l -26l = 250l +Stdlib.Int32.max 5l 6l == 6l +Stdlib.Int32.max 10l 1l == 10l +Stdlib.Int32.max -5l 6l == 6l +Stdlib.Int32.max -100l -20000l == -100l +Stdlib.Int32.max 250l -26l == 250l -Stdlib.Int32.min_v0 5l 6l = 5l -Stdlib.Int32.min_v0 50l -10l = -10l -Stdlib.Int32.min_v0 -5l 6l = -5l -Stdlib.Int32.min_v0 -100l -20000l = -20000l -Stdlib.Int32.min_v0 250l -26l = -26l +Stdlib.Int32.min 5l 6l == 5l +Stdlib.Int32.min 50l -10l == -10l +Stdlib.Int32.min -5l 6l == -5l +Stdlib.Int32.min -100l -20000l == -20000l +Stdlib.Int32.min 250l -26l == -26l -Stdlib.Int32.clamp_v0 -5l -2l 5l = -2l // in bounds -Stdlib.Int32.clamp_v0 -3l -2l 1l = -2l // below min -Stdlib.Int32.clamp_v0 -5l 1l 1l = 1l // at limit -Stdlib.Int32.clamp_v0 1l 2l 1l = 1l // above max -Stdlib.Int32.clamp_v0 3l 0l 2l = 2l // below in -Stdlib.Int32.clamp_v0 -100l 0l 0l = 0l -Stdlib.Int32.clamp_v0 100l 0l 0l = 0l -Stdlib.Int32.clamp_v0 -100l 0l -1l = -1l -Stdlib.Int32.clamp_v0 100l 0l -1l = 0l -Stdlib.Int32.clamp_v0 -100l -1l 0l = -1l -Stdlib.Int32.clamp_v0 100l -1l 0l = 0l -Stdlib.Int32.clamp_v0 -100l 1l 0l = 0l -Stdlib.Int32.clamp_v0 100l 1l 0l = 1l -Stdlib.Int32.clamp_v0 -2147483647l 250l -26l = -26l -Stdlib.Int32.clamp_v0 2147483647l 250l -26l = 250l - -Stdlib.Int32.negate_v0 -5l = 5l -Stdlib.Int32.negate_v0 5l = -5l -Stdlib.Int32.negate_v0 0l = 0l -Stdlib.Int32.negate_v0 -0l = 0l +Stdlib.Int32.clamp -5l -2l 5l == -2l // in bounds +Stdlib.Int32.clamp -3l -2l 1l == -2l // below min +Stdlib.Int32.clamp -5l 1l 1l == 1l // at limit +Stdlib.Int32.clamp 1l 2l 1l == 1l // above max +Stdlib.Int32.clamp 3l 0l 2l == 2l // below in +Stdlib.Int32.clamp -100l 0l 0l == 0l +Stdlib.Int32.clamp 100l 0l 0l == 0l +Stdlib.Int32.clamp -100l 0l -1l == -1l +Stdlib.Int32.clamp 100l 0l -1l == 0l +Stdlib.Int32.clamp -100l -1l 0l == -1l +Stdlib.Int32.clamp 100l -1l 0l == 0l +Stdlib.Int32.clamp -100l 1l 0l == 0l +Stdlib.Int32.clamp 100l 1l 0l == 1l +Stdlib.Int32.clamp -2147483647l 250l -26l == -26l +Stdlib.Int32.clamp 2147483647l 250l -26l == 250l + +Stdlib.Int32.negate -5l == 5l +Stdlib.Int32.negate 5l == -5l +Stdlib.Int32.negate 0l == 0l +Stdlib.Int32.negate -0l == 0l -Stdlib.Int32.remainder_v0 15l 6l = Stdlib.Result.Result.Ok 3l +Stdlib.Int32.remainder 15l 6l == Stdlib.Result.Result.Ok(3l) -Stdlib.Int32.remainder_v0 20l 8l = Stdlib.Result.Result.Ok 4l +Stdlib.Int32.remainder 20l 8l == Stdlib.Result.Result.Ok(4l) -Stdlib.Int32.remainder_v0 -20l 8l = Stdlib.Result.Result.Ok -4l +Stdlib.Int32.remainder -20l 8l == Stdlib.Result.Result.Ok(-4l) -Stdlib.Int32.remainder_v0 -20l -8l = Stdlib.Result.Result.Ok -4l +Stdlib.Int32.remainder -20l -8l == Stdlib.Result.Result.Ok(-4l) -Stdlib.Int32.remainder_v0 -15l 6l = Stdlib.Result.Result.Ok -3l +Stdlib.Int32.remainder -15l 6l == Stdlib.Result.Result.Ok(-3l) -Stdlib.Int32.remainder_v0 5l 0l = Builtin.testDerrorMessage "Division by zero" +Stdlib.Int32.remainder 5l 0l == Builtin.testDerrorMessage "Division by zero" -Stdlib.Int32.mod_v0 15l 5l = 0l -Stdlib.Int32.mod_v0 15l 6l = 3l -Stdlib.Int32.mod_v0 0l 15l = 0l -Stdlib.Int32.mod_v0 -1l 2l = 1l -Stdlib.Int32.mod_v0 -754l 53l = 41l -Stdlib.Int32.mod_v0 222222222l 3l = 0l +Stdlib.Int32.mod 15l 5l == 0l +Stdlib.Int32.mod 15l 6l == 3l +Stdlib.Int32.mod 0l 15l == 0l +Stdlib.Int32.mod -1l 2l == 1l +Stdlib.Int32.mod -754l 53l == 41l +Stdlib.Int32.mod 222222222l 3l == 0l -Stdlib.Int32.mod_v0 5l 0l = Builtin.testDerrorMessage "Zero modulus" +Stdlib.Int32.mod 5l 0l == Builtin.testDerrorMessage "Zero modulus" -Stdlib.Int32.mod_v0 5l -5l = Builtin.testDerrorMessage "Negative modulus" +Stdlib.Int32.mod 5l -5l == Builtin.testDerrorMessage "Negative modulus" -Stdlib.Int32.power_v0 2l 3l = 8l -Stdlib.Int32.power_v0 0l 1l = 0l -Stdlib.Int32.power_v0 1l 0l = 1l -Stdlib.Int32.power_v0 0l 0l = 1l -Stdlib.Int32.power_v0 -2l 5l = -32l -Stdlib.Int32.power_v0 -1l 5l = -1l -Stdlib.Int32.power_v0 -1l 6l = 1l -Stdlib.Int32.power_v0 1l 2147483647l = 1l +Stdlib.Int32.power 2l 3l == 8l +Stdlib.Int32.power 0l 1l == 0l +Stdlib.Int32.power 1l 0l == 1l +Stdlib.Int32.power 0l 0l == 1l +Stdlib.Int32.power -2l 5l == -32l +Stdlib.Int32.power -1l 5l == -1l +Stdlib.Int32.power -1l 6l == 1l +Stdlib.Int32.power 1l 2147483647l == 1l -Stdlib.Int32.power_v0 2l 31l = Builtin.testDerrorMessage "Out of range" +Stdlib.Int32.power 2l 31l == Builtin.testDerrorMessage "Out of range" -Stdlib.Int32.power_v0 120l 20l = Builtin.testDerrorMessage "Out of range" +Stdlib.Int32.power 120l 20l == Builtin.testDerrorMessage "Out of range" -Stdlib.Int32.power_v0 2l -3l = Builtin.testDerrorMessage "Negative exponent" +Stdlib.Int32.power 2l -3l == Builtin.testDerrorMessage "Negative exponent" -Stdlib.Int32.greaterThan_v0 20l 1l = true +Stdlib.Int32.greaterThan 20l 1l == true -Stdlib.Int32.greaterThanOrEqualTo_v0 0l 1l = false -Stdlib.Int32.greaterThanOrEqualTo_v0 1l 0l = true -Stdlib.Int32.greaterThanOrEqualTo_v0 6l 1l = true -Stdlib.Int32.greaterThanOrEqualTo_v0 6l 8l = false -Stdlib.Int32.greaterThanOrEqualTo_v0 -5l -20l = true -Stdlib.Int32.greaterThanOrEqualTo_v0 -20l -1l = false -Stdlib.Int32.greaterThanOrEqualTo_v0 -20l -20l = true +Stdlib.Int32.greaterThanOrEqualTo 0l 1l == false +Stdlib.Int32.greaterThanOrEqualTo 1l 0l == true +Stdlib.Int32.greaterThanOrEqualTo 6l 1l == true +Stdlib.Int32.greaterThanOrEqualTo 6l 8l == false +Stdlib.Int32.greaterThanOrEqualTo -5l -20l == true +Stdlib.Int32.greaterThanOrEqualTo -20l -1l == false +Stdlib.Int32.greaterThanOrEqualTo -20l -20l == true -Stdlib.Int32.lessThanOrEqualTo_v0 6l 8l = true -Stdlib.Int32.lessThanOrEqualTo_v0 10l 1l = false -Stdlib.Int32.lessThanOrEqualTo_v0 0l 1l = true -Stdlib.Int32.lessThanOrEqualTo_v0 1l 0l = false -Stdlib.Int32.lessThanOrEqualTo_v0 -100l 22544l = true -Stdlib.Int32.lessThanOrEqualTo_v0 -999l -9999l = false -Stdlib.Int32.lessThanOrEqualTo_v0 -8888l -8888l = true +Stdlib.Int32.lessThanOrEqualTo 6l 8l == true +Stdlib.Int32.lessThanOrEqualTo 10l 1l == false +Stdlib.Int32.lessThanOrEqualTo 0l 1l == true +Stdlib.Int32.lessThanOrEqualTo 1l 0l == false +Stdlib.Int32.lessThanOrEqualTo -100l 22544l == true +Stdlib.Int32.lessThanOrEqualTo -999l -9999l == false +Stdlib.Int32.lessThanOrEqualTo -8888l -8888l == true -Stdlib.Int32.lessThan_v0 6l 8l = true -Stdlib.Int32.lessThan_v0 10l 1l = false -Stdlib.Int32.lessThan_v0 0l 1l = true -Stdlib.Int32.lessThan_v0 1l 0l = false -Stdlib.Int32.lessThan_v0 -100l 22544l = true -Stdlib.Int32.lessThan_v0 -999l -9999l = false -Stdlib.Int32.lessThan_v0 -8888l -8888l = false - -Stdlib.Int32.sqrt_v0 4l = 2.0 -Stdlib.Int32.sqrt_v0 100l = 10.0 -Stdlib.Int32.sqrt_v0 86l = 9.273618495495704 +Stdlib.Int32.lessThan 6l 8l == true +Stdlib.Int32.lessThan 10l 1l == false +Stdlib.Int32.lessThan 0l 1l == true +Stdlib.Int32.lessThan 1l 0l == false +Stdlib.Int32.lessThan -100l 22544l == true +Stdlib.Int32.lessThan -999l -9999l == false +Stdlib.Int32.lessThan -8888l -8888l == false + +Stdlib.Int32.sqrt 4l == 2.0 +Stdlib.Int32.sqrt 100l == 10.0 +Stdlib.Int32.sqrt 86l == 9.273618495495704 -Stdlib.Int32.toFloat_v0 2l = 2.0 -Stdlib.Int32.toFloat_v0 955656l = 955656.0 -Stdlib.Int32.toFloat_v0 -10l = -10.0 +Stdlib.Int32.toFloat 2l == 2.0 +Stdlib.Int32.toFloat 955656l == 955656.0 +Stdlib.Int32.toFloat -10l == -10.0 -Stdlib.Int32.add_v0 10l 9l = 19l -Stdlib.Int32.add_v0 88l 9l = 97l -Stdlib.Int32.add_v0 -1l 2l = 1l -Stdlib.Int32.add_v0 1l 0l = 1l -Stdlib.Int32.add_v0 -55l 55l = 0l -Stdlib.Int32.add_v0 2147483646l 1l = 2147483647l +Stdlib.Int32.add 10l 9l == 19l +Stdlib.Int32.add 88l 9l == 97l +Stdlib.Int32.add -1l 2l == 1l +Stdlib.Int32.add 1l 0l == 1l +Stdlib.Int32.add -55l 55l == 0l +Stdlib.Int32.add 2147483646l 1l == 2147483647l // Overflow tests -Stdlib.Int32.add_v0 2147483647l 1l = -2147483648l -Stdlib.Int32.add_v0 55l 2147483647l = -2147483594l -Stdlib.Int32.add_v0 -2147483648l -1l = 2147483647l +Stdlib.Int32.add 2147483647l 1l == -2147483648l +Stdlib.Int32.add 55l 2147483647l == -2147483594l +Stdlib.Int32.add -2147483648l -1l == 2147483647l -Stdlib.Int32.subtract_v0 10l 9l = 1l -Stdlib.Int32.subtract_v0 88l 9l = 79l -Stdlib.Int32.subtract_v0 0l 1l = -1l -Stdlib.Int32.subtract_v0 1l 0l = 1l -Stdlib.Int32.subtract_v0 -55l -55l = 0l +Stdlib.Int32.subtract 10l 9l == 1l +Stdlib.Int32.subtract 88l 9l == 79l +Stdlib.Int32.subtract 0l 1l == -1l +Stdlib.Int32.subtract 1l 0l == 1l +Stdlib.Int32.subtract -55l -55l == 0l -Stdlib.Int32.multiply_v0 8l 8l = 64l -Stdlib.Int32.multiply_v0 5145l 5145l = 26471025l +Stdlib.Int32.multiply 8l 8l == 64l +Stdlib.Int32.multiply 5145l 5145l == 26471025l -Stdlib.Int32.divide_v0 10l 5l = 2l -Stdlib.Int32.divide_v0 17l 3l = 5l -Stdlib.Int32.divide_v0 -8l 5l = -1l -Stdlib.Int32.divide_v0 0l 1l = 0l +Stdlib.Int32.divide 10l 5l == 2l +Stdlib.Int32.divide 17l 3l == 5l +Stdlib.Int32.divide -8l 5l == -1l +Stdlib.Int32.divide 0l 1l == 0l -Stdlib.Int32.divide_v0 1l 0l = Builtin.testDerrorMessage "Division by zero" +Stdlib.Int32.divide 1l 0l == Builtin.testDerrorMessage "Division by zero" -(Stdlib.List.range_v0 1L 5L) -|> Stdlib.List.map_v0 (fun x -> Stdlib.Int32.random 1l 2l) -|> Stdlib.List.map_v0 (fun x -> +(Stdlib.List.range 1L 5L) +|> Stdlib.List.map (fun x -> Stdlib.Int32.random 1l 2l) +|> Stdlib.List.map (fun x -> (Stdlib.Int32.greaterThanOrEqualTo x 1l) - && (Stdlib.Int32.lessThanOrEqualTo x 2l)) = [ true; true; true; true; true ] + && (Stdlib.Int32.lessThanOrEqualTo x 2l)) == [ true; true; true; true; true ] -(Stdlib.List.range_v0 1L 5L) -|> Stdlib.List.map_v0 (fun x -> Stdlib.Int32.random 10l 20l) -|> Stdlib.List.map_v0 (fun x -> +(Stdlib.List.range 1L 5L) +|> Stdlib.List.map (fun x -> Stdlib.Int32.random 10l 20l) +|> Stdlib.List.map (fun x -> (Stdlib.Int32.greaterThanOrEqualTo x 10l) - && (Stdlib.Int32.lessThanOrEqualTo x 20l)) = [ true; true; true; true; true ] + && (Stdlib.Int32.lessThanOrEqualTo x 20l)) == [ true; true; true; true; true ] -(Stdlib.List.range_v0 1L 5L) -|> Stdlib.List.map_v0 (fun x -> Stdlib.Int32.random 2l 1l) -|> Stdlib.List.map_v0 (fun x -> +(Stdlib.List.range 1L 5L) +|> Stdlib.List.map (fun x -> Stdlib.Int32.random 2l 1l) +|> Stdlib.List.map (fun x -> (Stdlib.Int32.greaterThanOrEqualTo x 1l) - && (Stdlib.Int32.lessThanOrEqualTo x 2l)) = [ true; true; true; true; true ] + && (Stdlib.Int32.lessThanOrEqualTo x 2l)) == [ true; true; true; true; true ] -(Stdlib.List.range_v0 1L 5L) -|> Stdlib.List.map_v0 (fun x -> Stdlib.Int32.random 20l 10l) -|> Stdlib.List.map_v0 (fun x -> +(Stdlib.List.range 1L 5L) +|> Stdlib.List.map (fun x -> Stdlib.Int32.random 20l 10l) +|> Stdlib.List.map (fun x -> (Stdlib.Int32.greaterThanOrEqualTo x 10l) - && (Stdlib.Int32.lessThanOrEqualTo x 20l)) = [ true; true; true; true; true ] + && (Stdlib.Int32.lessThanOrEqualTo x 20l)) == [ true; true; true; true; true ] -((Stdlib.List.range_v0 1L 100L) - |> Stdlib.List.map_v0 (fun x -> Stdlib.Int32.random 0l 1l) - |> Stdlib.List.unique_v0) = [ 0l; 1l ] +((Stdlib.List.range 1L 100L) + |> Stdlib.List.map (fun x -> Stdlib.Int32.random 0l 1l) + |> Stdlib.List.unique) == [ 0l; 1l ] -((Stdlib.List.range_v0 1L 100L) - |> Stdlib.List.map_v0 (fun x -> Stdlib.Int32.random 0l 2l) - |> Stdlib.List.unique_v0) = [ 0l; 1l; 2l ] +((Stdlib.List.range 1L 100L) + |> Stdlib.List.map (fun x -> Stdlib.Int32.random 0l 2l) + |> Stdlib.List.unique) == [ 0l; 1l; 2l ] -Stdlib.Int32.sum_v0 [ 1l; 2l ] = 3l +Stdlib.Int32.sum [ 1l; 2l ] == 3l -Stdlib.Int32.parse_v0 "0" = Stdlib.Result.Result.Ok 0l +Stdlib.Int32.parse "0" == Stdlib.Result.Result.Ok(0l) -Stdlib.Int32.parse_v0 "1" = Stdlib.Result.Result.Ok 1l +Stdlib.Int32.parse "1" == Stdlib.Result.Result.Ok(1l) -Stdlib.Int32.parse_v0 " 1" = Stdlib.Result.Result.Ok 1l +Stdlib.Int32.parse " 1" == Stdlib.Result.Result.Ok(1l) -Stdlib.Int32.parse_v0 "1 " = Stdlib.Result.Result.Ok 1l +Stdlib.Int32.parse "1 " == Stdlib.Result.Result.Ok(1l) -Stdlib.Int32.parse_v0 "+1" = Stdlib.Result.Result.Ok 1l +Stdlib.Int32.parse "+1" == Stdlib.Result.Result.Ok(1l) -Stdlib.Int32.parse_v0 " +1 " = Stdlib.Result.Result.Ok 1l +Stdlib.Int32.parse " +1 " == Stdlib.Result.Result.Ok(1l) -Stdlib.Int32.parse_v0 "-1" = Stdlib.Result.Result.Ok -1l +Stdlib.Int32.parse "-1" == Stdlib.Result.Result.Ok(-1l) -Stdlib.Int32.parse_v0 "078" = Stdlib.Result.Result.Ok 78l // "octal" format ignored +Stdlib.Int32.parse "078" == Stdlib.Result.Result.Ok(78l) // "octal" format ignored -Stdlib.Int32.parse_v0 "-00001" = Stdlib.Result.Result.Ok -1l +Stdlib.Int32.parse "-00001" == Stdlib.Result.Result.Ok(-1l) -Stdlib.Int32.parse_v0 "-10001" = Stdlib.Result.Result.Ok -10001l +Stdlib.Int32.parse "-10001" == Stdlib.Result.Result.Ok(-10001l) -Stdlib.Int32.parse_v0 "-2147483648" = Stdlib.Result.Result.Ok -2147483648l +Stdlib.Int32.parse "-2147483648" == Stdlib.Result.Result.Ok(-2147483648l) -Stdlib.Int32.parse_v0 "2147483647" = Stdlib.Result.Result.Ok 2147483647l +Stdlib.Int32.parse "2147483647" == Stdlib.Result.Result.Ok(2147483647l) -Stdlib.Int32.parse_v0 "2147483648" = Stdlib.Result.Result.Error - Stdlib.Int32.ParseError.OutOfRange +Stdlib.Int32.parse "2147483648" == Stdlib.Result.Result.Error(Stdlib.Int32.ParseError.OutOfRange()) -Stdlib.Int32.parse_v0 "-2147483649" = Stdlib.Result.Result.Error - Stdlib.Int32.ParseError.OutOfRange +Stdlib.Int32.parse "-2147483649" == Stdlib.Result.Result.Error( + Stdlib.Int32.ParseError.OutOfRange()) -Stdlib.Int32.parse_v0 "1 2 3" = Stdlib.Result.Result.Error - Stdlib.Int32.ParseError.BadFormat +Stdlib.Int32.parse "1 2 3" == Stdlib.Result.Result.Error( + Stdlib.Int32.ParseError.BadFormat()) -Stdlib.Int32.parse_v0 "+ 1" = Stdlib.Result.Result.Error - Stdlib.Int32.ParseError.BadFormat +Stdlib.Int32.parse "+ 1" == Stdlib.Result.Result.Error( + Stdlib.Int32.ParseError.BadFormat()) -Stdlib.Int32.parse_v0 "- 1" = Stdlib.Result.Result.Error - Stdlib.Int32.ParseError.BadFormat +Stdlib.Int32.parse "- 1" == Stdlib.Result.Result.Error( + Stdlib.Int32.ParseError.BadFormat()) -Stdlib.Int32.parse_v0 "0xA" = Stdlib.Result.Result.Error - Stdlib.Int32.ParseError.BadFormat +Stdlib.Int32.parse "0xA" == Stdlib.Result.Result.Error( + Stdlib.Int32.ParseError.BadFormat()) -Stdlib.Int32.parse_v0 "0x123" = Stdlib.Result.Result.Error - Stdlib.Int32.ParseError.BadFormat +Stdlib.Int32.parse "0x123" == Stdlib.Result.Result.Error( + Stdlib.Int32.ParseError.BadFormat()) -Stdlib.Int32.parse_v0 "0b0100" = Stdlib.Result.Result.Error - Stdlib.Int32.ParseError.BadFormat +Stdlib.Int32.parse "0b0100" == Stdlib.Result.Result.Error( + Stdlib.Int32.ParseError.BadFormat()) -Stdlib.Int32.parse_v0 "pi" = Stdlib.Result.Result.Error - Stdlib.Int32.ParseError.BadFormat +Stdlib.Int32.parse "pi" == Stdlib.Result.Result.Error( + Stdlib.Int32.ParseError.BadFormat()) -Stdlib.Int32.parse_v0 "PACKAGE.Darklang.Stdlib.Math.pi" = Stdlib.Result.Result.Error - Stdlib.Int32.ParseError.BadFormat +Stdlib.Int32.parse "PACKAGE.Darklang.Stdlib.Math.pi" == Stdlib.Result.Result.Error( + Stdlib.Int32.ParseError.BadFormat()) -Stdlib.Int32.parse_v0 "1.23E+04" = Stdlib.Result.Result.Error - Stdlib.Int32.ParseError.BadFormat +Stdlib.Int32.parse "1.23E+04" == Stdlib.Result.Result.Error( + Stdlib.Int32.ParseError.BadFormat()) -Stdlib.Int32.parse_v0 "" = Stdlib.Result.Result.Error - Stdlib.Int32.ParseError.BadFormat +Stdlib.Int32.parse "" == Stdlib.Result.Result.Error( + Stdlib.Int32.ParseError.BadFormat()) -Stdlib.Int32.parse_v0 "1I" = Stdlib.Result.Result.Error - Stdlib.Int32.ParseError.BadFormat +Stdlib.Int32.parse "1I" == Stdlib.Result.Result.Error( + Stdlib.Int32.ParseError.BadFormat()) -Stdlib.Int32.parse_v0 "one" = Stdlib.Result.Result.Error - Stdlib.Int32.ParseError.BadFormat +Stdlib.Int32.parse "one" == Stdlib.Result.Result.Error( + Stdlib.Int32.ParseError.BadFormat()) -Stdlib.Int32.parse_v0 "XIV" = Stdlib.Result.Result.Error - Stdlib.Int32.ParseError.BadFormat +Stdlib.Int32.parse "XIV" == Stdlib.Result.Result.Error( + Stdlib.Int32.ParseError.BadFormat()) -Stdlib.Int32.toString 0l = "0" -Stdlib.Int32.toString 1l = "1" -Stdlib.Int32.toString -1l = "-1" -Stdlib.Int32.toString -2147483648l = "-2147483648" // Int32 lower limit -Stdlib.Int32.toString 2147483647l = "2147483647" // Int32 upper limit +Stdlib.Int32.toString 0l == "0" +Stdlib.Int32.toString 1l == "1" +Stdlib.Int32.toString -1l == "-1" +Stdlib.Int32.toString -2147483648l == "-2147483648" // Int32 lower limit +Stdlib.Int32.toString 2147483647l == "2147483647" // Int32 upper limit -Stdlib.Int32.fromInt8_v0 0y = 0l +Stdlib.Int32.fromInt8 0y == 0l -Stdlib.Int32.fromInt8_v0 1y = 1l +Stdlib.Int32.fromInt8 1y == 1l -Stdlib.Int32.fromInt8_v0 127y = 127l +Stdlib.Int32.fromInt8 127y == 127l -Stdlib.Int32.fromInt8_v0 (-128y) = -128l +Stdlib.Int32.fromInt8 (-128y) == -128l -Stdlib.Int32.fromUInt8_v0 0uy = 0l +Stdlib.Int32.fromUInt8 0uy == 0l -Stdlib.Int32.fromUInt8_v0 1uy = 1l +Stdlib.Int32.fromUInt8 1uy == 1l -Stdlib.Int32.fromUInt8_v0 255uy = 255l +Stdlib.Int32.fromUInt8 255uy == 255l -Stdlib.Int32.fromInt16_v0 0s = 0l +Stdlib.Int32.fromInt16 0s == 0l -Stdlib.Int32.fromInt16_v0 1s = 1l +Stdlib.Int32.fromInt16 1s == 1l -Stdlib.Int32.fromInt16_v0 32767s = 32767l +Stdlib.Int32.fromInt16 32767s == 32767l -Stdlib.Int32.fromInt16_v0 (-32768s) = -32768l +Stdlib.Int32.fromInt16 (-32768s) == -32768l -Stdlib.Int32.fromUInt16_v0 0us = 0l +Stdlib.Int32.fromUInt16 0us == 0l -Stdlib.Int32.fromUInt16_v0 1us = 1l +Stdlib.Int32.fromUInt16 1us == 1l -Stdlib.Int32.fromUInt16_v0 65535us = 65535l +Stdlib.Int32.fromUInt16 65535us == 65535l -Stdlib.Int32.fromUInt32_v0 0ul = Stdlib.Option.Option.Some 0l +Stdlib.Int32.fromUInt32 0ul == Stdlib.Option.Option.Some(0l) -Stdlib.Int32.fromUInt32_v0 1ul = Stdlib.Option.Option.Some 1l +Stdlib.Int32.fromUInt32 1ul == Stdlib.Option.Option.Some(1l) -Stdlib.Int32.fromUInt32_v0 4294967295ul = Stdlib.Option.Option.None +Stdlib.Int32.fromUInt32 4294967295ul == Stdlib.Option.Option.None() -Stdlib.Int32.fromInt64_v0 0L = Stdlib.Option.Option.Some 0l +Stdlib.Int32.fromInt64 0L == Stdlib.Option.Option.Some(0l) -Stdlib.Int32.fromInt64_v0 1L = Stdlib.Option.Option.Some 1l +Stdlib.Int32.fromInt64 1L == Stdlib.Option.Option.Some(1l) -Stdlib.Int32.fromInt64_v0 2147483647L = Stdlib.Option.Option.Some 2147483647l +Stdlib.Int32.fromInt64 2147483647L == Stdlib.Option.Option.Some(2147483647l) -Stdlib.Int32.fromInt64_v0 2147483648L = Stdlib.Option.Option.None +Stdlib.Int32.fromInt64 2147483648L == Stdlib.Option.Option.None() -Stdlib.Int32.fromInt64_v0 (-1L) = Stdlib.Option.Option.Some -1l +Stdlib.Int32.fromInt64 (-1L) == Stdlib.Option.Option.Some(-1l) -Stdlib.Int32.fromInt64_v0 (-2147483648L) = Stdlib.Option.Option.Some -2147483648l +Stdlib.Int32.fromInt64 (-2147483648L) == Stdlib.Option.Option.Some(-2147483648l) -Stdlib.Int32.fromInt64_v0 (-2147483649L) = Stdlib.Option.Option.None +Stdlib.Int32.fromInt64 (-2147483649L) == Stdlib.Option.Option.None() -Stdlib.Int32.fromUInt64_v0 0UL = Stdlib.Option.Option.Some 0l +Stdlib.Int32.fromUInt64 0UL == Stdlib.Option.Option.Some(0l) -Stdlib.Int32.fromUInt64_v0 1UL = Stdlib.Option.Option.Some 1l +Stdlib.Int32.fromUInt64 1UL == Stdlib.Option.Option.Some(1l) -Stdlib.Int32.fromUInt64_v0 2147483647UL = Stdlib.Option.Option.Some 2147483647l +Stdlib.Int32.fromUInt64 2147483647UL == Stdlib.Option.Option.Some(2147483647l) -Stdlib.Int32.fromUInt64_v0 2147483648UL = Stdlib.Option.Option.None +Stdlib.Int32.fromUInt64 2147483648UL == Stdlib.Option.Option.None() -Stdlib.Int32.fromInt128_v0 0Q = Stdlib.Option.Option.Some 0l +Stdlib.Int32.fromInt128 0Q == Stdlib.Option.Option.Some(0l) -Stdlib.Int32.fromInt128_v0 1Q = Stdlib.Option.Option.Some 1l +Stdlib.Int32.fromInt128 1Q == Stdlib.Option.Option.Some(1l) -Stdlib.Int32.fromInt128_v0 2147483647Q = Stdlib.Option.Option.Some 2147483647l +Stdlib.Int32.fromInt128 2147483647Q == Stdlib.Option.Option.Some(2147483647l) -Stdlib.Int32.fromInt128_v0 2147483648Q = Stdlib.Option.Option.None +Stdlib.Int32.fromInt128 2147483648Q == Stdlib.Option.Option.None() -Stdlib.Int32.fromInt128_v0 (-1Q) = Stdlib.Option.Option.Some -1l +Stdlib.Int32.fromInt128 (-1Q) == Stdlib.Option.Option.Some(-1l) -Stdlib.Int32.fromInt128_v0 (-2147483648Q) = Stdlib.Option.Option.Some -2147483648l +Stdlib.Int32.fromInt128 (-2147483648Q) == Stdlib.Option.Option.Some(-2147483648l) -Stdlib.Int32.fromInt128_v0 (-2147483649Q) = Stdlib.Option.Option.None +Stdlib.Int32.fromInt128 (-2147483649Q) == Stdlib.Option.Option.None() -Stdlib.Int32.fromUInt128_v0 0Z = Stdlib.Option.Option.Some 0l +Stdlib.Int32.fromUInt128 0Z == Stdlib.Option.Option.Some(0l) -Stdlib.Int32.fromUInt128_v0 1Z = Stdlib.Option.Option.Some 1l +Stdlib.Int32.fromUInt128 1Z == Stdlib.Option.Option.Some(1l) -Stdlib.Int32.fromUInt128_v0 2147483647Z = Stdlib.Option.Option.Some 2147483647l +Stdlib.Int32.fromUInt128 2147483647Z == Stdlib.Option.Option.Some(2147483647l) -Stdlib.Int32.fromUInt128_v0 2147483648Z = Stdlib.Option.Option.None \ No newline at end of file +Stdlib.Int32.fromUInt128 2147483648Z == Stdlib.Option.Option.None() \ No newline at end of file diff --git a/backend/testfiles/execution/stdlib/int64.dark b/backend/testfiles/execution/stdlib/int64.dark index 82b400438e..ef9ae2991f 100644 --- a/backend/testfiles/execution/stdlib/int64.dark +++ b/backend/testfiles/execution/stdlib/int64.dark @@ -1,436 +1,432 @@ -Stdlib.Int64.absoluteValue_v0 -5L = 5L -Stdlib.Int64.absoluteValue_v0 5L = 5L - -Stdlib.Int64.max_v0 5L 6L = 6L -Stdlib.Int64.max_v0 10L 1L = 10L -Stdlib.Int64.max_v0 -5L 6L = 6L -Stdlib.Int64.max_v0 -100L -20000L = -100L -Stdlib.Int64.max_v0 250L -26L = 250L - -Stdlib.Int64.min_v0 5L 6L = 5L -Stdlib.Int64.min_v0 50L -10L = -10L -Stdlib.Int64.min_v0 -5L 6L = -5L -Stdlib.Int64.min_v0 -100L -20000L = -20000L -Stdlib.Int64.min_v0 250L -26L = -26L - - -Stdlib.Int64.clamp_v0 -5L -2L 5L = -2L // in bounds -Stdlib.Int64.clamp_v0 -3L -2L 1L = -2L // below min -Stdlib.Int64.clamp_v0 -5L 1L 1L = 1L // at limit -Stdlib.Int64.clamp_v0 1L 2L 1L = 1L // above max -Stdlib.Int64.clamp_v0 3L 0L 2L = 2L // below in -Stdlib.Int64.clamp_v0 -100L 0L 0L = 0L -Stdlib.Int64.clamp_v0 100L 0L 0L = 0L -Stdlib.Int64.clamp_v0 -100L 0L -1L = -1L -Stdlib.Int64.clamp_v0 100L 0L -1L = 0L -Stdlib.Int64.clamp_v0 -100L -1L 0L = -1L -Stdlib.Int64.clamp_v0 100L -1L 0L = 0L -Stdlib.Int64.clamp_v0 -100L 1L 0L = 0L -Stdlib.Int64.clamp_v0 100L 1L 0L = 1L -Stdlib.Int64.clamp_v0 -2147483647L 250L -26L = -26L -Stdlib.Int64.clamp_v0 2147483647L 250L -26L = 250L - -Stdlib.Int64.negate_v0 -5L = 5L -Stdlib.Int64.negate_v0 5L = -5L -Stdlib.Int64.negate_v0 0L = 0L -Stdlib.Int64.negate_v0 -0L = 0L - -Stdlib.Int64.remainder_v0 15L 6L = Stdlib.Result.Result.Ok 3L - -Stdlib.Int64.remainder_v0 20L 8L = Stdlib.Result.Result.Ok 4L - -Stdlib.Int64.remainder_v0 -20L 8L = Stdlib.Result.Result.Ok -4L - -Stdlib.Int64.remainder_v0 -20L -8L = Stdlib.Result.Result.Ok -4L - -Stdlib.Int64.remainder_v0 -15L 6L = Stdlib.Result.Result.Ok -3L - -Stdlib.Int64.remainder_v0 5L 0L = Builtin.testDerrorMessage "Division by zero" - -Stdlib.List.map_v0 (Stdlib.List.range_v0 -5L 5L) (fun v -> - Stdlib.Int64.remainder_v0 v -4L) = [ Stdlib.Result.Result.Ok -1L - Stdlib.Result.Result.Ok 0L - Stdlib.Result.Result.Ok -3L - Stdlib.Result.Result.Ok -2L - Stdlib.Result.Result.Ok -1L - Stdlib.Result.Result.Ok 0L - Stdlib.Result.Result.Ok 1L - Stdlib.Result.Result.Ok 2L - Stdlib.Result.Result.Ok 3L - Stdlib.Result.Result.Ok 0L - Stdlib.Result.Result.Ok 1L ] - -Stdlib.List.map_v0 (Stdlib.List.range_v0 -5L 5L) (fun v -> - Stdlib.Int64.remainder_v0 v 4L) = [ Stdlib.Result.Result.Ok -1L - Stdlib.Result.Result.Ok 0L - Stdlib.Result.Result.Ok -3L - Stdlib.Result.Result.Ok -2L - Stdlib.Result.Result.Ok -1L - Stdlib.Result.Result.Ok 0L - Stdlib.Result.Result.Ok 1L - Stdlib.Result.Result.Ok 2L - Stdlib.Result.Result.Ok 3L - Stdlib.Result.Result.Ok 0L - Stdlib.Result.Result.Ok 1L ] - -Stdlib.Int64.mod_v0 15L 5L = 0L -Stdlib.Int64.mod_v0 15L 6L = 3L -Stdlib.Int64.mod_v0 0L 15L = 0L -Stdlib.Int64.mod_v0 -1L 2L = 1L -Stdlib.Int64.mod_v0 -754L 53L = 41L -Stdlib.Int64.mod_v0 9999999999998L 3L = 2L - -Stdlib.Int64.mod_v0 5L 0L = Builtin.testDerrorMessage "Zero modulus" - -Stdlib.Int64.mod_v0 5L -5L = Builtin.testDerrorMessage "Negative modulus" - -// Stdlib.List.map_v0 (Stdlib.List.range_v0 -5L 5L) (fun v -> -// Stdlib.Int64.mod_v0 v 4L) = [ 3L 0L 1L 2L 3L 0L 1L 2L 3L 0L 1L ] - -15L % 5L = 0L -5L % 0L = Builtin.testDerrorMessage "Zero modulus" -5L % -5L = Builtin.testDerrorMessage "Negative modulus" - -Stdlib.List.map_v0 (Stdlib.List.range_v0 -5L 5L) (fun v -> v % 4L) = [ 3L - 0L - 1L - 2L - 3L - 0L - 1L - 2L - 3L - 0L - 1L ] - -Stdlib.Int64.power_v0 8L 5L = 32768L -Stdlib.Int64.power_v0 0L 1L = 0L -Stdlib.Int64.power_v0 0L 0L = 1L -Stdlib.Int64.power_v0 1L 0L = 1L -Stdlib.Int64.power_v0 1000L 0L = 1L -Stdlib.Int64.power_v0 -8L 5L = -32768L - -Stdlib.Int64.power_v0 200L 20L = Builtin.testDerrorMessage "Out of range" - -Stdlib.Int64.power_v0 200L 7L = 12800000000000000L - -Stdlib.Int64.power_v0 1L 2147483649L = 1L - -Stdlib.Int64.power_v0 -1L 2147483649L = -1L - -Stdlib.Int64.power_v0 2L -3L = Builtin.testDerrorMessage "Negative exponent" - -5L ^ 2L = 25L --8L ^ 5L = -32768L -50L ^ 2L = 2500L - -Stdlib.Int64.greaterThan_v0 20L 1L = true -20L > 1L = true - -0L >= 1L = false -1L >= 0L = true -6L >= 1L = true -6L >= 8L = false --5L >= -20L = true --20L >= -1L = false --20L >= -20L = true - -Stdlib.Int64.greaterThanOrEqualTo_v0 0L 1L = false -Stdlib.Int64.greaterThanOrEqualTo_v0 1L 0L = true -Stdlib.Int64.greaterThanOrEqualTo_v0 6L 1L = true -Stdlib.Int64.greaterThanOrEqualTo_v0 6L 8L = false -Stdlib.Int64.greaterThanOrEqualTo_v0 -5L -20L = true -Stdlib.Int64.greaterThanOrEqualTo_v0 -20L -1L = false -Stdlib.Int64.greaterThanOrEqualTo_v0 -20L -20L = true - -6L <= 8L = true -10L <= 1L = false -0L <= 1L = true -1L <= 0L = false --100L <= 22544L = true --999L <= -9999L = false --8888L <= -8888L = true - -Stdlib.Int64.lessThanOrEqualTo_v0 6L 8L = true -Stdlib.Int64.lessThanOrEqualTo_v0 10L 1L = false -Stdlib.Int64.lessThanOrEqualTo_v0 0L 1L = true -Stdlib.Int64.lessThanOrEqualTo_v0 1L 0L = false -Stdlib.Int64.lessThanOrEqualTo_v0 -100L 22544L = true -Stdlib.Int64.lessThanOrEqualTo_v0 -999L -9999L = false -Stdlib.Int64.lessThanOrEqualTo_v0 -8888L -8888L = true - -Stdlib.Int64.lessThan_v0 6L 8L = true -Stdlib.Int64.lessThan_v0 10L 1L = false -Stdlib.Int64.lessThan_v0 0L 1L = true -Stdlib.Int64.lessThan_v0 1L 0L = false -Stdlib.Int64.lessThan_v0 -100L 22544L = true -Stdlib.Int64.lessThan_v0 -999L -9999L = false -Stdlib.Int64.lessThan_v0 -8888L -8888L = false -6L < 8L = true -10L < 1L = false -0L < 1L = true -1L < 0L = false --100L < 22544L = true --999L < -9999L = false --8888L < -8888L = false - -Stdlib.Int64.sqrt_v0 4L = 2.0 -Stdlib.Int64.sqrt_v0 100L = 10.0 -Stdlib.Int64.sqrt_v0 86L = 9.273618495495704 - -Stdlib.Int64.toFloat_v0 2L = 2.0 -Stdlib.Int64.toFloat_v0 955656L = 955656.0 -Stdlib.Int64.toFloat_v0 -10L = -10.0 - -Stdlib.Int64.add_v0 10L 9L = 19L -Stdlib.Int64.add_v0 88L 9L = 97L -Stdlib.Int64.add_v0 -1L 2L = 1L -Stdlib.Int64.add_v0 1L 0L = 1L -Stdlib.Int64.add_v0 -55L 55L = 0L -Stdlib.Int64.add_v0 9223372036854775806L 1L = 9223372036854775807L +Stdlib.Int64.absoluteValue -5L == 5L +Stdlib.Int64.absoluteValue 5L == 5L + +Stdlib.Int64.max 5L 6L == 6L +Stdlib.Int64.max 10L 1L == 10L +Stdlib.Int64.max -5L 6L == 6L +Stdlib.Int64.max -100L -20000L == -100L +Stdlib.Int64.max 250L -26L == 250L + +Stdlib.Int64.min 5L 6L == 5L +Stdlib.Int64.min 50L -10L == -10L +Stdlib.Int64.min -5L 6L == -5L +Stdlib.Int64.min -100L -20000L == -20000L +Stdlib.Int64.min 250L -26L == -26L + + +Stdlib.Int64.clamp -5L -2L 5L == -2L // in bounds +Stdlib.Int64.clamp -3L -2L 1L == -2L // below min +Stdlib.Int64.clamp -5L 1L 1L == 1L // at limit +Stdlib.Int64.clamp 1L 2L 1L == 1L // above max +Stdlib.Int64.clamp 3L 0L 2L == 2L // below in +Stdlib.Int64.clamp -100L 0L 0L == 0L +Stdlib.Int64.clamp 100L 0L 0L == 0L +Stdlib.Int64.clamp -100L 0L -1L == -1L +Stdlib.Int64.clamp 100L 0L -1L == 0L +Stdlib.Int64.clamp -100L -1L 0L == -1L +Stdlib.Int64.clamp 100L -1L 0L == 0L +Stdlib.Int64.clamp -100L 1L 0L == 0L +Stdlib.Int64.clamp 100L 1L 0L == 1L +Stdlib.Int64.clamp -2147483647L 250L -26L == -26L +Stdlib.Int64.clamp 2147483647L 250L -26L == 250L + +Stdlib.Int64.negate -5L == 5L +Stdlib.Int64.negate 5L == -5L +Stdlib.Int64.negate 0L == 0L +Stdlib.Int64.negate -0L == 0L + +Stdlib.Int64.remainder 15L 6L == Stdlib.Result.Result.Ok(3L) + +Stdlib.Int64.remainder 20L 8L == Stdlib.Result.Result.Ok(4L) + +Stdlib.Int64.remainder -20L 8L == Stdlib.Result.Result.Ok(-4L) + +Stdlib.Int64.remainder -20L -8L == Stdlib.Result.Result.Ok(-4L) + +Stdlib.Int64.remainder -15L 6L == Stdlib.Result.Result.Ok(-3L) + +Stdlib.Int64.remainder 5L 0L == Builtin.testDerrorMessage "Division by zero" + +Stdlib.List.map (Stdlib.List.range -5L 5L) (fun v -> + Stdlib.Int64.remainder v -4L) == [ Stdlib.Result.Result.Ok(-1L) + Stdlib.Result.Result.Ok(0L) + Stdlib.Result.Result.Ok(-3L) + Stdlib.Result.Result.Ok(-2L) + Stdlib.Result.Result.Ok(-1L) + Stdlib.Result.Result.Ok(0L) + Stdlib.Result.Result.Ok(1L) + Stdlib.Result.Result.Ok(2L) + Stdlib.Result.Result.Ok(3L) + Stdlib.Result.Result.Ok(0L) + Stdlib.Result.Result.Ok(1L) ] + +Stdlib.List.map (Stdlib.List.range -5L 5L) (fun v -> + Stdlib.Int64.remainder v 4L) == [ Stdlib.Result.Result.Ok(-1L) + Stdlib.Result.Result.Ok(0L) + Stdlib.Result.Result.Ok(-3L) + Stdlib.Result.Result.Ok(-2L) + Stdlib.Result.Result.Ok(-1L) + Stdlib.Result.Result.Ok(0L) + Stdlib.Result.Result.Ok(1L) + Stdlib.Result.Result.Ok(2L) + Stdlib.Result.Result.Ok(3L) + Stdlib.Result.Result.Ok(0L) + Stdlib.Result.Result.Ok(1L) ] + +Stdlib.Int64.mod 15L 5L == 0L +Stdlib.Int64.mod 15L 6L == 3L +Stdlib.Int64.mod 0L 15L == 0L +Stdlib.Int64.mod -1L 2L == 1L +Stdlib.Int64.mod -754L 53L == 41L +Stdlib.Int64.mod 9999999999998L 3L == 2L + +Stdlib.Int64.mod 5L 0L == Builtin.testDerrorMessage "Zero modulus" + +Stdlib.Int64.mod 5L -5L == Builtin.testDerrorMessage "Negative modulus" + +// Stdlib.List.map (Stdlib.List.range -5L 5L) (fun v -> +// Stdlib.Int64.mod v 4L) == [ 3L 0L 1L 2L 3L 0L 1L 2L 3L 0L 1L ] + +15L % 5L == 0L +5L % 0L == Builtin.testDerrorMessage "Zero modulus" +5L % -5L == Builtin.testDerrorMessage "Negative modulus" + +Stdlib.List.map (Stdlib.List.range -5L 5L) (fun v -> v % 4L) == [ 3L + 0L + 1L + 2L + 3L + 0L + 1L + 2L + 3L + 0L + 1L ] + +Stdlib.Int64.power 8L 5L == 32768L +Stdlib.Int64.power 0L 1L == 0L +Stdlib.Int64.power 0L 0L == 1L +Stdlib.Int64.power 1L 0L == 1L +Stdlib.Int64.power 1000L 0L == 1L +Stdlib.Int64.power -8L 5L == -32768L + +Stdlib.Int64.power 200L 20L == Builtin.testDerrorMessage "Out of range" + +Stdlib.Int64.power 200L 7L == 12800000000000000L + +Stdlib.Int64.power 1L 2147483649L == 1L + +Stdlib.Int64.power -1L 2147483649L == -1L + +Stdlib.Int64.power 2L -3L == Builtin.testDerrorMessage "Negative exponent" + +5L ^ 2L == 25L +-8L ^ 5L == -32768L +50L ^ 2L == 2500L + +Stdlib.Int64.greaterThan 20L 1L == true +20L > 1L == true + +0L >= 1L == false +1L >= 0L == true +6L >= 1L == true +6L >= 8L == false +-5L >= -20L == true +-20L >= -1L == false +-20L >= -20L == true + +Stdlib.Int64.greaterThanOrEqualTo 0L 1L == false +Stdlib.Int64.greaterThanOrEqualTo 1L 0L == true +Stdlib.Int64.greaterThanOrEqualTo 6L 1L == true +Stdlib.Int64.greaterThanOrEqualTo 6L 8L == false +Stdlib.Int64.greaterThanOrEqualTo -5L -20L == true +Stdlib.Int64.greaterThanOrEqualTo -20L -1L == false +Stdlib.Int64.greaterThanOrEqualTo -20L -20L == true + +6L <= 8L == true +10L <= 1L == false +0L <= 1L == true +1L <= 0L == false +-100L <= 22544L == true +-999L <= -9999L == false +-8888L <= -8888L == true + +Stdlib.Int64.lessThanOrEqualTo 6L 8L == true +Stdlib.Int64.lessThanOrEqualTo 10L 1L == false +Stdlib.Int64.lessThanOrEqualTo 0L 1L == true +Stdlib.Int64.lessThanOrEqualTo 1L 0L == false +Stdlib.Int64.lessThanOrEqualTo -100L 22544L == true +Stdlib.Int64.lessThanOrEqualTo -999L -9999L == false +Stdlib.Int64.lessThanOrEqualTo -8888L -8888L == true + +Stdlib.Int64.lessThan 6L 8L == true +Stdlib.Int64.lessThan 10L 1L == false +Stdlib.Int64.lessThan 0L 1L == true +Stdlib.Int64.lessThan 1L 0L == false +Stdlib.Int64.lessThan -100L 22544L == true +Stdlib.Int64.lessThan -999L -9999L == false +Stdlib.Int64.lessThan -8888L -8888L == false +6L < 8L == true +10L < 1L == false +0L < 1L == true +1L < 0L == false +-100L < 22544L == true +-999L < -9999L == false +-8888L < -8888L == false + +Stdlib.Int64.sqrt 4L == 2.0 +Stdlib.Int64.sqrt 100L == 10.0 +Stdlib.Int64.sqrt 86L == 9.273618495495704 + +Stdlib.Int64.toFloat 2L == 2.0 +Stdlib.Int64.toFloat 955656L == 955656.0 +Stdlib.Int64.toFloat -10L == -10.0 + +Stdlib.Int64.add 10L 9L == 19L +Stdlib.Int64.add 88L 9L == 97L +Stdlib.Int64.add -1L 2L == 1L +Stdlib.Int64.add 1L 0L == 1L +Stdlib.Int64.add -55L 55L == 0L +Stdlib.Int64.add 9223372036854775806L 1L == 9223372036854775807L // Overflow tests -Stdlib.Int64.add_v0 9223372036854775807L 1L = -9223372036854775808L -Stdlib.Int64.add_v0 55L 9223372036854775807L = -9223372036854775754L -Stdlib.Int64.add_v0 (-9223372036854775808L) (-1L) = 9223372036854775807L +Stdlib.Int64.add 9223372036854775807L 1L == -9223372036854775808L +Stdlib.Int64.add 55L 9223372036854775807L == -9223372036854775754L +Stdlib.Int64.add (-9223372036854775808L) (-1L) == 9223372036854775807L --2000L + 1950L = -50L --1993L + 2000L = 7L +-2000L + 1950L == -50L +-1993L + 2000L == 7L -Stdlib.Int64.subtract_v0 10L 9L = 1L -Stdlib.Int64.subtract_v0 88L 9L = 79L -Stdlib.Int64.subtract_v0 0L 1L = -1L -Stdlib.Int64.subtract_v0 1L 0L = 1L -Stdlib.Int64.subtract_v0 -55L -55L = 0L +Stdlib.Int64.subtract 10L 9L == 1L +Stdlib.Int64.subtract 88L 9L == 79L +Stdlib.Int64.subtract 0L 1L == -1L +Stdlib.Int64.subtract 1L 0L == 1L +Stdlib.Int64.subtract -55L -55L == 0L -2000L - 1950L = 50L --1993L - -2000L = 7L +2000L - 1950L == 50L +-1993L - -2000L == 7L -Stdlib.Int64.multiply_v0 8L 8L = 64L -Stdlib.Int64.multiply_v0 5145L 5145L = 26471025L +Stdlib.Int64.multiply 8L 8L == 64L +Stdlib.Int64.multiply 5145L 5145L == 26471025L -1L * 1.0 = Builtin.testDerrorMessage +1L * 1.0 == Builtin.testDerrorMessage "int64Multiply's 2nd argument (`b`) should be an Int64. However, a Float (1.0) was passed instead. Expected: (b: Int64) Actual: a Float: 1.0" -8L * 8L = 64L -Stdlib.Int64.divide_v0 10L 5L = 2L -Stdlib.Int64.divide_v0 17L 3L = 5L -Stdlib.Int64.divide_v0 -8L 5L = -1L -Stdlib.Int64.divide_v0 0L 1L = 0L - -Stdlib.Int64.divide_v0 1L 0L = Builtin.testDerrorMessage "Division by zero" - -(Stdlib.List.range_v0 1L 5L) -|> Stdlib.List.map_v0 (fun x -> Stdlib.Int64.random 1L 2L) -|> Stdlib.List.map_v0 (fun x -> (x >= 1L) && (x <= 2L)) = [ true +8L * 8L == 64L +Stdlib.Int64.divide 10L 5L == 2L +Stdlib.Int64.divide 17L 3L == 5L +Stdlib.Int64.divide -8L 5L == -1L +Stdlib.Int64.divide 0L 1L == 0L + +Stdlib.Int64.divide 1L 0L == Builtin.testDerrorMessage "Division by zero" + +(Stdlib.List.range 1L 5L) +|> Stdlib.List.map (fun x -> Stdlib.Int64.random 1L 2L) +|> Stdlib.List.map (fun x -> (x >= 1L) && (x <= 2L)) == [ true + true + true + true + true ] + +(Stdlib.List.range 1L 5L) +|> Stdlib.List.map (fun x -> Stdlib.Int64.random 10L 20L) +|> Stdlib.List.map (fun x -> (x >= 10L) && (x <= 20L)) == [ true true true true true ] -(Stdlib.List.range_v0 1L 5L) -|> Stdlib.List.map_v0 (fun x -> Stdlib.Int64.random 10L 20L) -|> Stdlib.List.map_v0 (fun x -> (x >= 10L) && (x <= 20L)) = [ true - true - true - true - true ] - -(Stdlib.List.range_v0 1L 5L) -|> Stdlib.List.map_v0 (fun x -> Stdlib.Int64.random 2L 1L) -|> Stdlib.List.map_v0 (fun x -> (x >= 1L) && (x <= 2L)) = [ true +(Stdlib.List.range 1L 5L) +|> Stdlib.List.map (fun x -> Stdlib.Int64.random 2L 1L) +|> Stdlib.List.map (fun x -> (x >= 1L) && (x <= 2L)) == [ true + true + true + true + true ] + +(Stdlib.List.range 1L 5L) +|> Stdlib.List.map (fun x -> Stdlib.Int64.random 20L 10L) +|> Stdlib.List.map (fun x -> (x >= 10L) && (x <= 20L)) == [ true true true true true ] -(Stdlib.List.range_v0 1L 5L) -|> Stdlib.List.map_v0 (fun x -> Stdlib.Int64.random 20L 10L) -|> Stdlib.List.map_v0 (fun x -> (x >= 10L) && (x <= 20L)) = [ true - true - true - true - true ] - -((Stdlib.List.range_v0 1L 100L) - |> Stdlib.List.map_v0 (fun x -> Stdlib.Int64.random 0L 1L) - |> Stdlib.List.unique_v0) = [ 0L; 1L ] +((Stdlib.List.range 1L 100L) + |> Stdlib.List.map (fun x -> Stdlib.Int64.random 0L 1L) + |> Stdlib.List.unique) == [ 0L; 1L ] -((Stdlib.List.range_v0 1L 100L) - |> Stdlib.List.map_v0 (fun x -> Stdlib.Int64.random 0L 2L) - |> Stdlib.List.unique_v0) = [ 0L; 1L; 2L ] +((Stdlib.List.range 1L 100L) + |> Stdlib.List.map (fun x -> Stdlib.Int64.random 0L 2L) + |> Stdlib.List.unique) == [ 0L; 1L; 2L ] -Stdlib.Int64.sum_v0 [ 1L; 2L ] = 3L +Stdlib.Int64.sum [ 1L; 2L ] == 3L -Stdlib.Int64.parse_v0 "0" = Stdlib.Result.Result.Ok 0L +Stdlib.Int64.parse "0" == Stdlib.Result.Result.Ok(0L) -Stdlib.Int64.parse_v0 "1" = Stdlib.Result.Result.Ok 1L +Stdlib.Int64.parse "1" == Stdlib.Result.Result.Ok(1L) -Stdlib.Int64.parse_v0 " 1" = Stdlib.Result.Result.Ok 1L +Stdlib.Int64.parse " 1" == Stdlib.Result.Result.Ok(1L) -Stdlib.Int64.parse_v0 "1 " = Stdlib.Result.Result.Ok 1L +Stdlib.Int64.parse "1 " == Stdlib.Result.Result.Ok(1L) -Stdlib.Int64.parse_v0 "+1" = Stdlib.Result.Result.Ok 1L +Stdlib.Int64.parse "+1" == Stdlib.Result.Result.Ok(1L) -Stdlib.Int64.parse_v0 " +1 " = Stdlib.Result.Result.Ok 1L +Stdlib.Int64.parse " +1 " == Stdlib.Result.Result.Ok(1L) -Stdlib.Int64.parse_v0 "-1" = Stdlib.Result.Result.Ok -1L +Stdlib.Int64.parse "-1" == Stdlib.Result.Result.Ok(-1L) -Stdlib.Int64.parse_v0 "078" = Stdlib.Result.Result.Ok 78L // "octal" format ignored +Stdlib.Int64.parse "078" == Stdlib.Result.Result.Ok(78L) // "octal" format ignored -Stdlib.Int64.parse_v0 "-00001" = Stdlib.Result.Result.Ok -1L +Stdlib.Int64.parse "-00001" == Stdlib.Result.Result.Ok(-1L) -Stdlib.Int64.parse_v0 "-10001" = Stdlib.Result.Result.Ok -10001L +Stdlib.Int64.parse "-10001" == Stdlib.Result.Result.Ok(-10001L) -Stdlib.Int64.parse_v0 "-4611686018427387904" = Stdlib.Result.Result.Ok - -4611686018427387904L // int63 lower limit +Stdlib.Int64.parse "-4611686018427387904" == Stdlib.Result.Result.Ok( + -4611686018427387904L) // int63 lower limit -Stdlib.Int64.parse_v0 "-4611686018427387905" = Stdlib.Result.Result.Ok - -4611686018427387905L // past the int63 upper limit +Stdlib.Int64.parse "-4611686018427387905" == Stdlib.Result.Result.Ok( + -4611686018427387905L) // past the int63 upper limit -Stdlib.Int64.parse_v0 "-9223372036854775808" = Stdlib.Result.Result.Ok - -9223372036854775808L // .NET lower limit +Stdlib.Int64.parse "-9223372036854775808" == Stdlib.Result.Result.Ok( + -9223372036854775808L) // .NET lower limit -Stdlib.Int64.parse_v0 "-9223372036854775809" = Stdlib.Result.Result.Error - Stdlib.Int64.ParseError.OutOfRange +Stdlib.Int64.parse "-9223372036854775809" == Stdlib.Result.Result.Error( + Stdlib.Int64.ParseError.OutOfRange()) -Stdlib.Int64.parse_v0 "4611686018427387903" = Stdlib.Result.Result.Ok - 4611686018427387903L // int63 upper limit +Stdlib.Int64.parse "4611686018427387903" == Stdlib.Result.Result.Ok( + 4611686018427387903L) // int63 upper limit -Stdlib.Int64.parse_v0 "4611686018427387904" = Stdlib.Result.Result.Ok - 4611686018427387904L // past the int63 upper limit +Stdlib.Int64.parse "4611686018427387904" == Stdlib.Result.Result.Ok( + 4611686018427387904L) // past the int63 upper limit -Stdlib.Int64.parse_v0 "9223372036854775807" = Stdlib.Result.Result.Ok - 9223372036854775807L // .NET upper limit +Stdlib.Int64.parse "9223372036854775807" == Stdlib.Result.Result.Ok( + 9223372036854775807L) // .NET upper limit -Stdlib.Int64.parse_v0 "9223372036854775808" = Stdlib.Result.Result.Error - Stdlib.Int64.ParseError.OutOfRange +Stdlib.Int64.parse "9223372036854775808" == Stdlib.Result.Result.Error( + Stdlib.Int64.ParseError.OutOfRange()) -Stdlib.Int64.parse_v0 "1 2 3" = Stdlib.Result.Result.Error - Stdlib.Int64.ParseError.BadFormat +Stdlib.Int64.parse "1 2 3" == Stdlib.Result.Result.Error( + Stdlib.Int64.ParseError.BadFormat()) -Stdlib.Int64.parse_v0 "+ 1" = Stdlib.Result.Result.Error - Stdlib.Int64.ParseError.BadFormat +Stdlib.Int64.parse "+ 1" == Stdlib.Result.Result.Error( + Stdlib.Int64.ParseError.BadFormat()) -Stdlib.Int64.parse_v0 "- 1" = Stdlib.Result.Result.Error - Stdlib.Int64.ParseError.BadFormat +Stdlib.Int64.parse "- 1" == Stdlib.Result.Result.Error( + Stdlib.Int64.ParseError.BadFormat()) -Stdlib.Int64.parse_v0 "0xA" = Stdlib.Result.Result.Error - Stdlib.Int64.ParseError.BadFormat +Stdlib.Int64.parse "0xA" == Stdlib.Result.Result.Error( + Stdlib.Int64.ParseError.BadFormat()) -Stdlib.Int64.parse_v0 "0x123" = Stdlib.Result.Result.Error - Stdlib.Int64.ParseError.BadFormat +Stdlib.Int64.parse "0x123" == Stdlib.Result.Result.Error( + Stdlib.Int64.ParseError.BadFormat()) -Stdlib.Int64.parse_v0 "0b0100" = Stdlib.Result.Result.Error - Stdlib.Int64.ParseError.BadFormat +Stdlib.Int64.parse "0b0100" == Stdlib.Result.Result.Error( + Stdlib.Int64.ParseError.BadFormat()) -Stdlib.Int64.parse_v0 "pi" = Stdlib.Result.Result.Error - Stdlib.Int64.ParseError.BadFormat +Stdlib.Int64.parse "pi" == Stdlib.Result.Result.Error( + Stdlib.Int64.ParseError.BadFormat()) -Stdlib.Int64.parse_v0 "PACKAGE.Darklang.Stdlib.Math.pi" = Stdlib.Result.Result.Error - Stdlib.Int64.ParseError.BadFormat +Stdlib.Int64.parse "PACKAGE.Darklang.Stdlib.Math.pi" == Stdlib.Result.Result.Error( + Stdlib.Int64.ParseError.BadFormat()) -Stdlib.Int64.parse_v0 "1.23E+04" = Stdlib.Result.Result.Error - Stdlib.Int64.ParseError.BadFormat +Stdlib.Int64.parse "1.23E+04" == Stdlib.Result.Result.Error( + Stdlib.Int64.ParseError.BadFormat()) -Stdlib.Int64.parse_v0 "9223372036854775808" = Stdlib.Result.Result.Error - Stdlib.Int64.ParseError.OutOfRange +Stdlib.Int64.parse "9223372036854775808" == Stdlib.Result.Result.Error( + Stdlib.Int64.ParseError.OutOfRange()) -Stdlib.Int64.parse_v0 "" = Stdlib.Result.Result.Error - Stdlib.Int64.ParseError.BadFormat +Stdlib.Int64.parse "" == Stdlib.Result.Result.Error( + Stdlib.Int64.ParseError.BadFormat()) -Stdlib.Int64.parse_v0 "1I" = Stdlib.Result.Result.Error - Stdlib.Int64.ParseError.BadFormat +Stdlib.Int64.parse "1I" == Stdlib.Result.Result.Error( + Stdlib.Int64.ParseError.BadFormat()) -Stdlib.Int64.parse_v0 "one" = Stdlib.Result.Result.Error - Stdlib.Int64.ParseError.BadFormat +Stdlib.Int64.parse "one" == Stdlib.Result.Result.Error( + Stdlib.Int64.ParseError.BadFormat()) -Stdlib.Int64.parse_v0 "XIV" = Stdlib.Result.Result.Error - Stdlib.Int64.ParseError.BadFormat +Stdlib.Int64.parse "XIV" == Stdlib.Result.Result.Error( + Stdlib.Int64.ParseError.BadFormat()) -Stdlib.Int64.toString 0L = "0" -Stdlib.Int64.toString 1L = "1" -Stdlib.Int64.toString -1L = "-1" -Stdlib.Int64.toString -4611686018427387904L = "-4611686018427387904" // int63 lower limit -Stdlib.Int64.toString -4611686018427387905L = "-4611686018427387905" // past the int63 upper limit" -Stdlib.Int64.toString -9223372036854775808L = "-9223372036854775808" // .NET lower limit -Stdlib.Int64.toString 4611686018427387903L = "4611686018427387903" // int63 upper limit -Stdlib.Int64.toString 4611686018427387904L = "4611686018427387904" // past the int63 upper limit -Stdlib.Int64.toString 9223372036854775807L = "9223372036854775807" // .NET upper limit +Stdlib.Int64.toString 0L == "0" +Stdlib.Int64.toString 1L == "1" +Stdlib.Int64.toString -1L == "-1" +Stdlib.Int64.toString -4611686018427387904L == "-4611686018427387904" // int63 lower limit +Stdlib.Int64.toString -4611686018427387905L == "-4611686018427387905" // past the int63 upper limit" +Stdlib.Int64.toString -9223372036854775808L == "-9223372036854775808" // .NET lower limit +Stdlib.Int64.toString 4611686018427387903L == "4611686018427387903" // int63 upper limit +Stdlib.Int64.toString 4611686018427387904L == "4611686018427387904" // past the int63 upper limit +Stdlib.Int64.toString 9223372036854775807L == "9223372036854775807" // .NET upper limit -Stdlib.Int64.fromInt8_v0 0y = 0L +Stdlib.Int64.fromInt8 0y == 0L -Stdlib.Int64.fromInt8_v0 1y = 1L +Stdlib.Int64.fromInt8 1y == 1L -Stdlib.Int64.fromInt8_v0 127y = 127L +Stdlib.Int64.fromInt8 127y == 127L -Stdlib.Int64.fromInt8_v0 -128y = -128L +Stdlib.Int64.fromInt8 -128y == -128L -Stdlib.Int64.fromUInt8_v0 0uy = 0L +Stdlib.Int64.fromUInt8 0uy == 0L -Stdlib.Int64.fromUInt8_v0 1uy = 1L +Stdlib.Int64.fromUInt8 1uy == 1L -Stdlib.Int64.fromUInt8_v0 255uy = 255L +Stdlib.Int64.fromUInt8 255uy == 255L -Stdlib.Int64.fromInt16_v0 0s = 0L +Stdlib.Int64.fromInt16 0s == 0L -Stdlib.Int64.fromInt16_v0 1s = 1L +Stdlib.Int64.fromInt16 1s == 1L -Stdlib.Int64.fromInt16_v0 32767s = 32767L +Stdlib.Int64.fromInt16 32767s == 32767L -Stdlib.Int64.fromInt16_v0 -32768s = -32768L +Stdlib.Int64.fromInt16 -32768s == -32768L -Stdlib.Int64.fromUInt16_v0 0us = 0L +Stdlib.Int64.fromUInt16 0us == 0L -Stdlib.Int64.fromUInt16_v0 1us = 1L +Stdlib.Int64.fromUInt16 1us == 1L -Stdlib.Int64.fromUInt16_v0 65535us = 65535L +Stdlib.Int64.fromUInt16 65535us == 65535L -Stdlib.Int64.fromInt32_v0 0l = 0L +Stdlib.Int64.fromInt32 0l == 0L -Stdlib.Int64.fromInt32_v0 1l = 1L +Stdlib.Int64.fromInt32 1l == 1L -Stdlib.Int64.fromInt32_v0 2147483647l = 2147483647L +Stdlib.Int64.fromInt32 2147483647l == 2147483647L -Stdlib.Int64.fromInt32_v0 -2147483648l = -2147483648L +Stdlib.Int64.fromInt32 -2147483648l == -2147483648L -Stdlib.Int64.fromUInt32_v0 0ul = 0L +Stdlib.Int64.fromUInt32 0ul == 0L -Stdlib.Int64.fromUInt32_v0 1ul = 1L +Stdlib.Int64.fromUInt32 1ul == 1L -Stdlib.Int64.fromUInt32_v0 4294967295ul = 4294967295L +Stdlib.Int64.fromUInt32 4294967295ul == 4294967295L -Stdlib.Int64.fromUInt64_v0 0UL = Stdlib.Option.Option.Some 0L +Stdlib.Int64.fromUInt64 0UL == Stdlib.Option.Option.Some(0L) -Stdlib.Int64.fromUInt64_v0 1UL = Stdlib.Option.Option.Some 1L +Stdlib.Int64.fromUInt64 1UL == Stdlib.Option.Option.Some(1L) -Stdlib.Int64.fromUInt64_v0 9223372036854775807UL = Stdlib.Option.Option.Some - 9223372036854775807L +Stdlib.Int64.fromUInt64 9223372036854775807UL == Stdlib.Option.Option.Some(9223372036854775807L) -Stdlib.Int64.fromUInt64_v0 18446744073709551615UL = Stdlib.Option.Option.None +Stdlib.Int64.fromUInt64 18446744073709551615UL == Stdlib.Option.Option.None() -Stdlib.Int64.fromInt128_v0 0Q = Stdlib.Option.Option.Some 0L +Stdlib.Int64.fromInt128 0Q == Stdlib.Option.Option.Some(0L) -Stdlib.Int64.fromInt128_v0 1Q = Stdlib.Option.Option.Some 1L +Stdlib.Int64.fromInt128 1Q == Stdlib.Option.Option.Some(1L) -Stdlib.Int64.fromInt128_v0 9223372036854775807Q = Stdlib.Option.Option.Some - 9223372036854775807L +Stdlib.Int64.fromInt128 9223372036854775807Q == Stdlib.Option.Option.Some(9223372036854775807L) -Stdlib.Int64.fromInt128_v0 -9223372036854775808Q = Stdlib.Option.Option.Some - -9223372036854775808L +Stdlib.Int64.fromInt128 -9223372036854775808Q == Stdlib.Option.Option.Some(-9223372036854775808L) -Stdlib.Int64.fromInt128_v0 9223372036854775808Q = Stdlib.Option.Option.None -Stdlib.Int64.fromInt128_v0 -9223372036854775809Q = Stdlib.Option.Option.None +Stdlib.Int64.fromInt128 9223372036854775808Q == Stdlib.Option.Option.None() +Stdlib.Int64.fromInt128 -9223372036854775809Q == Stdlib.Option.Option.None() -Stdlib.Int64.fromUInt128_v0 0Z = Stdlib.Option.Option.Some 0L +Stdlib.Int64.fromUInt128 0Z == Stdlib.Option.Option.Some(0L) -Stdlib.Int64.fromUInt128_v0 1Z = Stdlib.Option.Option.Some 1L +Stdlib.Int64.fromUInt128 1Z == Stdlib.Option.Option.Some(1L) -Stdlib.Int64.fromUInt128_v0 9223372036854775807Z = Stdlib.Option.Option.Some - 9223372036854775807L +Stdlib.Int64.fromUInt128 9223372036854775807Z == Stdlib.Option.Option.Some(9223372036854775807L) -Stdlib.Int64.fromUInt128_v0 18446744073709551615Z = Stdlib.Option.Option.None \ No newline at end of file +Stdlib.Int64.fromUInt128 18446744073709551615Z == Stdlib.Option.Option.None() \ No newline at end of file diff --git a/backend/testfiles/execution/stdlib/int8.dark b/backend/testfiles/execution/stdlib/int8.dark index 2f5e16a22e..d1f3abdaf9 100644 --- a/backend/testfiles/execution/stdlib/int8.dark +++ b/backend/testfiles/execution/stdlib/int8.dark @@ -1,370 +1,369 @@ -Stdlib.Int8.absoluteValue_v0 -5y = 5y -Stdlib.Int8.absoluteValue_v0 5y = 5y +Stdlib.Int8.absoluteValue -5y == 5y +Stdlib.Int8.absoluteValue 5y == 5y -Stdlib.Int8.absoluteValue_v0 -128y = Builtin.testDerrorMessage "Out of range" +Stdlib.Int8.absoluteValue -128y == Builtin.testDerrorMessage "Out of range" -Stdlib.Int8.max_v0 5y 6y = 6y -Stdlib.Int8.max_v0 10y 1y = 10y -Stdlib.Int8.max_v0 -5y 6y = 6y -Stdlib.Int8.max_v0 127y -128y = 127y +Stdlib.Int8.max 5y 6y == 6y +Stdlib.Int8.max 10y 1y == 10y +Stdlib.Int8.max -5y 6y == 6y +Stdlib.Int8.max 127y -128y == 127y -Stdlib.Int8.min_v0 5y 6y = 5y -Stdlib.Int8.min_v0 50y -10y = -10y -Stdlib.Int8.min_v0 -5y 6y = -5y -Stdlib.Int8.min_v0 127y -128y = -128y +Stdlib.Int8.min 5y 6y == 5y +Stdlib.Int8.min 50y -10y == -10y +Stdlib.Int8.min -5y 6y == -5y +Stdlib.Int8.min 127y -128y == -128y -Stdlib.Int8.clamp_v0 -5y -2y 5y = -2y -Stdlib.Int8.clamp_v0 -3y -2y 1y = -2y -Stdlib.Int8.clamp_v0 -5y 1y 1y = 1y -Stdlib.Int8.clamp_v0 1y 2y 1y = 1y -Stdlib.Int8.clamp_v0 3y 0y 2y = 2y -Stdlib.Int8.clamp_v0 -100y 0y 0y = 0y -Stdlib.Int8.clamp_v0 100y 0y 0y = 0y -Stdlib.Int8.clamp_v0 -100y 0y -1y = -1y -Stdlib.Int8.clamp_v0 100y 0y -1y = 0y -Stdlib.Int8.clamp_v0 -100y -1y 0y = -1y -Stdlib.Int8.clamp_v0 -100y 1y 0y = 0y -Stdlib.Int8.clamp_v0 100y 1y 0y = 1y +Stdlib.Int8.clamp -5y -2y 5y == -2y +Stdlib.Int8.clamp -3y -2y 1y == -2y +Stdlib.Int8.clamp -5y 1y 1y == 1y +Stdlib.Int8.clamp 1y 2y 1y == 1y +Stdlib.Int8.clamp 3y 0y 2y == 2y +Stdlib.Int8.clamp -100y 0y 0y == 0y +Stdlib.Int8.clamp 100y 0y 0y == 0y +Stdlib.Int8.clamp -100y 0y -1y == -1y +Stdlib.Int8.clamp 100y 0y -1y == 0y +Stdlib.Int8.clamp -100y -1y 0y == -1y +Stdlib.Int8.clamp -100y 1y 0y == 0y +Stdlib.Int8.clamp 100y 1y 0y == 1y -Stdlib.Int8.negate_v0 -5y = 5y -Stdlib.Int8.negate_v0 5y = -5y -Stdlib.Int8.negate_v0 0y = 0y -Stdlib.Int8.negate_v0 -0y = 0y +Stdlib.Int8.negate -5y == 5y +Stdlib.Int8.negate 5y == -5y +Stdlib.Int8.negate 0y == 0y +Stdlib.Int8.negate -0y == 0y -Stdlib.Int8.negate_v0 -128y = Builtin.testDerrorMessage "Out of range" +Stdlib.Int8.negate -128y == Builtin.testDerrorMessage "Out of range" -Stdlib.Int8.remainder_v0 15y 6y = Stdlib.Result.Result.Ok 3y +Stdlib.Int8.remainder 15y 6y == Stdlib.Result.Result.Ok(3y) -Stdlib.Int8.remainder_v0 20y 8y = Stdlib.Result.Result.Ok 4y +Stdlib.Int8.remainder 20y 8y == Stdlib.Result.Result.Ok(4y) -Stdlib.Int8.remainder_v0 -20y 8y = Stdlib.Result.Result.Ok -4y +Stdlib.Int8.remainder -20y 8y == Stdlib.Result.Result.Ok(-4y) -Stdlib.Int8.remainder_v0 -20y -8y = Stdlib.Result.Result.Ok -4y +Stdlib.Int8.remainder -20y -8y == Stdlib.Result.Result.Ok(-4y) -Stdlib.Int8.remainder_v0 -15y 6y = Stdlib.Result.Result.Ok -3y +Stdlib.Int8.remainder -15y 6y == Stdlib.Result.Result.Ok(-3y) -Stdlib.Int8.remainder_v0 5y 0y = Builtin.testDerrorMessage "Division by zero" +Stdlib.Int8.remainder 5y 0y == Builtin.testDerrorMessage "Division by zero" -Stdlib.Int8.add_v0 10y 9y = 19y -Stdlib.Int8.add_v0 10y 0y = 10y -Stdlib.Int8.add_v0 88y 9y = 97y -Stdlib.Int8.add_v0 -1y 2y = 1y -Stdlib.Int8.add_v0 1y 0y = 1y -Stdlib.Int8.add_v0 -55y 55y = 0y -Stdlib.Int8.add_v0 55y 55y = 110y -Stdlib.Int8.add_v0 PACKAGE.Darklang.Test.Constants.int8Const 5y = 10y +Stdlib.Int8.add 10y 9y == 19y +Stdlib.Int8.add 10y 0y == 10y +Stdlib.Int8.add 88y 9y == 97y +Stdlib.Int8.add -1y 2y == 1y +Stdlib.Int8.add 1y 0y == 1y +Stdlib.Int8.add -55y 55y == 0y +Stdlib.Int8.add 55y 55y == 110y +// Stdlib.Int8.add PACKAGE.Darklang.Test.Constants.int8Const 5y == 10y -Stdlib.Int8.add_v0 127y 1y = Builtin.testDerrorMessage "Out of range" +Stdlib.Int8.add 127y 1y == Builtin.testDerrorMessage "Out of range" -Stdlib.Int8.add_v0 -128y -1y = Builtin.testDerrorMessage "Out of range" +Stdlib.Int8.add -128y -1y == Builtin.testDerrorMessage "Out of range" -Stdlib.Int8.add_v0 -100y -30y = Builtin.testDerrorMessage "Out of range" +Stdlib.Int8.add -100y -30y == Builtin.testDerrorMessage "Out of range" -Stdlib.Int8.add_v0 100y 30y = Builtin.testDerrorMessage "Out of range" +Stdlib.Int8.add 100y 30y == Builtin.testDerrorMessage "Out of range" -Stdlib.Int8.subtract_v0 10y 9y = 1y -Stdlib.Int8.subtract_v0 88y 9y = 79y -Stdlib.Int8.subtract_v0 0y 1y = -1y -Stdlib.Int8.subtract_v0 1y 0y = 1y -Stdlib.Int8.subtract_v0 -55y -55y = 0y +Stdlib.Int8.subtract 10y 9y == 1y +Stdlib.Int8.subtract 88y 9y == 79y +Stdlib.Int8.subtract 0y 1y == -1y +Stdlib.Int8.subtract 1y 0y == 1y +Stdlib.Int8.subtract -55y -55y == 0y -Stdlib.Int8.subtract_v0 -2y 127y = Builtin.testDerrorMessage "Out of range" +Stdlib.Int8.subtract -2y 127y == Builtin.testDerrorMessage "Out of range" -Stdlib.Int8.subtract_v0 -55y 100y = Builtin.testDerrorMessage "Out of range" +Stdlib.Int8.subtract -55y 100y == Builtin.testDerrorMessage "Out of range" -Stdlib.Int8.multiply_v0 8y 8y = 64y -Stdlib.Int8.multiply_v0 1y 0y = 0y +Stdlib.Int8.multiply 8y 8y == 64y +Stdlib.Int8.multiply 1y 0y == 0y -Stdlib.Int8.multiply_v0 64y 2y = Builtin.testDerrorMessage "Out of range" +Stdlib.Int8.multiply 64y 2y == Builtin.testDerrorMessage "Out of range" -Stdlib.Int8.multiply_v0 -128y -1y = Builtin.testDerrorMessage "Out of range" +Stdlib.Int8.multiply -128y -1y == Builtin.testDerrorMessage "Out of range" -Stdlib.Int8.power_v0 2y 3y = 8y -Stdlib.Int8.power_v0 0y 1y = 0y -Stdlib.Int8.power_v0 1y 0y = 1y -Stdlib.Int8.power_v0 0y 0y = 1y -Stdlib.Int8.power_v0 -2y 5y = -32y -Stdlib.Int8.power_v0 -1y 5y = -1y -Stdlib.Int8.power_v0 -1y 6y = 1y -Stdlib.Int8.power_v0 1y 127y = 1y +Stdlib.Int8.power 2y 3y == 8y +Stdlib.Int8.power 0y 1y == 0y +Stdlib.Int8.power 1y 0y == 1y +Stdlib.Int8.power 0y 0y == 1y +Stdlib.Int8.power -2y 5y == -32y +Stdlib.Int8.power -1y 5y == -1y +Stdlib.Int8.power -1y 6y == 1y +Stdlib.Int8.power 1y 127y == 1y -Stdlib.Int8.power_v0 3y 5y = Builtin.testDerrorMessage "Out of range" +Stdlib.Int8.power 3y 5y == Builtin.testDerrorMessage "Out of range" -Stdlib.Int8.power_v0 120y 20y = Builtin.testDerrorMessage "Out of range" +Stdlib.Int8.power 120y 20y == Builtin.testDerrorMessage "Out of range" -Stdlib.Int8.power_v0 2y -3y = Builtin.testDerrorMessage "Negative exponent" +Stdlib.Int8.power 2y -3y == Builtin.testDerrorMessage "Negative exponent" -Stdlib.Int8.divide_v0 10y 5y = 2y -Stdlib.Int8.divide_v0 17y 3y = 5y -Stdlib.Int8.divide_v0 -8y 5y = -1y -Stdlib.Int8.divide_v0 0y 1y = 0y +Stdlib.Int8.divide 10y 5y == 2y +Stdlib.Int8.divide 17y 3y == 5y +Stdlib.Int8.divide -8y 5y == -1y +Stdlib.Int8.divide 0y 1y == 0y -Stdlib.Int8.divide_v0 1y 0y = Builtin.testDerrorMessage "Division by zero" +Stdlib.Int8.divide 1y 0y == Builtin.testDerrorMessage "Division by zero" -Stdlib.Int8.divide_v0 -128y -1y = Builtin.testDerrorMessage "Out of range" +Stdlib.Int8.divide -128y -1y == Builtin.testDerrorMessage "Out of range" -Stdlib.Int8.greaterThan_v0 20y 1y = true -Stdlib.Int8.greaterThan_v0 20y 127y = false -Stdlib.Int8.greaterThanOrEqualTo_v0 0y 1y = false -Stdlib.Int8.greaterThanOrEqualTo_v0 1y 0y = true -Stdlib.Int8.greaterThanOrEqualTo_v0 6y 1y = true -Stdlib.Int8.greaterThanOrEqualTo_v0 6y 8y = false -Stdlib.Int8.greaterThanOrEqualTo_v0 -5y -20y = true -Stdlib.Int8.greaterThanOrEqualTo_v0 -20y -1y = false -Stdlib.Int8.greaterThanOrEqualTo_v0 -20y -20y = true -Stdlib.Int8.greaterThanOrEqualTo_v0 -128y -20y = false +Stdlib.Int8.greaterThan 20y 1y == true +Stdlib.Int8.greaterThan 20y 127y == false +Stdlib.Int8.greaterThanOrEqualTo 0y 1y == false +Stdlib.Int8.greaterThanOrEqualTo 1y 0y == true +Stdlib.Int8.greaterThanOrEqualTo 6y 1y == true +Stdlib.Int8.greaterThanOrEqualTo 6y 8y == false +Stdlib.Int8.greaterThanOrEqualTo -5y -20y == true +Stdlib.Int8.greaterThanOrEqualTo -20y -1y == false +Stdlib.Int8.greaterThanOrEqualTo -20y -20y == true +Stdlib.Int8.greaterThanOrEqualTo -128y -20y == false -Stdlib.Int8.lessThanOrEqualTo_v0 6y 8y = true -Stdlib.Int8.lessThanOrEqualTo_v0 10y 1y = false -Stdlib.Int8.lessThanOrEqualTo_v0 0y 1y = true -Stdlib.Int8.lessThanOrEqualTo_v0 1y 0y = false -Stdlib.Int8.lessThan_v0 -128y 127y = true +Stdlib.Int8.lessThanOrEqualTo 6y 8y == true +Stdlib.Int8.lessThanOrEqualTo 10y 1y == false +Stdlib.Int8.lessThanOrEqualTo 0y 1y == true +Stdlib.Int8.lessThanOrEqualTo 1y 0y == false +Stdlib.Int8.lessThan -128y 127y == true -Stdlib.Int8.lessThan_v0 6y 8y = true -Stdlib.Int8.lessThan_v0 10y 1y = false -Stdlib.Int8.lessThan_v0 0y 1y = true -Stdlib.Int8.lessThan_v0 1y 0y = false -Stdlib.Int8.lessThan_v0 -128y 127y = true +Stdlib.Int8.lessThan 6y 8y == true +Stdlib.Int8.lessThan 10y 1y == false +Stdlib.Int8.lessThan 0y 1y == true +Stdlib.Int8.lessThan 1y 0y == false +Stdlib.Int8.lessThan -128y 127y == true -Stdlib.Int8.toString 0y = "0" -Stdlib.Int8.toString 1y = "1" -Stdlib.Int8.toString -1y = "-1" -Stdlib.Int8.toString -128y = "-128" // Int8 lower limit -Stdlib.Int8.toString 127y = "127" // Int8 upper limit +Stdlib.Int8.toString 0y == "0" +Stdlib.Int8.toString 1y == "1" +Stdlib.Int8.toString -1y == "-1" +Stdlib.Int8.toString -128y == "-128" // Int8 lower limit +Stdlib.Int8.toString 127y == "127" // Int8 upper limit -Stdlib.Int8.toFloat_v0 2y = 2.0 -Stdlib.Int8.toFloat_v0 127y = 127.0 -Stdlib.Int8.toFloat_v0 -128y = -128.0 -Stdlib.Int8.toFloat_v0 -10y = -10.0 +Stdlib.Int8.toFloat 2y == 2.0 +Stdlib.Int8.toFloat 127y == 127.0 +Stdlib.Int8.toFloat -128y == -128.0 +Stdlib.Int8.toFloat -10y == -10.0 -Stdlib.Int8.sqrt_v0 4y = 2.0 -Stdlib.Int8.sqrt_v0 100y = 10.0 -Stdlib.Int8.sqrt_v0 86y = 9.273618495495704 +Stdlib.Int8.sqrt 4y == 2.0 +Stdlib.Int8.sqrt 100y == 10.0 +Stdlib.Int8.sqrt 86y == 9.273618495495704 -Stdlib.Int8.mod_v0 15y 5y = 0y -Stdlib.Int8.mod_v0 15y 6y = 3y -Stdlib.Int8.mod_v0 0y 15y = 0y -Stdlib.Int8.mod_v0 -1y 2y = 1y -Stdlib.Int8.mod_v0 -128y 53y = 31y -Stdlib.Int8.mod_v0 127y 3y = 1y +Stdlib.Int8.mod 15y 5y == 0y +Stdlib.Int8.mod 15y 6y == 3y +Stdlib.Int8.mod 0y 15y == 0y +Stdlib.Int8.mod -1y 2y == 1y +Stdlib.Int8.mod -128y 53y == 31y +Stdlib.Int8.mod 127y 3y == 1y -Stdlib.Int8.mod_v0 5y 0y = Builtin.testDerrorMessage "Zero modulus" +Stdlib.Int8.mod 5y 0y == Builtin.testDerrorMessage "Zero modulus" -Stdlib.Int8.mod_v0 5y -5y = Builtin.testDerrorMessage "Negative modulus" +Stdlib.Int8.mod 5y -5y == Builtin.testDerrorMessage "Negative modulus" -(Stdlib.List.range_v0 1L 5L) -|> Stdlib.List.map_v0 (fun x -> Stdlib.Int8.random 1y 2y) -|> Stdlib.List.map_v0 (fun x -> - (Stdlib.Int8.greaterThanOrEqualTo x 1y) && (Stdlib.Int8.lessThanOrEqualTo x 2y)) = [ true - true - true - true - true ] - -(Stdlib.List.range_v0 1L 5L) -|> Stdlib.List.map_v0 (fun x -> Stdlib.Int8.random 10y 20y) -|> Stdlib.List.map_v0 (fun x -> +(Stdlib.List.range 1L 5L) +|> Stdlib.List.map (fun x -> Stdlib.Int8.random 1y 2y) +|> Stdlib.List.map (fun x -> + (Stdlib.Int8.greaterThanOrEqualTo x 1y) && (Stdlib.Int8.lessThanOrEqualTo x 2y)) == [ true + true + true + true + true ] + +(Stdlib.List.range 1L 5L) +|> Stdlib.List.map (fun x -> Stdlib.Int8.random 10y 20y) +|> Stdlib.List.map (fun x -> (Stdlib.Int8.greaterThanOrEqualTo x 10y) - && (Stdlib.Int8.lessThanOrEqualTo x 20y)) = [ true; true; true; true; true ] - -(Stdlib.List.range_v0 1L 5L) -|> Stdlib.List.map_v0 (fun x -> Stdlib.Int8.random 2y 1y) -|> Stdlib.List.map_v0 (fun x -> - (Stdlib.Int8.greaterThanOrEqualTo x 1y) && (Stdlib.Int8.lessThanOrEqualTo x 2y)) = [ true - true - true - true - true ] - -(Stdlib.List.range_v0 1L 5L) -|> Stdlib.List.map_v0 (fun x -> Stdlib.Int8.random 20y 10y) -|> Stdlib.List.map_v0 (fun x -> + && (Stdlib.Int8.lessThanOrEqualTo x 20y)) == [ true; true; true; true; true ] + +(Stdlib.List.range 1L 5L) +|> Stdlib.List.map (fun x -> Stdlib.Int8.random 2y 1y) +|> Stdlib.List.map (fun x -> + (Stdlib.Int8.greaterThanOrEqualTo x 1y) && (Stdlib.Int8.lessThanOrEqualTo x 2y)) == [ true + true + true + true + true ] + +(Stdlib.List.range 1L 5L) +|> Stdlib.List.map (fun x -> Stdlib.Int8.random 20y 10y) +|> Stdlib.List.map (fun x -> (Stdlib.Int8.greaterThanOrEqualTo x 10y) - && (Stdlib.Int8.lessThanOrEqualTo x 20y)) = [ true; true; true; true; true ] + && (Stdlib.Int8.lessThanOrEqualTo x 20y)) == [ true; true; true; true; true ] -((Stdlib.List.range_v0 1L 100L) - |> Stdlib.List.map_v0 (fun x -> Stdlib.Int8.random 0y 1y) - |> Stdlib.List.unique_v0) = [ 0y; 1y ] +((Stdlib.List.range 1L 100L) + |> Stdlib.List.map (fun x -> Stdlib.Int8.random 0y 1y) + |> Stdlib.List.unique) == [ 0y; 1y ] -((Stdlib.List.range_v0 1L 100L) - |> Stdlib.List.map_v0 (fun x -> Stdlib.Int8.random 0y 2y) - |> Stdlib.List.unique_v0) = [ 0y; 1y; 2y ] +((Stdlib.List.range 1L 100L) + |> Stdlib.List.map (fun x -> Stdlib.Int8.random 0y 2y) + |> Stdlib.List.unique) == [ 0y; 1y; 2y ] -Stdlib.Int8.parse_v0 "0" = Stdlib.Result.Result.Ok(0y) +Stdlib.Int8.parse "0" == Stdlib.Result.Result.Ok(0y) -Stdlib.Int8.parse_v0 "1" = Stdlib.Result.Result.Ok(1y) +Stdlib.Int8.parse "1" == Stdlib.Result.Result.Ok(1y) -Stdlib.Int8.parse_v0 " 1" = Stdlib.Result.Result.Ok(1y) +Stdlib.Int8.parse " 1" == Stdlib.Result.Result.Ok(1y) -Stdlib.Int8.parse_v0 "1 " = Stdlib.Result.Result.Ok(1y) +Stdlib.Int8.parse "1 " == Stdlib.Result.Result.Ok(1y) -Stdlib.Int8.parse_v0 "+1" = Stdlib.Result.Result.Ok(1y) +Stdlib.Int8.parse "+1" == Stdlib.Result.Result.Ok(1y) -Stdlib.Int8.parse_v0 " +1 " = Stdlib.Result.Result.Ok(1y) +Stdlib.Int8.parse " +1 " == Stdlib.Result.Result.Ok(1y) -Stdlib.Int8.parse_v0 "-1" = Stdlib.Result.Result.Ok(-1y) +Stdlib.Int8.parse "-1" == Stdlib.Result.Result.Ok(-1y) -Stdlib.Int8.parse_v0 "078" = Stdlib.Result.Result.Ok(78y) // "octal" format ignored +Stdlib.Int8.parse "078" == Stdlib.Result.Result.Ok(78y) // "octal" format ignored -Stdlib.Int8.parse_v0 "-00001" = Stdlib.Result.Result.Ok(-1y) +Stdlib.Int8.parse "-00001" == Stdlib.Result.Result.Ok(-1y) -Stdlib.Int8.parse_v0 "-10001" = Stdlib.Result.Result.Error - Stdlib.Int8.ParseError.OutOfRange +Stdlib.Int8.parse "-10001" == Stdlib.Result.Result.Error( + Stdlib.Int8.ParseError.OutOfRange()) -Stdlib.Int8.parse_v0 "127" = Stdlib.Result.Result.Ok(127y) +Stdlib.Int8.parse "127" == Stdlib.Result.Result.Ok(127y) -Stdlib.Int8.parse_v0 "-128" = Stdlib.Result.Result.Ok(-128y) +Stdlib.Int8.parse "-128" == Stdlib.Result.Result.Ok(-128y) -Stdlib.Int8.parse_v0 "128" = Stdlib.Result.Result.Error - Stdlib.Int8.ParseError.OutOfRange +Stdlib.Int8.parse "128" == Stdlib.Result.Result.Error( + Stdlib.Int8.ParseError.OutOfRange()) -Stdlib.Int8.parse_v0 "-129" = Stdlib.Result.Result.Error - Stdlib.Int8.ParseError.OutOfRange +Stdlib.Int8.parse "-129" == Stdlib.Result.Result.Error( + Stdlib.Int8.ParseError.OutOfRange()) -Stdlib.Int8.parse_v0 "1 2 3" = Stdlib.Result.Result.Error - Stdlib.Int8.ParseError.BadFormat +Stdlib.Int8.parse "1 2 3" == Stdlib.Result.Result.Error( + Stdlib.Int8.ParseError.BadFormat()) -Stdlib.Int8.parse_v0 "+ 1" = Stdlib.Result.Result.Error - Stdlib.Int8.ParseError.BadFormat +Stdlib.Int8.parse "+ 1" == Stdlib.Result.Result.Error( + Stdlib.Int8.ParseError.BadFormat()) -Stdlib.Int8.parse_v0 "- 1" = Stdlib.Result.Result.Error - Stdlib.Int8.ParseError.BadFormat +Stdlib.Int8.parse "- 1" == Stdlib.Result.Result.Error( + Stdlib.Int8.ParseError.BadFormat()) -Stdlib.Int8.parse_v0 "0xA" = Stdlib.Result.Result.Error - Stdlib.Int8.ParseError.BadFormat +Stdlib.Int8.parse "0xA" == Stdlib.Result.Result.Error( + Stdlib.Int8.ParseError.BadFormat()) -Stdlib.Int8.parse_v0 "0x123" = Stdlib.Result.Result.Error - Stdlib.Int8.ParseError.BadFormat +Stdlib.Int8.parse "0x123" == Stdlib.Result.Result.Error( + Stdlib.Int8.ParseError.BadFormat()) -Stdlib.Int8.parse_v0 "0b0100" = Stdlib.Result.Result.Error - Stdlib.Int8.ParseError.BadFormat +Stdlib.Int8.parse "0b0100" == Stdlib.Result.Result.Error( + Stdlib.Int8.ParseError.BadFormat()) -Stdlib.Int8.parse_v0 "pi" = Stdlib.Result.Result.Error - Stdlib.Int8.ParseError.BadFormat +Stdlib.Int8.parse "pi" == Stdlib.Result.Result.Error( + Stdlib.Int8.ParseError.BadFormat()) -Stdlib.Int8.parse_v0 "PACKAGE.Darklang.Stdlib.Math.pi" = Stdlib.Result.Result.Error - Stdlib.Int8.ParseError.BadFormat +Stdlib.Int8.parse "PACKAGE.Darklang.Stdlib.Math.pi" == Stdlib.Result.Result.Error( + Stdlib.Int8.ParseError.BadFormat()) -Stdlib.Int8.parse_v0 "1.23E+04" = Stdlib.Result.Result.Error - Stdlib.Int8.ParseError.BadFormat +Stdlib.Int8.parse "1.23E+04" == Stdlib.Result.Result.Error( + Stdlib.Int8.ParseError.BadFormat()) -Stdlib.Int8.parse_v0 "" = Stdlib.Result.Result.Error Stdlib.Int8.ParseError.BadFormat +Stdlib.Int8.parse "" == Stdlib.Result.Result.Error(Stdlib.Int8.ParseError.BadFormat()) +Stdlib.Int8.parse "1I" == Stdlib.Result.Result.Error( + Stdlib.Int8.ParseError.BadFormat()) -Stdlib.Int8.parse_v0 "1I" = Stdlib.Result.Result.Error - Stdlib.Int8.ParseError.BadFormat +Stdlib.Int8.parse "one" == Stdlib.Result.Result.Error( + Stdlib.Int8.ParseError.BadFormat()) -Stdlib.Int8.parse_v0 "one" = Stdlib.Result.Result.Error - Stdlib.Int8.ParseError.BadFormat +Stdlib.Int8.parse "XIV" == Stdlib.Result.Result.Error( + Stdlib.Int8.ParseError.BadFormat()) -Stdlib.Int8.parse_v0 "XIV" = Stdlib.Result.Result.Error - Stdlib.Int8.ParseError.BadFormat +Stdlib.Int8.fromUInt8 0uy == Stdlib.Option.Option.Some(0y) -Stdlib.Int8.fromUInt8_v0 0uy = Stdlib.Option.Option.Some 0y +Stdlib.Int8.fromUInt8 1uy == Stdlib.Option.Option.Some(1y) -Stdlib.Int8.fromUInt8_v0 1uy = Stdlib.Option.Option.Some 1y +Stdlib.Int8.fromUInt8 127uy == Stdlib.Option.Option.Some(127y) -Stdlib.Int8.fromUInt8_v0 127uy = Stdlib.Option.Option.Some 127y +Stdlib.Int8.fromUInt8 128uy == Stdlib.Option.Option.None() +Stdlib.Int8.fromUInt8 255uy == Stdlib.Option.Option.None() -Stdlib.Int8.fromUInt8_v0 128uy = Stdlib.Option.Option.None -Stdlib.Int8.fromUInt8_v0 255uy = Stdlib.Option.Option.None +Stdlib.Int8.fromInt16 0s == Stdlib.Option.Option.Some(0y) -Stdlib.Int8.fromInt16_v0 0s = Stdlib.Option.Option.Some 0y +Stdlib.Int8.fromInt16 1s == Stdlib.Option.Option.Some(1y) -Stdlib.Int8.fromInt16_v0 1s = Stdlib.Option.Option.Some 1y +Stdlib.Int8.fromInt16 127s == Stdlib.Option.Option.Some(127y) -Stdlib.Int8.fromInt16_v0 127s = Stdlib.Option.Option.Some 127y +Stdlib.Int8.fromInt16 128s == Stdlib.Option.Option.None() -Stdlib.Int8.fromInt16_v0 128s = Stdlib.Option.Option.None +Stdlib.Int8.fromInt16 (-1s) == Stdlib.Option.Option.Some(-1y) -Stdlib.Int8.fromInt16_v0 (-1s) = Stdlib.Option.Option.Some -1y +Stdlib.Int8.fromInt16 (-128s) == Stdlib.Option.Option.Some(-128y) -Stdlib.Int8.fromInt16_v0 (-128s) = Stdlib.Option.Option.Some -128y +Stdlib.Int8.fromInt16 (-129s) == Stdlib.Option.Option.None() -Stdlib.Int8.fromInt16_v0 (-129s) = Stdlib.Option.Option.None +Stdlib.Int8.fromUInt16 0us == Stdlib.Option.Option.Some(0y) -Stdlib.Int8.fromUInt16_v0 0us = Stdlib.Option.Option.Some 0y +Stdlib.Int8.fromUInt16 1us == Stdlib.Option.Option.Some(1y) -Stdlib.Int8.fromUInt16_v0 1us = Stdlib.Option.Option.Some 1y +Stdlib.Int8.fromUInt16 127us == Stdlib.Option.Option.Some(127y) -Stdlib.Int8.fromUInt16_v0 127us = Stdlib.Option.Option.Some 127y +Stdlib.Int8.fromUInt16 128us == Stdlib.Option.Option.None() +Stdlib.Int8.fromUInt16 255us == Stdlib.Option.Option.None() -Stdlib.Int8.fromUInt16_v0 128us = Stdlib.Option.Option.None -Stdlib.Int8.fromUInt16_v0 255us = Stdlib.Option.Option.None +Stdlib.Int8.fromInt32 0l == Stdlib.Option.Option.Some(0y) -Stdlib.Int8.fromInt32_v0 0l = Stdlib.Option.Option.Some 0y +Stdlib.Int8.fromInt32 1l == Stdlib.Option.Option.Some(1y) -Stdlib.Int8.fromInt32_v0 1l = Stdlib.Option.Option.Some 1y +Stdlib.Int8.fromInt32 127l == Stdlib.Option.Option.Some(127y) -Stdlib.Int8.fromInt32_v0 127l = Stdlib.Option.Option.Some 127y +Stdlib.Int8.fromInt32 128l == Stdlib.Option.Option.None() -Stdlib.Int8.fromInt32_v0 128l = Stdlib.Option.Option.None +Stdlib.Int8.fromInt32 (-1l) == Stdlib.Option.Option.Some(-1y) -Stdlib.Int8.fromInt32_v0 (-1l) = Stdlib.Option.Option.Some -1y +Stdlib.Int8.fromInt32 (-128l) == Stdlib.Option.Option.Some(-128y) -Stdlib.Int8.fromInt32_v0 (-128l) = Stdlib.Option.Option.Some -128y +Stdlib.Int8.fromInt32 (-129l) == Stdlib.Option.Option.None() -Stdlib.Int8.fromInt32_v0 (-129l) = Stdlib.Option.Option.None +Stdlib.Int8.fromInt32 2147483647l == Stdlib.Option.Option.None() -Stdlib.Int8.fromInt32_v0 2147483647l = Stdlib.Option.Option.None +Stdlib.Int8.fromUInt32 0ul == Stdlib.Option.Option.Some(0y) -Stdlib.Int8.fromUInt32_v0 0ul = Stdlib.Option.Option.Some 0y +Stdlib.Int8.fromUInt32 1ul == Stdlib.Option.Option.Some(1y) -Stdlib.Int8.fromUInt32_v0 1ul = Stdlib.Option.Option.Some 1y +Stdlib.Int8.fromUInt32 127ul == Stdlib.Option.Option.Some(127y) -Stdlib.Int8.fromUInt32_v0 127ul = Stdlib.Option.Option.Some 127y +Stdlib.Int8.fromUInt32 128ul == Stdlib.Option.Option.None() +Stdlib.Int8.fromUInt32 4294967295ul == Stdlib.Option.Option.None() -Stdlib.Int8.fromUInt32_v0 128ul = Stdlib.Option.Option.None -Stdlib.Int8.fromUInt32_v0 4294967295ul = Stdlib.Option.Option.None +Stdlib.Int8.fromInt64 0L == Stdlib.Option.Option.Some(0y) -Stdlib.Int8.fromInt64_v0 0L = Stdlib.Option.Option.Some 0y +Stdlib.Int8.fromInt64 1L == Stdlib.Option.Option.Some(1y) -Stdlib.Int8.fromInt64_v0 1L = Stdlib.Option.Option.Some 1y +Stdlib.Int8.fromInt64 127L == Stdlib.Option.Option.Some(127y) -Stdlib.Int8.fromInt64_v0 127L = Stdlib.Option.Option.Some 127y +Stdlib.Int8.fromInt64 128L == Stdlib.Option.Option.None() -Stdlib.Int8.fromInt64_v0 128L = Stdlib.Option.Option.None +Stdlib.Int8.fromInt64 (-1L) == Stdlib.Option.Option.Some(-1y) -Stdlib.Int8.fromInt64_v0 (-1L) = Stdlib.Option.Option.Some -1y +Stdlib.Int8.fromInt64 (-128L) == Stdlib.Option.Option.Some(-128y) -Stdlib.Int8.fromInt64_v0 (-128L) = Stdlib.Option.Option.Some -128y +Stdlib.Int8.fromInt64 (-129L) == Stdlib.Option.Option.None() -Stdlib.Int8.fromInt64_v0 (-129L) = Stdlib.Option.Option.None +Stdlib.Int8.fromUInt64 0UL == Stdlib.Option.Option.Some(0y) -Stdlib.Int8.fromUInt64_v0 0UL = Stdlib.Option.Option.Some 0y +Stdlib.Int8.fromUInt64 1UL == Stdlib.Option.Option.Some(1y) -Stdlib.Int8.fromUInt64_v0 1UL = Stdlib.Option.Option.Some 1y +Stdlib.Int8.fromUInt64 127UL == Stdlib.Option.Option.Some(127y) -Stdlib.Int8.fromUInt64_v0 127UL = Stdlib.Option.Option.Some 127y +Stdlib.Int8.fromUInt64 128UL == Stdlib.Option.Option.None() +Stdlib.Int8.fromUInt64 255UL == Stdlib.Option.Option.None() -Stdlib.Int8.fromUInt64_v0 128UL = Stdlib.Option.Option.None -Stdlib.Int8.fromUInt64_v0 255UL = Stdlib.Option.Option.None +Stdlib.Int8.fromInt128 0Q == Stdlib.Option.Option.Some(0y) -Stdlib.Int8.fromInt128_v0 0Q = Stdlib.Option.Option.Some 0y +Stdlib.Int8.fromInt128 1Q == Stdlib.Option.Option.Some(1y) -Stdlib.Int8.fromInt128_v0 1Q = Stdlib.Option.Option.Some 1y +Stdlib.Int8.fromInt128 127Q == Stdlib.Option.Option.Some(127y) -Stdlib.Int8.fromInt128_v0 127Q = Stdlib.Option.Option.Some 127y +Stdlib.Int8.fromInt128 128Q == Stdlib.Option.Option.None() -Stdlib.Int8.fromInt128_v0 128Q = Stdlib.Option.Option.None +Stdlib.Int8.fromInt128 -1Q == Stdlib.Option.Option.Some(-1y) -Stdlib.Int8.fromInt128_v0 (-1Q) = Stdlib.Option.Option.Some -1y +Stdlib.Int8.fromInt128 -128Q == Stdlib.Option.Option.Some(-128y) -Stdlib.Int8.fromInt128_v0 (-128Q) = Stdlib.Option.Option.Some -128y +Stdlib.Int8.fromInt128 -129Q == Stdlib.Option.Option.None() -Stdlib.Int8.fromInt128_v0 (-129Q) = Stdlib.Option.Option.None +Stdlib.Int8.fromUInt128 0Z == Stdlib.Option.Option.Some(0y) -Stdlib.Int8.fromUInt128_v0 0Z = Stdlib.Option.Option.Some 0y +Stdlib.Int8.fromUInt128 1Z == Stdlib.Option.Option.Some(1y) -Stdlib.Int8.fromUInt128_v0 1Z = Stdlib.Option.Option.Some 1y +Stdlib.Int8.fromUInt128 127Z == Stdlib.Option.Option.Some(127y) -Stdlib.Int8.fromUInt128_v0 127Z = Stdlib.Option.Option.Some 127y - -Stdlib.Int8.fromUInt128_v0 128Z = Stdlib.Option.Option.None -Stdlib.Int8.fromUInt128_v0 255Z = Stdlib.Option.Option.None \ No newline at end of file +Stdlib.Int8.fromUInt128 128Z == Stdlib.Option.Option.None() +Stdlib.Int8.fromUInt128 255Z == Stdlib.Option.Option.None() \ No newline at end of file diff --git a/backend/testfiles/execution/stdlib/json.dark b/backend/testfiles/execution/stdlib/json.dark index c7475dab61..d587794e03 100644 --- a/backend/testfiles/execution/stdlib/json.dark +++ b/backend/testfiles/execution/stdlib/json.dark @@ -5,7 +5,7 @@ // so do we really have to do anything here? // It feels like a "no" to me - ignoring for now. -type Person = { Name: String; Age: Int64 } +type Person = { name: String; age: Int64 } type Result<'ok, 'err> = Stdlib.Result.Result<'ok, 'err> type Option<'t> = Stdlib.Option.Option<'t> @@ -15,81 +15,80 @@ let err : Result<'a, String> = v |> Stdlib.Result.mapError Stdlib.Json.ParseError.toString - module Unit = - Builtin.jsonSerialize () = "null" - Builtin.jsonParse "null" = Result.Ok() + (Builtin.jsonSerialize ()) == "null" + (Builtin.jsonParse "null") == Result.Ok(()) module Errors = - (Builtin.jsonParse "()") |> err = Result.Error "Not JSON" + ((Builtin.jsonParse "()") |> err) == Result.Error("Not JSON") - (Builtin.jsonParse "0") |> err = Result.Error - "Can't parse JSON `0` as type `Unit` at path: `root`" + ((Builtin.jsonParse "0") |> err) + == Result.Error("Can't parse JSON `0` as type `Unit` at path: `root`") - (Builtin.jsonParse "\"\"") |> err = Result.Error - "Can't parse JSON `\"\"` as type `Unit` at path: `root`" + ((Builtin.jsonParse "\"\"") |> err) + == Result.Error("Can't parse JSON `\"\"` as type `Unit` at path: `root`") - (Builtin.jsonParse "\"null\"") |> err = Result.Error - "Can't parse JSON `\"null\"` as type `Unit` at path: `root`" + ((Builtin.jsonParse "\"null\"") |> err) + == Result.Error("Can't parse JSON `\"null\"` as type `Unit` at path: `root`") module Bool = - Builtin.jsonSerialize true = "true" - Builtin.jsonSerialize false = "false" + (Builtin.jsonSerialize true) == "true" + (Builtin.jsonSerialize false) == "false" - Builtin.jsonParse "true" = Result.Ok true - Builtin.jsonParse "false" = Result.Ok false - Builtin.jsonParse " true " = Result.Ok true - Builtin.jsonParse " false " = Result.Ok false + (Builtin.jsonParse "true") == Result.Ok(true) + (Builtin.jsonParse "false") == Result.Ok(false) + (Builtin.jsonParse " true ") == Result.Ok(true) + (Builtin.jsonParse " false ") == Result.Ok(false) - Builtin.jsonParse> "[true, true, false, true ] " = Result.Ok - [ true; true; false; true ] + (Builtin.jsonParse> "[true, true, false, true ] ") + == (Result.Ok([ true; true; false; true ])) module Errors = - (Builtin.jsonParse "tru") |> err = Result.Error "Not JSON" + ((Builtin.jsonParse "tru") |> err) == Result.Error("Not JSON") - (Builtin.jsonParse "null") |> err = Result.Error - "Can't parse JSON `null` as type `Bool` at path: `root`" + ((Builtin.jsonParse "null") |> err) + == Result.Error("Can't parse JSON `null` as type `Bool` at path: `root`") - (Builtin.jsonParse "") |> err = Result.Error "Not JSON" + ((Builtin.jsonParse "") |> err) == Result.Error("Not JSON") - (Builtin.jsonParse "\"true\"") |> err = Result.Error - "Can't parse JSON `\"true\"` as type `Bool` at path: `root`" + ((Builtin.jsonParse "\"true\"") |> err) + == Result.Error("Can't parse JSON `\"true\"` as type `Bool` at path: `root`") - (Builtin.jsonParse "0") |> err = Result.Error - "Can't parse JSON `0` as type `Bool` at path: `root`" + ((Builtin.jsonParse "0") |> err) + == Result.Error("Can't parse JSON `0` as type `Bool` at path: `root`") - (Builtin.jsonParse "1") |> err = Result.Error - "Can't parse JSON `1` as type `Bool` at path: `root`" + ((Builtin.jsonParse "1") |> err) + == Result.Error("Can't parse JSON `1` as type `Bool` at path: `root`") - (Builtin.jsonParse "False") |> err = Result.Error "Not JSON" + ((Builtin.jsonParse "False") |> err) == Result.Error("Not JSON") - (Builtin.jsonParse "tRUE") |> err = Result.Error "Not JSON" + ((Builtin.jsonParse "tRUE") |> err) == Result.Error("Not JSON") module Int64 = module Basic = - Builtin.jsonSerialize 0L = "0" - Builtin.jsonSerialize 12345L = "12345" - Builtin.jsonSerialize -12345L = "-12345" - Builtin.jsonParse "0" = Result.Ok 0L - Builtin.jsonParse "0.0" = Result.Ok 0L - Builtin.jsonParse "-0.0" = Result.Ok 0L - Builtin.jsonParse "-1.0" = Result.Ok(-1L) - Builtin.jsonParse "1.2E2" = Result.Ok 120L - Builtin.jsonParse "1.2E+2" = Result.Ok 120L - Builtin.jsonParse "1200E-1" = Result.Ok 120L + Builtin.jsonSerialize 0L == "0" + Builtin.jsonSerialize 12345L == "12345" + Builtin.jsonSerialize -12345L == "-12345" + Builtin.jsonParse "0" == Stdlib.Result.Result.Ok(0L) + Builtin.jsonParse "0.0" == Stdlib.Result.Result.Ok(0L) + Builtin.jsonParse "-0.0" == Stdlib.Result.Result.Ok(0L) + Builtin.jsonParse "-1.0" == Stdlib.Result.Result.Ok(-1L) + Builtin.jsonParse "1.2E2" == Stdlib.Result.Result.Ok(120L) + Builtin.jsonParse "1.2E+2" == Stdlib.Result.Result.Ok(120L) + Builtin.jsonParse "1200E-1" == Stdlib.Result.Result.Ok(120L) module Int32Limits = // test the limits of int32 (-2147483648 to 2147483647) - Builtin.jsonSerialize -2147483648L = "-2147483648" - Builtin.jsonSerialize 2147483647L = "2147483647" - Builtin.jsonParse "-2147483648" = Result.Ok -2147483648L - Builtin.jsonParse "2147483647" = Result.Ok 2147483647L - Builtin.jsonSerialize -2147483649L = "-2147483649" - Builtin.jsonSerialize 2147483648L = "2147483648" - Builtin.jsonParse "-2147483649" = Result.Ok -2147483649L - Builtin.jsonParse "2147483648" = Result.Ok 2147483648L + Builtin.jsonSerialize -2147483648L == "-2147483648" + Builtin.jsonSerialize 2147483647L == "2147483647" + Builtin.jsonParse "-2147483648" == Result.Ok(-2147483648L) + Builtin.jsonParse "2147483647" == Result.Ok(2147483647L) + Builtin.jsonSerialize -2147483649L == "-2147483649" + Builtin.jsonSerialize 2147483648L == "2147483648" + Builtin.jsonParse "-2147483649" == Result.Ok(-2147483649L) + Builtin.jsonParse "2147483648" == Result.Ok(2147483648L) module Int64Limits = // test the limits of int64 (-9223372036854775808 to 9223372036854775807) @@ -98,25 +97,24 @@ module Int64 = // be certain // First number that doesn't fit in an int64 - (Builtin.jsonParse "9223372036854775808") |> err = Result.Error - "Can't parse JSON `9223372036854775808` as type `Int64` at path: `root`" + (Builtin.jsonParse "9223372036854775808") |> err + == Result.Error("Can't parse JSON `9223372036854775808` as type `Int64` at path: `root`") // This is a float that is a valid int64 - Builtin.jsonParse "9.2E18" = Result.Ok 9200000000000000000L + Builtin.jsonParse "9.2E18" == Result.Ok(9200000000000000000L) // This is a float that is slightly above the int64 max - (Builtin.jsonParse "9.3E18") |> err = Result.Error - "Can't parse JSON `9.3E18` as type `Int64` at path: `root`" + (Builtin.jsonParse "9.3E18") |> err + == Result.Error("Can't parse JSON `9.3E18` as type `Int64` at path: `root`") - Builtin.jsonSerialize 9223372036854775807L = "9223372036854775807" + Builtin.jsonSerialize 9223372036854775807L == "9223372036854775807" - Builtin.jsonParse "9223372036854775807" = Result.Ok 9223372036854775807L + Builtin.jsonParse "9223372036854775807" == Result.Ok(9223372036854775807L) - Builtin.jsonSerialize -9223372036854775808L = "-9223372036854775808" + Builtin.jsonSerialize -9223372036854775808L == "-9223372036854775808" - Builtin.jsonParse "-9223372036854775808" = Result.Ok( - -9223372036854775808L - ) + Builtin.jsonParse "-9223372036854775808" + == Result.Ok(-9223372036854775808L) module Errors = @@ -124,719 +122,724 @@ module Int64 = // TODO: review Float.tests for more values to test against // not ints - (Builtin.jsonParse " ") |> err = Result.Error "Not JSON" - (Builtin.jsonParse "4a") |> err = Result.Error "Not JSON" + (Builtin.jsonParse " ") |> err == Result.Error("Not JSON") + (Builtin.jsonParse "4a") |> err == Result.Error("Not JSON") - (Builtin.jsonParse "- 42") |> err = Result.Error "Not JSON" + (Builtin.jsonParse "- 42") |> err == Result.Error("Not JSON") - (Builtin.jsonParse "null") |> err = Result.Error - "Can't parse JSON `null` as type `Int64` at path: `root`" + (Builtin.jsonParse "null") |> err + == Result.Error("Can't parse JSON `null` as type `Int64` at path: `root`") - (Builtin.jsonParse "true") |> err = Result.Error - "Can't parse JSON `true` as type `Int64` at path: `root`" + (Builtin.jsonParse "true") |> err + == Result.Error("Can't parse JSON `true` as type `Int64` at path: `root`") - (Builtin.jsonParse "false") |> err = Result.Error - "Can't parse JSON `false` as type `Int64` at path: `root`" + (Builtin.jsonParse "false") |> err + == Result.Error("Can't parse JSON `false` as type `Int64` at path: `root`") - (Builtin.jsonParse "\"42\"") |> err = Result.Error - "Can't parse JSON `\"42\"` as type `Int64` at path: `root`" + (Builtin.jsonParse "\"42\"") |> err + == Result.Error("Can't parse JSON `\"42\"` as type `Int64` at path: `root`") - (Builtin.jsonParse "[42]") |> err = Result.Error - "Can't parse JSON `[42]` as type `Int64` at path: `root`" + (Builtin.jsonParse "[42]") |> err + == Result.Error("Can't parse JSON `[42]` as type `Int64` at path: `root`") - (Builtin.jsonParse "{ \"key\": 42 }") |> err = Result.Error - "Can't parse JSON `{ \"key\": 42 }` as type `Int64` at path: `root`" + (Builtin.jsonParse "{ \"key\": 42 }") |> err + == Result.Error( "Can't parse JSON `{ \"key\": 42 }` as type `Int64` at path: `root`") - (Builtin.jsonParse "42.5") |> err = Result.Error - "Can't parse JSON `42.5` as type `Int64` at path: `root`" + (Builtin.jsonParse "42.5") |> err + == Result.Error("Can't parse JSON `42.5` as type `Int64` at path: `root`") - (Builtin.jsonParse "\"42\n\"") |> err = Result.Error "Not JSON" + (Builtin.jsonParse "\"42\n\"") |> err == Result.Error("Not JSON") module UInt64 = module Basic = - Builtin.jsonSerialize 0UL = "0" - Builtin.jsonSerialize 12345UL = "12345" - Builtin.jsonParse "0" = Result.Ok 0UL - Builtin.jsonParse "0.0" = Result.Ok 0UL - Builtin.jsonParse "1.2E2" = Result.Ok 120UL - Builtin.jsonParse "1.2E+2" = Result.Ok 120UL - Builtin.jsonParse "1200E-1" = Result.Ok 120UL + Builtin.jsonSerialize 0UL == "0" + Builtin.jsonSerialize 12345UL == "12345" + Builtin.jsonParse "0" == Result.Ok(0UL) + Builtin.jsonParse "0.0" == Result.Ok(0UL) + Builtin.jsonParse "1.2E2" == Result.Ok(120UL) + Builtin.jsonParse "1.2E+2" == Result.Ok(120UL) + Builtin.jsonParse "1200E-1" == Result.Ok(120UL) module UInt64Limits = // test the limits of uint64 (0 to 18446744073709551615) - Builtin.jsonSerialize 0UL = "0" - Builtin.jsonSerialize 18446744073709551615UL = "18446744073709551615" - Builtin.jsonParse "0" = Result.Ok 0UL + Builtin.jsonSerialize 0UL == "0" + Builtin.jsonSerialize 18446744073709551615UL == "18446744073709551615" + Builtin.jsonParse "0" == Result.Ok(0UL) - Builtin.jsonParse "18446744073709551615" = Result.Ok - 18446744073709551615UL + Builtin.jsonParse "18446744073709551615" + == Result.Ok(18446744073709551615UL) - // First number that doesn't fit in an int64 - // TODO : The two commented tests below are failing due to a bug in the conversion from a double to a uint64 in dotnet runtime. - // The tests pass inside the container, but fail in CI - // (Builtin.jsonParse "18446744073709551616") |> err = Result.Error - // "Can't parse JSON `18446744073709551616` as type `UInt64` at path: `root`" + // First number that doesn't fit in an int64 + // TODO : The two commented tests below are failing due to a bug in the conversion from a double to a uint64 in dotnet runtime. + // The tests pass inside the container, but fail in CI + // (Builtin.jsonParse "18446744073709551616") |> err == Result.Error + // "Can't parse JSON `18446744073709551616` as type `UInt64` at path: `root`" - // This is a float that is a valid uint64 - // Builtin.jsonParse "1.8446744073709551615E19" = Result.Ok - // 18446744073709551615UL + // This is a float that is a valid uint64 + // Builtin.jsonParse "1.8446744073709551615E19" + // == Result.Ok(18446744073709551615UL) - // This is a float that is slightly above the uint64 max - (Builtin.jsonParse "1.9E19") |> err = Result.Error - "Can't parse JSON `1.9E19` as type `UInt64` at path: `root`" + // This is a float that is slightly above the uint64 max + (Builtin.jsonParse "1.9E19") |> err + == Result.Error("Can't parse JSON `1.9E19` as type `UInt64` at path: `root`") module Errors = - (Builtin.jsonParse " ") |> err = Result.Error "Not JSON" - (Builtin.jsonParse "4a") |> err = Result.Error "Not JSON" - (Builtin.jsonParse "- 42") |> err = Result.Error "Not JSON" + (Builtin.jsonParse " ") |> err == Result.Error("Not JSON") + (Builtin.jsonParse "4a") |> err == Result.Error("Not JSON") + (Builtin.jsonParse "- 42") |> err == Result.Error("Not JSON") - (Builtin.jsonParse "null") |> err = Result.Error - "Can't parse JSON `null` as type `UInt64` at path: `root`" + (Builtin.jsonParse "null") |> err + == Result.Error("Can't parse JSON `null` as type `UInt64` at path: `root`") - (Builtin.jsonParse "true") |> err = Result.Error - "Can't parse JSON `true` as type `UInt64` at path: `root`" + (Builtin.jsonParse "true") |> err + == Result.Error("Can't parse JSON `true` as type `UInt64` at path: `root`") - (Builtin.jsonParse "false") |> err = Result.Error - "Can't parse JSON `false` as type `UInt64` at path: `root`" + (Builtin.jsonParse "false") |> err + == Result.Error("Can't parse JSON `false` as type `UInt64` at path: `root`") - (Builtin.jsonParse "\"42\"") |> err = Result.Error - "Can't parse JSON `\"42\"` as type `UInt64` at path: `root`" + (Builtin.jsonParse "\"42\"") |> err + == Result.Error("Can't parse JSON `\"42\"` as type `UInt64` at path: `root`") - (Builtin.jsonParse "[42]") |> err = Result.Error - "Can't parse JSON `[42]` as type `UInt64` at path: `root`" + (Builtin.jsonParse "[42]") |> err + == Result.Error("Can't parse JSON `[42]` as type `UInt64` at path: `root`") - (Builtin.jsonParse "{ \"key\": 42 }") |> err = Result.Error - "Can't parse JSON `{ \"key\": 42 }` as type `UInt64` at path: `root`" + (Builtin.jsonParse "{ \"key\": 42 }") |> err + == Result.Error( "Can't parse JSON `{ \"key\": 42 }` as type `UInt64` at path: `root`") - (Builtin.jsonParse "42.5") |> err = Result.Error - "Can't parse JSON `42.5` as type `UInt64` at path: `root`" + (Builtin.jsonParse "42.5") |> err + == Result.Error("Can't parse JSON `42.5` as type `UInt64` at path: `root`") - (Builtin.jsonParse "\"42\n\"") |> err = Result.Error "Not JSON" + (Builtin.jsonParse "\"42\n\"") |> err == Result.Error("Not JSON") module Int8 = module Basic = - Builtin.jsonSerialize 0y = "0" - Builtin.jsonSerialize 123y = "123" - Builtin.jsonSerialize -123y = "-123" + Builtin.jsonSerialize 0y == "0" + Builtin.jsonSerialize 123y == "123" + Builtin.jsonSerialize -123y == "-123" - Builtin.jsonParse "0" = Result.Ok 0y + Builtin.jsonParse "0" == Result.Ok(0y) - Builtin.jsonParse "0.0" = Result.Ok 0y + Builtin.jsonParse "0.0" == Result.Ok(0y) - Builtin.jsonParse "-0.0" = Result.Ok 0y + Builtin.jsonParse "-0.0" == Result.Ok(0y) - Builtin.jsonParse "-1.0" = Result.Ok -1y + Builtin.jsonParse "-1.0" == Result.Ok(-1y) - Builtin.jsonParse "1.2E2" = Result.Ok 120y + Builtin.jsonParse "1.2E2" == Result.Ok(120y) - Builtin.jsonParse "1.2E+2" = Result.Ok 120y + Builtin.jsonParse "1.2E+2" == Result.Ok(120y) - Builtin.jsonParse "1200E-1" = Result.Ok 120y + Builtin.jsonParse "1200E-1" == Result.Ok(120y) module Int8Limits = - Builtin.jsonSerialize -128y = "-128" - Builtin.jsonSerialize 127y = "127" + Builtin.jsonSerialize -128y == "-128" + Builtin.jsonSerialize 127y == "127" - Builtin.jsonParse "-128" = Result.Ok -128y - Builtin.jsonParse "127" = Result.Ok 127y + Builtin.jsonParse "-128" == Result.Ok(-128y) + Builtin.jsonParse "127" == Result.Ok(127y) - (Builtin.jsonParse "-129") |> err = Result.Error - "Can't parse JSON `-129` as type `Int8` at path: `root`" + (Builtin.jsonParse "-129") |> err + == Result.Error("Can't parse JSON `-129` as type `Int8` at path: `root`") - (Builtin.jsonParse "128") |> err = Result.Error - "Can't parse JSON `128` as type `Int8` at path: `root`" + (Builtin.jsonParse "128") |> err + == Result.Error("Can't parse JSON `128` as type `Int8` at path: `root`") module Errors = - (Builtin.jsonParse " ") |> err = Result.Error "Not JSON" + (Builtin.jsonParse " ") |> err == Result.Error("Not JSON") - (Builtin.jsonParse "4a") |> err = Result.Error "Not JSON" + (Builtin.jsonParse "4a") |> err == Result.Error("Not JSON") - (Builtin.jsonParse "- 42") |> err = Result.Error "Not JSON" + (Builtin.jsonParse "- 42") |> err == Result.Error("Not JSON") - (Builtin.jsonParse "null") |> err = Result.Error - "Can't parse JSON `null` as type `Int8` at path: `root`" + (Builtin.jsonParse "null") |> err + == Result.Error("Can't parse JSON `null` as type `Int8` at path: `root`") - (Builtin.jsonParse "true") |> err = Result.Error - "Can't parse JSON `true` as type `Int8` at path: `root`" + (Builtin.jsonParse "true") |> err + == Result.Error("Can't parse JSON `true` as type `Int8` at path: `root`") - (Builtin.jsonParse "false") |> err = Result.Error - "Can't parse JSON `false` as type `Int8` at path: `root`" + (Builtin.jsonParse "false") |> err + == Result.Error("Can't parse JSON `false` as type `Int8` at path: `root`") - (Builtin.jsonParse "\"42\"") |> err = Result.Error - "Can't parse JSON `\"42\"` as type `Int8` at path: `root`" + (Builtin.jsonParse "\"42\"") |> err + == Result.Error("Can't parse JSON `\"42\"` as type `Int8` at path: `root`") - (Builtin.jsonParse "[42]") |> err = Result.Error - "Can't parse JSON `[42]` as type `Int8` at path: `root`" + (Builtin.jsonParse "[42]") |> err + == Result.Error("Can't parse JSON `[42]` as type `Int8` at path: `root`") - (Builtin.jsonParse "{ \"key\": 42 }") |> err = Result.Error - "Can't parse JSON `{ \"key\": 42 }` as type `Int8` at path: `root`" + (Builtin.jsonParse "{ \"key\": 42 }") |> err + == Result.Error( "Can't parse JSON `{ \"key\": 42 }` as type `Int8` at path: `root`") - (Builtin.jsonParse "42.5") |> err = Result.Error - "Can't parse JSON `42.5` as type `Int8` at path: `root`" + (Builtin.jsonParse "42.5") |> err + == Result.Error("Can't parse JSON `42.5` as type `Int8` at path: `root`") - (Builtin.jsonParse "\"42\n\"") |> err = Result.Error "Not JSON" + (Builtin.jsonParse "\"42\n\"") |> err == Result.Error("Not JSON") module UInt8 = module Basic = - Builtin.jsonSerialize 1uy = "1" - Builtin.jsonSerialize 123uy = "123" - Builtin.jsonSerialize 254uy = "254" + Builtin.jsonSerialize 1uy == "1" + Builtin.jsonSerialize 123uy == "123" + Builtin.jsonSerialize 254uy == "254" - Builtin.jsonParse "0" = Result.Ok 0uy - Builtin.jsonParse "0.0" = Result.Ok 0uy + Builtin.jsonParse "0" == Result.Ok(0uy) + Builtin.jsonParse "0.0" == Result.Ok(0uy) // TODO: is it ok that this parses as 0? - Builtin.jsonParse "-0.0" = Result.Ok 0uy - Builtin.jsonParse "1.2E2" = Result.Ok 120uy - Builtin.jsonParse "1.2E+2" = Result.Ok 120uy - Builtin.jsonParse "1200E-1" = Result.Ok 120uy + Builtin.jsonParse "-0.0" == Result.Ok(0uy) + Builtin.jsonParse "1.2E2" == Result.Ok(120uy) + Builtin.jsonParse "1.2E+2" == Result.Ok(120uy) + Builtin.jsonParse "1200E-1" == Result.Ok(120uy) module UInt8Limits = - Builtin.jsonSerialize 0uy = "0" - Builtin.jsonSerialize 255uy = "255" + Builtin.jsonSerialize 0uy == "0" + Builtin.jsonSerialize 255uy == "255" - Builtin.jsonParse "0" = Result.Ok 0uy - Builtin.jsonParse "255" = Result.Ok 255uy + Builtin.jsonParse "0" == Result.Ok(0uy) + Builtin.jsonParse "255" == Result.Ok(255uy) - (Builtin.jsonParse "-1") |> err = Result.Error - "Can't parse JSON `-1` as type `UInt8` at path: `root`" + (Builtin.jsonParse "-1") |> err + == Result.Error("Can't parse JSON `-1` as type `UInt8` at path: `root`") - (Builtin.jsonParse "256") |> err = Result.Error - "Can't parse JSON `256` as type `UInt8` at path: `root`" + (Builtin.jsonParse "256") |> err + == Result.Error("Can't parse JSON `256` as type `UInt8` at path: `root`") module Errors = - (Builtin.jsonParse " ") |> err = Result.Error "Not JSON" + (Builtin.jsonParse " ") |> err == Result.Error("Not JSON") - (Builtin.jsonParse "4a") |> err = Result.Error "Not JSON" + (Builtin.jsonParse "4a") |> err == Result.Error("Not JSON") - (Builtin.jsonParse "- 42") |> err = Result.Error "Not JSON" + (Builtin.jsonParse "- 42") |> err == Result.Error("Not JSON") - (Builtin.jsonParse "null") |> err = Result.Error - "Can't parse JSON `null` as type `UInt8` at path: `root`" + (Builtin.jsonParse "null") |> err + == Result.Error("Can't parse JSON `null` as type `UInt8` at path: `root`") - (Builtin.jsonParse "true") |> err = Result.Error - "Can't parse JSON `true` as type `UInt8` at path: `root`" + (Builtin.jsonParse "true") |> err + == Result.Error("Can't parse JSON `true` as type `UInt8` at path: `root`") - (Builtin.jsonParse "false") |> err = Result.Error - "Can't parse JSON `false` as type `UInt8` at path: `root`" + (Builtin.jsonParse "false") |> err + == Result.Error("Can't parse JSON `false` as type `UInt8` at path: `root`") - (Builtin.jsonParse "\"42\"") |> err = Result.Error - "Can't parse JSON `\"42\"` as type `UInt8` at path: `root`" + (Builtin.jsonParse "\"42\"") |> err + == Result.Error("Can't parse JSON `\"42\"` as type `UInt8` at path: `root`") - (Builtin.jsonParse "[42]") |> err = Result.Error - "Can't parse JSON `[42]` as type `UInt8` at path: `root`" + (Builtin.jsonParse "[42]") |> err + == Result.Error("Can't parse JSON `[42]` as type `UInt8` at path: `root`") - (Builtin.jsonParse "{ \"key\": 42 }") |> err = Result.Error - "Can't parse JSON `{ \"key\": 42 }` as type `UInt8` at path: `root`" + (Builtin.jsonParse "{ \"key\": 42 }") |> err + == Result.Error( "Can't parse JSON `{ \"key\": 42 }` as type `UInt8` at path: `root`") - (Builtin.jsonParse "42.5") |> err = Result.Error - "Can't parse JSON `42.5` as type `UInt8` at path: `root`" + (Builtin.jsonParse "42.5") |> err + == Result.Error("Can't parse JSON `42.5` as type `UInt8` at path: `root`") - (Builtin.jsonParse "\"42\n\"") |> err = Result.Error "Not JSON" + (Builtin.jsonParse "\"42\n\"") |> err == Result.Error("Not JSON") module Int16 = module Basic = - Builtin.jsonSerialize 0s = "0" - Builtin.jsonSerialize 123s = "123" - Builtin.jsonSerialize -123s = "-123" + Builtin.jsonSerialize 0s == "0" + Builtin.jsonSerialize 123s == "123" + Builtin.jsonSerialize -123s == "-123" - Builtin.jsonParse "0" = Result.Ok 0s + Builtin.jsonParse "0" == Result.Ok(0s) - Builtin.jsonParse "0.0" = Result.Ok 0s + Builtin.jsonParse "0.0" == Result.Ok(0s) - Builtin.jsonParse "-0.0" = Result.Ok 0s + Builtin.jsonParse "-0.0" == Result.Ok(0s) - Builtin.jsonParse "-1.0" = Result.Ok -1s + Builtin.jsonParse "-1.0" == Result.Ok(-1s) - Builtin.jsonParse "1.2E2" = Result.Ok 120s + Builtin.jsonParse "1.2E2" == Result.Ok(120s) - Builtin.jsonParse "1.2E+2" = Result.Ok 120s + Builtin.jsonParse "1.2E+2" == Result.Ok(120s) - Builtin.jsonParse "1200E-1" = Result.Ok 120s + Builtin.jsonParse "1200E-1" == Result.Ok(120s) module Int16Limits = - Builtin.jsonSerialize -32768s = "-32768" - Builtin.jsonSerialize 32767s = "32767" + Builtin.jsonSerialize -32768s == "-32768" + Builtin.jsonSerialize 32767s == "32767" - Builtin.jsonParse "-32768" = Result.Ok -32768s + Builtin.jsonParse "-32768" == Result.Ok(-32768s) - Builtin.jsonParse "32767" = Result.Ok 32767s + Builtin.jsonParse "32767" == Result.Ok(32767s) - (Builtin.jsonParse "-32769") |> err = Result.Error - "Can't parse JSON `-32769` as type `Int16` at path: `root`" + (Builtin.jsonParse "-32769") |> err + == Result.Error("Can't parse JSON `-32769` as type `Int16` at path: `root`") - (Builtin.jsonParse "32768") |> err = Result.Error - "Can't parse JSON `32768` as type `Int16` at path: `root`" + (Builtin.jsonParse "32768") |> err + == Result.Error("Can't parse JSON `32768` as type `Int16` at path: `root`") module Errors = - (Builtin.jsonParse " ") |> err = Result.Error "Not JSON" + (Builtin.jsonParse " ") |> err == Result.Error("Not JSON") - (Builtin.jsonParse "4a") |> err = Result.Error "Not JSON" + (Builtin.jsonParse "4a") |> err == Result.Error("Not JSON") - (Builtin.jsonParse "- 42") |> err = Result.Error "Not JSON" + (Builtin.jsonParse "- 42") |> err == Result.Error("Not JSON") - (Builtin.jsonParse "null") |> err = Result.Error - "Can't parse JSON `null` as type `Int16` at path: `root`" + (Builtin.jsonParse "null") |> err + == Result.Error("Can't parse JSON `null` as type `Int16` at path: `root`") - (Builtin.jsonParse "true") |> err = Result.Error - "Can't parse JSON `true` as type `Int16` at path: `root`" + (Builtin.jsonParse "true") |> err + == Result.Error("Can't parse JSON `true` as type `Int16` at path: `root`") - (Builtin.jsonParse "false") |> err = Result.Error - "Can't parse JSON `false` as type `Int16` at path: `root`" + (Builtin.jsonParse "false") |> err + == Result.Error("Can't parse JSON `false` as type `Int16` at path: `root`") - (Builtin.jsonParse "\"42\"") |> err = Result.Error - "Can't parse JSON `\"42\"` as type `Int16` at path: `root`" + (Builtin.jsonParse "\"42\"") |> err + == Result.Error("Can't parse JSON `\"42\"` as type `Int16` at path: `root`") - (Builtin.jsonParse "[42]") |> err = Result.Error - "Can't parse JSON `[42]` as type `Int16` at path: `root`" + (Builtin.jsonParse "[42]") |> err + == Result.Error("Can't parse JSON `[42]` as type `Int16` at path: `root`") - (Builtin.jsonParse "{ \"key\": 42 }") |> err = Result.Error - "Can't parse JSON `{ \"key\": 42 }` as type `Int16` at path: `root`" + (Builtin.jsonParse "{ \"key\": 42 }") |> err + == Result.Error( "Can't parse JSON `{ \"key\": 42 }` as type `Int16` at path: `root`") - (Builtin.jsonParse "42.5") |> err = Result.Error - "Can't parse JSON `42.5` as type `Int16` at path: `root`" + (Builtin.jsonParse "42.5") |> err + == Result.Error("Can't parse JSON `42.5` as type `Int16` at path: `root`") - (Builtin.jsonParse "\"42\n\"") |> err = Result.Error "Not JSON" + (Builtin.jsonParse "\"42\n\"") |> err == Result.Error("Not JSON") module UInt16 = module Basic = - Builtin.jsonSerialize 0us = "0" - Builtin.jsonSerialize 123us = "123" + Builtin.jsonSerialize 0us == "0" + Builtin.jsonSerialize 123us == "123" - Builtin.jsonParse "0" = Result.Ok 0us + Builtin.jsonParse "0" == Result.Ok(0us) - Builtin.jsonParse "0.0" = Result.Ok 0us + Builtin.jsonParse "0.0" == Result.Ok(0us) - Builtin.jsonParse "1.2E2" = Result.Ok 120us + Builtin.jsonParse "1.2E2" == Result.Ok(120us) - Builtin.jsonParse "1.2E+2" = Result.Ok 120us + Builtin.jsonParse "1.2E+2" == Result.Ok(120us) - Builtin.jsonParse "1200E-1" = Result.Ok 120us + Builtin.jsonParse "1200E-1" == Result.Ok(120us) module UInt16Limits = - Builtin.jsonSerialize 0us = "0" - Builtin.jsonSerialize 65535us = "65535" + Builtin.jsonSerialize 0us == "0" + Builtin.jsonSerialize 65535us == "65535" - Builtin.jsonParse "0" = Result.Ok 0us + Builtin.jsonParse "0" == Result.Ok(0us) - Builtin.jsonParse "65535" = Result.Ok 65535us + Builtin.jsonParse "65535" == Result.Ok(65535us) - (Builtin.jsonParse "-1") |> err = Result.Error - "Can't parse JSON `-1` as type `UInt16` at path: `root`" + (Builtin.jsonParse "-1") |> err + == Result.Error("Can't parse JSON `-1` as type `UInt16` at path: `root`") - (Builtin.jsonParse "65536") |> err = Result.Error - "Can't parse JSON `65536` as type `UInt16` at path: `root`" + (Builtin.jsonParse "65536") |> err + == Result.Error("Can't parse JSON `65536` as type `UInt16` at path: `root`") module Errors = - (Builtin.jsonParse " ") |> err = Result.Error "Not JSON" + (Builtin.jsonParse " ") |> err == Result.Error("Not JSON") - (Builtin.jsonParse "4a") |> err = Result.Error "Not JSON" + (Builtin.jsonParse "4a") |> err == Result.Error("Not JSON") - (Builtin.jsonParse "- 42") |> err = Result.Error "Not JSON" + (Builtin.jsonParse "- 42") |> err == Result.Error("Not JSON") - (Builtin.jsonParse "null") |> err = Result.Error - "Can't parse JSON `null` as type `UInt16` at path: `root`" + (Builtin.jsonParse "null") |> err + == Result.Error("Can't parse JSON `null` as type `UInt16` at path: `root`") - (Builtin.jsonParse "true") |> err = Result.Error - "Can't parse JSON `true` as type `UInt16` at path: `root`" + (Builtin.jsonParse "true") |> err + == Result.Error("Can't parse JSON `true` as type `UInt16` at path: `root`") - (Builtin.jsonParse "false") |> err = Result.Error - "Can't parse JSON `false` as type `UInt16` at path: `root`" + (Builtin.jsonParse "false") |> err + == Result.Error("Can't parse JSON `false` as type `UInt16` at path: `root`") - (Builtin.jsonParse "\"42\"") |> err = Result.Error - "Can't parse JSON `\"42\"` as type `UInt16` at path: `root`" + (Builtin.jsonParse "\"42\"") |> err + == Result.Error("Can't parse JSON `\"42\"` as type `UInt16` at path: `root`") - (Builtin.jsonParse "[42]") |> err = Result.Error - "Can't parse JSON `[42]` as type `UInt16` at path: `root`" + (Builtin.jsonParse "[42]") |> err + == Result.Error("Can't parse JSON `[42]` as type `UInt16` at path: `root`") - (Builtin.jsonParse "{ \"key\": 42 }") |> err = Result.Error - "Can't parse JSON `{ \"key\": 42 }` as type `UInt16` at path: `root`" + (Builtin.jsonParse "{ \"key\": 42 }") |> err + == Result.Error( "Can't parse JSON `{ \"key\": 42 }` as type `UInt16` at path: `root`") - (Builtin.jsonParse "42.5") |> err = Result.Error - "Can't parse JSON `42.5` as type `UInt16` at path: `root`" + (Builtin.jsonParse "42.5") |> err + == Result.Error("Can't parse JSON `42.5` as type `UInt16` at path: `root`") - (Builtin.jsonParse "\"42\n\"") |> err = Result.Error "Not JSON" + (Builtin.jsonParse "\"42\n\"") |> err == Result.Error("Not JSON") module Int32 = module Basic = - Builtin.jsonSerialize 0l = "0" - Builtin.jsonSerialize 123l = "123" - Builtin.jsonSerialize -123l = "-123" - - Builtin.jsonParse "0" = Result.Ok 0l - Builtin.jsonParse "0.0" = Result.Ok 0l - Builtin.jsonParse "-0.0" = Result.Ok 0l - Builtin.jsonParse "-1.0" = Result.Ok -1l - Builtin.jsonParse "1.2E2" = Result.Ok 120l - Builtin.jsonParse "1.2E+2" = Result.Ok 120l - Builtin.jsonParse "1200E-1" = Result.Ok 120l + Builtin.jsonSerialize 0l == "0" + Builtin.jsonSerialize 123l == "123" + Builtin.jsonSerialize -123l == "-123" + + Builtin.jsonParse "0" == Result.Ok(0l) + Builtin.jsonParse "0.0" == Result.Ok(0l) + Builtin.jsonParse "-0.0" == Result.Ok(0l) + Builtin.jsonParse "-1.0" == Result.Ok(-1l) + Builtin.jsonParse "1.2E2" == Result.Ok(120l) + Builtin.jsonParse "1.2E+2" == Result.Ok(120l) + Builtin.jsonParse "1200E-1" == Result.Ok(120l) module Int32Limits = - Builtin.jsonSerialize -2147483648l = "-2147483648" - Builtin.jsonSerialize 2147483647l = "2147483647" + Builtin.jsonSerialize -2147483648l == "-2147483648" + Builtin.jsonSerialize 2147483647l == "2147483647" - Builtin.jsonParse "-2147483648" = Result.Ok -2147483648l - Builtin.jsonParse "2147483647" = Result.Ok 2147483647l + Builtin.jsonParse "-2147483648" == Result.Ok(-2147483648l) + Builtin.jsonParse "2147483647" == Result.Ok(2147483647l) - (Builtin.jsonParse "-2147483649") |> err = Result.Error - "Can't parse JSON `-2147483649` as type `Int32` at path: `root`" + (Builtin.jsonParse "-2147483649") |> err + == Result.Error("Can't parse JSON `-2147483649` as type `Int32` at path: `root`") - (Builtin.jsonParse "2147483648") |> err = Result.Error - "Can't parse JSON `2147483648` as type `Int32` at path: `root`" + (Builtin.jsonParse "2147483648") |> err + == Result.Error("Can't parse JSON `2147483648` as type `Int32` at path: `root`") module Errors = - (Builtin.jsonParse " ") |> err = Result.Error "Not JSON" - (Builtin.jsonParse "4a") |> err = Result.Error "Not JSON" - (Builtin.jsonParse "- 42") |> err = Result.Error "Not JSON" + (Builtin.jsonParse " ") |> err == Result.Error("Not JSON") + (Builtin.jsonParse "4a") |> err == Result.Error("Not JSON") + (Builtin.jsonParse "- 42") |> err == Result.Error("Not JSON") - (Builtin.jsonParse "null") |> err = Result.Error - "Can't parse JSON `null` as type `Int32` at path: `root`" + (Builtin.jsonParse "null") |> err + == Result.Error("Can't parse JSON `null` as type `Int32` at path: `root`") - (Builtin.jsonParse "true") |> err = Result.Error - "Can't parse JSON `true` as type `Int32` at path: `root`" + (Builtin.jsonParse "true") |> err + == Result.Error("Can't parse JSON `true` as type `Int32` at path: `root`") - (Builtin.jsonParse "false") |> err = Result.Error - "Can't parse JSON `false` as type `Int32` at path: `root`" + (Builtin.jsonParse "false") |> err + == Result.Error("Can't parse JSON `false` as type `Int32` at path: `root`") - (Builtin.jsonParse "\"42\"") |> err = Result.Error - "Can't parse JSON `\"42\"` as type `Int32` at path: `root`" + (Builtin.jsonParse "\"42\"") |> err + == Result.Error("Can't parse JSON `\"42\"` as type `Int32` at path: `root`") - (Builtin.jsonParse "[42]") |> err = Result.Error - "Can't parse JSON `[42]` as type `Int32` at path: `root`" + (Builtin.jsonParse "[42]") |> err + == Result.Error("Can't parse JSON `[42]` as type `Int32` at path: `root`") - (Builtin.jsonParse "{ \"key\": 42 }") |> err = Result.Error - "Can't parse JSON `{ \"key\": 42 }` as type `Int32` at path: `root`" + (Builtin.jsonParse "{ \"key\": 42 }") |> err + == Result.Error( "Can't parse JSON `{ \"key\": 42 }` as type `Int32` at path: `root`") - (Builtin.jsonParse "42.5") |> err = Result.Error - "Can't parse JSON `42.5` as type `Int32` at path: `root`" + (Builtin.jsonParse "42.5") |> err + == Result.Error("Can't parse JSON `42.5` as type `Int32` at path: `root`") - (Builtin.jsonParse "\"42\n\"") |> err = Result.Error "Not JSON" + (Builtin.jsonParse "\"42\n\"") |> err == Result.Error("Not JSON") module UInt32 = module Basic = - Builtin.jsonSerialize 0ul = "0" - Builtin.jsonSerialize 123ul = "123" + Builtin.jsonSerialize 0ul == "0" + Builtin.jsonSerialize 123ul == "123" - Builtin.jsonParse "0" = Result.Ok 0ul - Builtin.jsonParse "0.0" = Result.Ok 0ul - Builtin.jsonParse "-0.0" = Result.Ok 0ul - Builtin.jsonParse "1.2E2" = Result.Ok 120ul - Builtin.jsonParse "1.2E+2" = Result.Ok 120ul - Builtin.jsonParse "1200E-1" = Result.Ok 120ul + Builtin.jsonParse "0" == Result.Ok(0ul) + Builtin.jsonParse "0.0" == Result.Ok(0ul) + Builtin.jsonParse "-0.0" == Result.Ok(0ul) + Builtin.jsonParse "1.2E2" == Result.Ok(120ul) + Builtin.jsonParse "1.2E+2" == Result.Ok(120ul) + Builtin.jsonParse "1200E-1" == Result.Ok(120ul) module UInt32Limits = - Builtin.jsonSerialize 0ul = "0" - Builtin.jsonSerialize 4294967295ul = "4294967295" + Builtin.jsonSerialize 0ul == "0" + Builtin.jsonSerialize 4294967295ul == "4294967295" - Builtin.jsonParse "0" = Result.Ok 0ul - Builtin.jsonParse "4294967295" = Result.Ok 4294967295ul + Builtin.jsonParse "0" == Result.Ok(0ul) + Builtin.jsonParse "4294967295" == Result.Ok(4294967295ul) - (Builtin.jsonParse "-1") |> err = Result.Error - "Can't parse JSON `-1` as type `UInt32` at path: `root`" + (Builtin.jsonParse "-1") |> err + == Result.Error("Can't parse JSON `-1` as type `UInt32` at path: `root`") - (Builtin.jsonParse "4294967296") |> err = Result.Error - "Can't parse JSON `4294967296` as type `UInt32` at path: `root`" + (Builtin.jsonParse "4294967296") |> err + == Result.Error("Can't parse JSON `4294967296` as type `UInt32` at path: `root`") module Errors = - (Builtin.jsonParse " ") |> err = Result.Error "Not JSON" - (Builtin.jsonParse "4a") |> err = Result.Error "Not JSON" - (Builtin.jsonParse "- 42") |> err = Result.Error "Not JSON" + (Builtin.jsonParse " ") |> err == Result.Error("Not JSON") + (Builtin.jsonParse "4a") |> err == Result.Error("Not JSON") + (Builtin.jsonParse "- 42") |> err == Result.Error("Not JSON") - (Builtin.jsonParse "null") |> err = Result.Error - "Can't parse JSON `null` as type `UInt32` at path: `root`" + (Builtin.jsonParse "null") |> err + == Result.Error("Can't parse JSON `null` as type `UInt32` at path: `root`") - (Builtin.jsonParse "true") |> err = Result.Error - "Can't parse JSON `true` as type `UInt32` at path: `root`" + (Builtin.jsonParse "true") |> err + == Result.Error("Can't parse JSON `true` as type `UInt32` at path: `root`") - (Builtin.jsonParse "false") |> err = Result.Error - "Can't parse JSON `false` as type `UInt32` at path: `root`" + (Builtin.jsonParse "false") |> err + == Result.Error("Can't parse JSON `false` as type `UInt32` at path: `root`") - (Builtin.jsonParse "\"42\"") |> err = Result.Error - "Can't parse JSON `\"42\"` as type `UInt32` at path: `root`" + (Builtin.jsonParse "\"42\"") |> err + == Result.Error("Can't parse JSON `\"42\"` as type `UInt32` at path: `root`") - (Builtin.jsonParse "[42]") |> err = Result.Error - "Can't parse JSON `[42]` as type `UInt32` at path: `root`" + (Builtin.jsonParse "[42]") |> err + == Result.Error("Can't parse JSON `[42]` as type `UInt32` at path: `root`") - (Builtin.jsonParse "{ \"key\": 42 }") |> err = Result.Error - "Can't parse JSON `{ \"key\": 42 }` as type `UInt32` at path: `root`" + (Builtin.jsonParse "{ \"key\": 42 }") |> err + == Result.Error("Can't parse JSON `{ \"key\": 42 }` as type `UInt32` at path: `root`") - (Builtin.jsonParse "42.5") |> err = Result.Error - "Can't parse JSON `42.5` as type `UInt32` at path: `root`" + (Builtin.jsonParse "42.5") |> err + == Result.Error("Can't parse JSON `42.5` as type `UInt32` at path: `root`") - (Builtin.jsonParse "\"42\n\"") |> err = Result.Error "Not JSON" + (Builtin.jsonParse "\"42\n\"") |> err == Result.Error("Not JSON") module Int128 = module Basic = - Builtin.jsonSerialize 0Q = "0" - Builtin.jsonSerialize 12345Q = "12345" - Builtin.jsonSerialize -12345Q = "-12345" - Builtin.jsonParse "0" = Result.Ok 0Q - Builtin.jsonParse "0.0" = Result.Ok 0Q - Builtin.jsonParse "-0.0" = Result.Ok 0Q - Builtin.jsonParse "-1.0" = Result.Ok(-1Q) - Builtin.jsonParse "1.2E2" = Result.Ok 120Q - Builtin.jsonParse "1.2E+2" = Result.Ok 120Q - Builtin.jsonParse "1200E-1" = Result.Ok 120Q + Builtin.jsonSerialize 0Q == "0" + Builtin.jsonSerialize 12345Q == "12345" + Builtin.jsonSerialize -12345Q == "-12345" + Builtin.jsonParse "0" == Result.Ok(0Q) + Builtin.jsonParse "0.0" == Result.Ok(0Q) + Builtin.jsonParse "-0.0" == Result.Ok(0Q) + Builtin.jsonParse "-1.0" == Result.Ok(-1Q) + Builtin.jsonParse "1.2E2" == Result.Ok(120Q) + Builtin.jsonParse "1.2E+2" == Result.Ok(120Q) + Builtin.jsonParse "1200E-1" == Result.Ok(120Q) module Int128Limits = - Builtin.jsonSerialize -170141183460469231731687303715884105728Q = "-170141183460469231731687303715884105728" - Builtin.jsonSerialize 170141183460469231731687303715884105727Q = "170141183460469231731687303715884105727" + Builtin.jsonSerialize -170141183460469231731687303715884105728Q + == "-170141183460469231731687303715884105728" - Builtin.jsonParse "-170141183460469231731687303715884105728" = Result.Ok - -170141183460469231731687303715884105728Q + Builtin.jsonSerialize 170141183460469231731687303715884105727Q + == "170141183460469231731687303715884105727" - Builtin.jsonParse "170141183460469231731687303715884105727" = Result.Ok - 170141183460469231731687303715884105727Q + Builtin.jsonParse "-170141183460469231731687303715884105728" + == Result.Ok(-170141183460469231731687303715884105728Q) + + Builtin.jsonParse "170141183460469231731687303715884105727" + == Result.Ok(170141183460469231731687303715884105727Q) // First number that doesn't fit in an Int128 - (Builtin.jsonParse "170141183460469231731687303715884105728") |> err = Result.Error - "Can't parse JSON `170141183460469231731687303715884105728` as type `Int128` at path: `root`" + (Builtin.jsonParse "170141183460469231731687303715884105728") |> err + == Result.Error("Can't parse JSON `170141183460469231731687303715884105728` as type `Int128` at path: `root`") // This is a float that is a valid Int128 - Builtin.jsonParse "1.7E38" = Result.Ok - 169999999999999998061923293023115935744Q + Builtin.jsonParse "1.7E38" + == Result.Ok(169999999999999998061923293023115935744Q) // This is a float that is slightly above the Int128 max - (Builtin.jsonParse "1.8E38") |> err = Result.Error - "Can't parse JSON `1.8E38` as type `Int128` at path: `root`" + (Builtin.jsonParse "1.8E38") |> err + == Result.Error("Can't parse JSON `1.8E38` as type `Int128` at path: `root`") // A large negative number that is within Int128 range - Builtin.jsonParse "-1.7E38" = Result.Ok - -169999999999999998061923293023115935744Q + Builtin.jsonParse "-1.7E38" + == Result.Ok(-169999999999999998061923293023115935744Q) // A negative number that is too small for Int128 - (Builtin.jsonParse "-1.8E38") |> err = Result.Error - "Can't parse JSON `-1.8E38` as type `Int128` at path: `root`" + (Builtin.jsonParse "-1.8E38") |> err + == Result.Error("Can't parse JSON `-1.8E38` as type `Int128` at path: `root`") module Errors = - (Builtin.jsonParse " ") |> err = Result.Error "Not JSON" - (Builtin.jsonParse "4a") |> err = Result.Error "Not JSON" - (Builtin.jsonParse "- 42") |> err = Result.Error "Not JSON" + (Builtin.jsonParse " ") |> err == Result.Error("Not JSON") + (Builtin.jsonParse "4a") |> err == Result.Error("Not JSON") + (Builtin.jsonParse "- 42") |> err == Result.Error("Not JSON") - (Builtin.jsonParse "null") |> err = Result.Error - "Can't parse JSON `null` as type `Int128` at path: `root`" + (Builtin.jsonParse "null") |> err + == Result.Error("Can't parse JSON `null` as type `Int128` at path: `root`") - (Builtin.jsonParse "true") |> err = Result.Error - "Can't parse JSON `true` as type `Int128` at path: `root`" + (Builtin.jsonParse "true") |> err + == Result.Error("Can't parse JSON `true` as type `Int128` at path: `root`") - (Builtin.jsonParse "false") |> err = Result.Error - "Can't parse JSON `false` as type `Int128` at path: `root`" + (Builtin.jsonParse "false") |> err + == Result.Error("Can't parse JSON `false` as type `Int128` at path: `root`") - (Builtin.jsonParse "\"42\"") |> err = Result.Error - "Can't parse JSON `\"42\"` as type `Int128` at path: `root`" + (Builtin.jsonParse "\"42\"") |> err + == Result.Error("Can't parse JSON `\"42\"` as type `Int128` at path: `root`") - (Builtin.jsonParse "[42]") |> err = Result.Error - "Can't parse JSON `[42]` as type `Int128` at path: `root`" + (Builtin.jsonParse "[42]") |> err + == Result.Error("Can't parse JSON `[42]` as type `Int128` at path: `root`") - (Builtin.jsonParse "{ \"key\": 42 }") |> err = Result.Error - "Can't parse JSON `{ \"key\": 42 }` as type `Int128` at path: `root`" + (Builtin.jsonParse "{ \"key\": 42 }") |> err + == Result.Error("Can't parse JSON `{ \"key\": 42 }` as type `Int128` at path: `root`") - (Builtin.jsonParse "42.5") |> err = Result.Error - "Can't parse JSON `42.5` as type `Int128` at path: `root`" + (Builtin.jsonParse "42.5") |> err + == Result.Error("Can't parse JSON `42.5` as type `Int128` at path: `root`") - (Builtin.jsonParse "\"42\n\"") |> err = Result.Error "Not JSON" + (Builtin.jsonParse "\"42\n\"") |> err == Result.Error("Not JSON") // (-1.7014118346046923E+38) this result is out of range for Int128 and is wrapped around to the min value - Builtin.jsonParse "-170141183460469231731687303715884105800" = Result.Ok - -170141183460469231731687303715884105728Q + Builtin.jsonParse "-170141183460469231731687303715884105800" + == Result.Ok(-170141183460469231731687303715884105728Q) - (Builtin.jsonParse "170141183460469231731687303715884105800") |> err = Result.Error - "Can't parse JSON `170141183460469231731687303715884105800` as type `Int128` at path: `root`" + (Builtin.jsonParse "170141183460469231731687303715884105800") |> err + == Result.Error + ("Can't parse JSON `170141183460469231731687303715884105800` as type `Int128` at path: `root`") module UInt128 = module Basic = - Builtin.jsonSerialize 0Z = "0" - Builtin.jsonSerialize 12345Z = "12345" - Builtin.jsonParse "0" = Result.Ok 0Z - Builtin.jsonParse "0.0" = Result.Ok 0Z - Builtin.jsonParse "-0.0" = Result.Ok 0Z - Builtin.jsonParse "1.2E2" = Result.Ok 120Z - Builtin.jsonParse "1.2E+2" = Result.Ok 120Z - Builtin.jsonParse "1200E-1" = Result.Ok 120Z + Builtin.jsonSerialize 0Z == "0" + Builtin.jsonSerialize 12345Z == "12345" + Builtin.jsonParse "0" == Result.Ok(0Z) + Builtin.jsonParse "0.0" == Result.Ok(0Z) + Builtin.jsonParse "-0.0" == Result.Ok(0Z) + Builtin.jsonParse "1.2E2" == Result.Ok(120Z) + Builtin.jsonParse "1.2E+2" == Result.Ok(120Z) + Builtin.jsonParse "1200E-1" == Result.Ok(120Z) module UInt128Limits = - Builtin.jsonSerialize 0Z = "0" + Builtin.jsonSerialize 0Z == "0" - Builtin.jsonParse "340282366920938463463374607431768211455" = Result.Ok - 340282366920938463463374607431768211455Z + Builtin.jsonParse "340282366920938463463374607431768211455" + == Result.Ok(340282366920938463463374607431768211455Z) // First number that doesn't fit in a UInt128 - (Builtin.jsonParse "340282366920938463463374607431768211456") |> err = Result.Error - "Can't parse JSON `340282366920938463463374607431768211456` as type `UInt128` at path: `root`" + (Builtin.jsonParse "340282366920938463463374607431768211456") |> err + == Result.Error + ("Can't parse JSON `340282366920938463463374607431768211456` as type `UInt128` at path: `root`") // This is a large number that is a valid UInt128 - Builtin.jsonParse "3.4E38" = Result.Ok - 339999999999999996123846586046231871488Z + Builtin.jsonParse "3.4E38" + == Result.Ok(339999999999999996123846586046231871488Z) // This is a number that is slightly above the UInt128 max - (Builtin.jsonParse "3.5E38") |> err = Result.Error - "Can't parse JSON `3.5E38` as type `UInt128` at path: `root`" + (Builtin.jsonParse "3.5E38") |> err + == Result.Error("Can't parse JSON `3.5E38` as type `UInt128` at path: `root`") - (Builtin.jsonParse "-1") |> err = Result.Error - "Can't parse JSON `-1` as type `UInt128` at path: `root`" + (Builtin.jsonParse "-1") |> err + == Result.Error("Can't parse JSON `-1` as type `UInt128` at path: `root`") module Errors = - (Builtin.jsonParse " ") |> err = Result.Error "Not JSON" - (Builtin.jsonParse "4a") |> err = Result.Error "Not JSON" - (Builtin.jsonParse "- 42") |> err = Result.Error "Not JSON" + (Builtin.jsonParse " ") |> err == Result.Error("Not JSON") + (Builtin.jsonParse "4a") |> err == Result.Error("Not JSON") + (Builtin.jsonParse "- 42") |> err == Result.Error("Not JSON") - (Builtin.jsonParse "null") |> err = Result.Error - "Can't parse JSON `null` as type `UInt128` at path: `root`" + (Builtin.jsonParse "null") |> err + == Result.Error("Can't parse JSON `null` as type `UInt128` at path: `root`") - (Builtin.jsonParse "true") |> err = Result.Error - "Can't parse JSON `true` as type `UInt128` at path: `root`" + (Builtin.jsonParse "true") |> err + == Result.Error("Can't parse JSON `true` as type `UInt128` at path: `root`") - (Builtin.jsonParse "false") |> err = Result.Error - "Can't parse JSON `false` as type `UInt128` at path: `root`" + (Builtin.jsonParse "false") |> err + == Result.Error("Can't parse JSON `false` as type `UInt128` at path: `root`") - (Builtin.jsonParse "\"42\"") |> err = Result.Error - "Can't parse JSON `\"42\"` as type `UInt128` at path: `root`" + (Builtin.jsonParse "\"42\"") |> err + == Result.Error("Can't parse JSON `\"42\"` as type `UInt128` at path: `root`") - (Builtin.jsonParse "[42]") |> err = Result.Error - "Can't parse JSON `[42]` as type `UInt128` at path: `root`" + (Builtin.jsonParse "[42]") |> err + == Result.Error("Can't parse JSON `[42]` as type `UInt128` at path: `root`") - (Builtin.jsonParse "{ \"key\": 42 }") |> err = Result.Error - "Can't parse JSON `{ \"key\": 42 }` as type `UInt128` at path: `root`" + (Builtin.jsonParse "{ \"key\": 42 }") |> err + == Result.Error("Can't parse JSON `{ \"key\": 42 }` as type `UInt128` at path: `root`") - (Builtin.jsonParse "42.5") |> err = Result.Error - "Can't parse JSON `42.5` as type `UInt128` at path: `root`" + (Builtin.jsonParse "42.5") |> err + == Result.Error("Can't parse JSON `42.5` as type `UInt128` at path: `root`") - (Builtin.jsonParse "\"42\n\"") |> err = Result.Error "Not JSON" + (Builtin.jsonParse "\"42\n\"") |> err == Result.Error("Not JSON") - (Builtin.jsonParse "340282366920938463463374607431768211456") |> err = Result.Error - "Can't parse JSON `340282366920938463463374607431768211456` as type `UInt128` at path: `root`" + (Builtin.jsonParse "340282366920938463463374607431768211456") |> err + == Result.Error("Can't parse JSON `340282366920938463463374607431768211456` as type `UInt128` at path: `root`") -module Float = +module Float = // all of these work // TODO: test the upper/lower bounds // TODO: test highly-precise numbers // TODO: review Float.tests for more values to test against - Builtin.jsonSerialize 0.0 = "0.0" - Builtin.jsonSerialize 1.0 = "1.0" - Builtin.jsonSerialize 0.1 = "0.1" + Builtin.jsonSerialize 0.0 == "0.0" + Builtin.jsonSerialize 1.0 == "1.0" + Builtin.jsonSerialize 0.1 == "0.1" - Builtin.jsonSerialize (2.0 / 3.0) = "0.6666666666666666" + Builtin.jsonSerialize (2.0 / 3.0) == "0.6666666666666666" - Builtin.jsonSerialize 12345.67890 = "12345.6789" - Builtin.jsonSerialize -12345.67890 = "-12345.6789" + Builtin.jsonSerialize 12345.67890 == "12345.6789" + Builtin.jsonSerialize -12345.67890 == "-12345.6789" // ints as floats - Builtin.jsonParse "0.0" = Result.Ok 0.0 - Builtin.jsonParse "0" = Result.Ok 0.0 - Builtin.jsonParse "123" = Result.Ok 123.0 + Builtin.jsonParse "0.0" == Result.Ok(0.0) + Builtin.jsonParse "0" == Result.Ok(0.0) + Builtin.jsonParse "123" == Result.Ok(123.0) - Builtin.jsonParse "12345.67890" = Result.Ok 12345.67890 + Builtin.jsonParse "12345.67890" == Result.Ok(12345.67890) - Builtin.jsonParse "-12345.67890" = Result.Ok -12345.67890 + Builtin.jsonParse "-12345.67890" == Result.Ok(-12345.67890) - Builtin.jsonParse " 42.0 " = Result.Ok 42.0 - Builtin.jsonParse " -42.0 " = Result.Ok -42.0 - Builtin.jsonParse "1e3" = Result.Ok 1000.0 - Builtin.jsonParse "-1e3" = Result.Ok -1000.0 + Builtin.jsonParse " 42.0 " == Result.Ok(42.0) + Builtin.jsonParse " -42.0 " == Result.Ok(-42.0) + Builtin.jsonParse "1e3" == Result.Ok(1000.0) + Builtin.jsonParse "-1e3" == Result.Ok(-1000.0) - Builtin.jsonSerialize 3.14159265358979323846 = "3.141592653589793" + Builtin.jsonSerialize 3.14159265358979323846 == "3.141592653589793" - Builtin.jsonSerialize 1.618033988749895 = "1.618033988749895" + Builtin.jsonSerialize 1.618033988749895 == "1.618033988749895" - Builtin.jsonParse "1.0000001" = Result.Ok 1.0000001 + Builtin.jsonParse "1.0000001" == Result.Ok(1.0000001) - Builtin.jsonParse "-1.00000001" = Result.Ok -1.00000001 + Builtin.jsonParse "-1.00000001" == Result.Ok(-1.00000001) - Builtin.jsonParse "-2147483647.8" = Result.Ok -2147483647.8 + Builtin.jsonParse "-2147483647.8" == Result.Ok(-2147483647.8) - Builtin.jsonParse "17.55042081" = Result.Ok 17.55042081 + Builtin.jsonParse "17.55042081" == Result.Ok(17.55042081) - Builtin.jsonParse "2147483647.000009" = Result.Ok 2147483647.000009 + Builtin.jsonParse "2147483647.000009" == Result.Ok(2147483647.000009) - Builtin.jsonParse "-2367.9267" = Result.Ok -2367.9267 + Builtin.jsonParse "-2367.9267" == Result.Ok(-2367.9267) - Builtin.jsonParse "0.6999999999999999555910790149937383830547332763671875" = Result.Ok - 0.6999999999999999555910790149937383830547332763671875 + Builtin.jsonParse "0.6999999999999999555910790149937383830547332763671875" + == Result.Ok(0.6999999999999999555910790149937383830547332763671875) - Builtin.jsonParse "0.7999999999" = Result.Ok 0.7999999999 + Builtin.jsonParse "0.7999999999" == Result.Ok(0.7999999999) - module Constants = - Builtin.jsonSerialize Builtin.testNegativeInfinity_v0 = "\"-Infinity\"" - Builtin.jsonParse "\"-Infinity\"" = Result.Ok - Builtin.testNegativeInfinity_v0 +module Constants = + Builtin.jsonSerialize Builtin.testNegativeInfinity == "\"-Infinity\"" - Builtin.jsonSerialize Builtin.testInfinity_v0 = "\"Infinity\"" + Builtin.jsonParse "\"-Infinity\"" + == Result.Ok(Builtin.testNegativeInfinity) - Builtin.jsonParse "\"Infinity\"" = Result.Ok Builtin.testInfinity_v0 + Builtin.jsonSerialize Builtin.testInfinity == "\"Infinity\"" - Builtin.jsonSerialize Builtin.testNan_v0 = "\"NaN\"" + Builtin.jsonParse "\"Infinity\"" == Result.Ok(Builtin.testInfinity) - Builtin.jsonParse "\"NaN\"" = Result.Ok Builtin.testNan_v0 + Builtin.jsonSerialize Builtin.testNan == "\"NaN\"" + Builtin.jsonParse "\"NaN\"" == Result.Ok(Builtin.testNan) module Errors = - (Builtin.jsonParse "e") |> err = Result.Error "Not JSON" + (Builtin.jsonParse "e") |> err == Result.Error("Not JSON") - (Builtin.jsonParse "pi") |> err = Result.Error "Not JSON" + (Builtin.jsonParse "pi") |> err == Result.Error("Not JSON") - (Builtin.jsonParse " -42 . 0 ") |> err = Result.Error "Not JSON" + (Builtin.jsonParse " -42 . 0 ") |> err == Result.Error("Not JSON") - (Builtin.jsonParse "0") |> err = Result.Ok 0.0 + (Builtin.jsonParse "0") |> err == Result.Ok(0.0) - (Builtin.jsonParse " ") |> err = Result.Error "Not JSON" + (Builtin.jsonParse " ") |> err == Result.Error("Not JSON") - (Builtin.jsonParse "4a") |> err = Result.Error "Not JSON" + (Builtin.jsonParse "4a") |> err == Result.Error("Not JSON") - (Builtin.jsonParse "- 42.0") |> err = Result.Error "Not JSON" + (Builtin.jsonParse "- 42.0") |> err == Result.Error("Not JSON") - (Builtin.jsonParse "-141s") |> err = Result.Error "Not JSON" + (Builtin.jsonParse "-141s") |> err == Result.Error("Not JSON") - (Builtin.jsonParse "null") |> err = Result.Error - "Can't parse JSON `null` as type `Float` at path: `root`" + (Builtin.jsonParse "null") |> err + == Result.Error("Can't parse JSON `null` as type `Float` at path: `root`") - (Builtin.jsonParse "true") |> err = Result.Error - "Can't parse JSON `true` as type `Float` at path: `root`" + (Builtin.jsonParse "true") |> err + == Result.Error("Can't parse JSON `true` as type `Float` at path: `root`") - (Builtin.jsonParse "false") |> err = Result.Error - "Can't parse JSON `false` as type `Float` at path: `root`" + (Builtin.jsonParse "false") |> err + == Result.Error("Can't parse JSON `false` as type `Float` at path: `root`") - (Builtin.jsonParse "\"42\"") |> err = Result.Error - "Can't parse JSON `\"42\"` as type `Float` at path: `root`" + (Builtin.jsonParse "\"42\"") |> err + == Result.Error("Can't parse JSON `\"42\"` as type `Float` at path: `root`") - (Builtin.jsonParse "[42]") |> err = Result.Error - "Can't parse JSON `[42]` as type `Float` at path: `root`" + (Builtin.jsonParse "[42]") |> err + == Result.Error("Can't parse JSON `[42]` as type `Float` at path: `root`") - (Builtin.jsonParse "{ \"key\": 42 }") |> err = Result.Error - "Can't parse JSON `{ \"key\": 42 }` as type `Float` at path: `root`" + (Builtin.jsonParse "{ \"key\": 42 }") |> err + == Result.Error("Can't parse JSON `{ \"key\": 42 }` as type `Float` at path: `root`") - (Builtin.jsonParse "\"42\n\"") |> err = Result.Error "Not JSON" + (Builtin.jsonParse "\"42\n\"") |> err == Result.Error("Not JSON") - (Builtin.jsonParse "000000.9") |> err = Result.Error "Not JSON" + (Builtin.jsonParse "000000.9") |> err == Result.Error("Not JSON") - (Builtin.jsonParse "-000000.9") |> err = Result.Error "Not JSON" + (Builtin.jsonParse "-000000.9") |> err == Result.Error("Not JSON") - (Builtin.jsonParse "-00000000.000") |> err = Result.Error "Not JSON" + (Builtin.jsonParse "-00000000.000") |> err == Result.Error("Not JSON") - (Builtin.jsonParse "00000000.000") |> err = Result.Error "Not JSON" + (Builtin.jsonParse "00000000.000") |> err == Result.Error("Not JSON") // This tests that we get a Result.Error when trying to parse a string, not an // internal exception - (Builtin.jsonParse "\"65.0\"") |> err = Result.Error - "Can't parse JSON `\"65.0\"` as type `Float` at path: `root`" + (Builtin.jsonParse "\"65.0\"") |> err + == Result.Error("Can't parse JSON `\"65.0\"` as type `Float` at path: `root`") @@ -844,78 +847,82 @@ module Char = let charFromString (s: String) : Char = (Stdlib.String.head s) |> Builtin.unwrap - Builtin.jsonSerialize 'a' = "\"a\"" - Builtin.jsonParse "\"a\"" = Result.Ok 'a' + Builtin.jsonSerialize 'a' == "\"a\"" + Builtin.jsonParse "\"a\"" == Result.Ok('a') module SimpleEmoji = - Builtin.jsonSerialize ("😂" |> charFromString) = "\"\\uD83D\\uDE02\"" + // Builtin.jsonSerialize ("😂" |> charFromString) == "\"\\uD83D\\uDE02\"" - Builtin.jsonParse "\"😂\"" = Result.Ok(charFromString "😂") - Builtin.jsonParse "\"\\uD83D\\uDE02\"" = Result.Ok(charFromString "😂") + Builtin.jsonParse "\"😂\"" == Result.Ok(charFromString "😂") + // Builtin.jsonParse "\"\\uD83D\\uDE02\"" == Result.Ok(charFromString "😂") module ComplexEmoji = - Builtin.jsonSerialize (charFromString "👩‍👩‍👧‍👦") = "\"\\uD83D\\uDC69‍\\uD83D\\uDC69‍\\uD83D\\uDC67‍\\uD83D\\uDC66\"" + // Builtin.jsonSerialize (charFromString "👩‍👩‍👧‍👦") + // == "\"\\uD83D\\uDC69‍\\uD83D\\uDC69‍\\uD83D\\uDC67‍\\uD83D\\uDC66\"" - Builtin.jsonParse - "\"\\uD83D\\uDC69‍\\uD83D\\uDC69‍\\uD83D\\uDC67‍\\uD83D\\uDC66\"" = Result.Ok( - charFromString "👩‍👩‍👧‍👦" - ) + // Builtin.jsonParse + // "\"\\uD83D\\uDC69‍\\uD83D\\uDC69‍\\uD83D\\uDC67‍\\uD83D\\uDC66\"" + // == Result.Ok(charFromString "👩‍👩‍👧‍👦") - Builtin.jsonParse "\"👩‍👩‍👧‍👦\"" = Result.Ok( - "👩‍👩‍👧‍👦" |> charFromString - ) + Builtin.jsonParse "\"👩‍👩‍👧‍👦\"" + == Result.Ok("👩‍👩‍👧‍👦" |> charFromString) - Builtin.jsonSerialize (charFromString "Ł") = "\"Ł\"" - Builtin.jsonParse "\"Ł\"" = Result.Ok 'Ł' + Builtin.jsonSerialize (charFromString "Ł") == "\"Ł\"" + Builtin.jsonParse "\"Ł\"" == Result.Ok('Ł') module Errors = - (Builtin.jsonParse "\"test\"") |> err = Result.Error - "Can't parse JSON `\"test\"` as type `Char` at path: `root`" + (Builtin.jsonParse "\"test\"") |> err + == Result.Error("Can't parse JSON `\"test\"` as type `Char` at path: `root`") - (Builtin.jsonParse "\"\"") |> err = Result.Error - "Can't parse JSON `\"\"` as type `Char` at path: `root`" + (Builtin.jsonParse "\"\"") |> err + == Result.Error("Can't parse JSON `\"\"` as type `Char` at path: `root`") - (Builtin.jsonParse "62") |> err = Result.Error - "Can't parse JSON `62` as type `Char` at path: `root`" + (Builtin.jsonParse "62") |> err + == Result.Error("Can't parse JSON `62` as type `Char` at path: `root`") module String = - Builtin.jsonSerialize "abc" = "\"abc\"" - Builtin.jsonParse "\"abc\"" = Result.Ok "abc" + Builtin.jsonSerialize "abc" == "\"abc\"" + Builtin.jsonParse "\"abc\"" == Result.Ok("abc") - Builtin.jsonSerialize "" = "\"\"" - Builtin.jsonParse "\"\"" = Result.Ok "" + Builtin.jsonSerialize "" == "\"\"" + Builtin.jsonParse "\"\"" == Result.Ok("") - Builtin.jsonSerialize "żółw" = "\"żółw\"" - Builtin.jsonParse "\"żółw\"" = Result.Ok "żółw" + Builtin.jsonSerialize "żółw" == "\"żółw\"" + Builtin.jsonParse "\"żółw\"" == Result.Ok("żółw") - Builtin.jsonSerialize "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" = "\"\\uD83D\\uDC68‍❤️‍\\uD83D\\uDC8B‍\\uD83D\\uDC68\\uD83D\\uDC69‍\\uD83D\\uDC69‍\\uD83D\\uDC67‍\\uD83D\\uDC66\\uD83C\\uDFF3️‍⚧️‍️\\uD83C\\uDDF5\\uD83C\\uDDF7\"" + // Builtin.jsonSerialize "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" + // == "\"\\uD83D\\uDC68‍❤️‍\\uD83D\\uDC8B‍\\uD83D\\uDC68\\uD83D\\uDC69‍\\uD83D\\uDC69‍\\uD83D\\uDC67‍\\uD83D\\uDC66\\uD83C\\uDFF3️‍⚧️‍️\\uD83C\\uDDF5\\uD83C\\uDDF7\"" - Builtin.jsonParse "\"👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷\"" = Result.Ok - "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" + Builtin.jsonParse "\"👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷\"" + == Result.Ok("👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷") - Builtin.jsonSerialize "👩‍👩‍👧‍👦" = "\"\\uD83D\\uDC69‍\\uD83D\\uDC69‍\\uD83D\\uDC67‍\\uD83D\\uDC66\"" + // Builtin.jsonSerialize "👩‍👩‍👧‍👦" + // == "\"\\uD83D\\uDC69‍\\uD83D\\uDC69‍\\uD83D\\uDC67‍\\uD83D\\uDC66\"" - Builtin.jsonParse "\"👩‍👩‍👧‍👦\"" = Result.Ok "👩‍👩‍👧‍👦" + Builtin.jsonParse "\"👩‍👩‍👧‍👦\"" == Result.Ok("👩‍👩‍👧‍👦") - Builtin.jsonParse - "\"\\uD83D\\uDC69‍\\uD83D\\uDC69‍\\uD83D\\uDC67‍\\uD83D\\uDC66\"" = Result.Ok - "👩‍👩‍👧‍👦" + // Builtin.jsonParse + // "\"\\uD83D\\uDC69‍\\uD83D\\uDC69‍\\uD83D\\uDC67‍\\uD83D\\uDC66\"" + // == Result.Ok("👩‍👩‍👧‍👦") Builtin.jsonSerialize - "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor." = "\"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor.\"" + "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor." + == "\"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor.\"" Builtin.jsonParse - "\"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor.\"" = Result.Ok - "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor." + "\"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor.\"" + == Result.Ok + ("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor.") - Builtin.jsonSerialize (Stdlib.String.repeat_v0 "a" 100L) = "\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"" + Builtin.jsonSerialize (Stdlib.String.repeat "a" 100L) + == "\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"" Builtin.jsonParse - "\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"" = Result - .Ok(Stdlib.String.repeat_v0 "a" 100L) + "\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"" + == Result.Ok(Stdlib.String.repeat "a" 100L) module DateTime = @@ -923,72 +930,75 @@ module DateTime = (Stdlib.DateTime.parse datestr) |> Builtin.unwrap // now-ish - Builtin.jsonSerialize (d "2023-07-28T22:42:36Z") = "\"2023-07-28T22:42:36Z\"" + Builtin.jsonSerialize (d "2023-07-28T22:42:36Z") + == "\"2023-07-28T22:42:36Z\"" - Builtin.jsonParse "\"2023-07-28T22:42:36Z\"" = Result.Ok( - d "2023-07-28T22:42:36Z" - ) + Builtin.jsonParse "\"2023-07-28T22:42:36Z\"" + == Result.Ok(d "2023-07-28T22:42:36Z") // epoch - Builtin.jsonSerialize (d "1969-07-28T22:42:36Z") = "\"1969-07-28T22:42:36Z\"" + Builtin.jsonSerialize (d "1969-07-28T22:42:36Z") + == "\"1969-07-28T22:42:36Z\"" - Builtin.jsonParse "\"1969-07-28T22:42:36Z\"" = Result.Ok( - d "1969-07-28T22:42:36Z" - ) + Builtin.jsonParse "\"1969-07-28T22:42:36Z\"" + == Result.Ok(d "1969-07-28T22:42:36Z") // before epoch - Builtin.jsonSerialize (d "1402-07-28T22:42:36Z") = "\"1402-07-28T22:42:36Z\"" + Builtin.jsonSerialize (d "1402-07-28T22:42:36Z") + == "\"1402-07-28T22:42:36Z\"" - Builtin.jsonParse "\"1402-07-28T22:42:36Z\"" = Result.Ok( - d "1402-07-28T22:42:36Z" - ) + Builtin.jsonParse "\"1402-07-28T22:42:36Z\"" + == Result.Ok(d "1402-07-28T22:42:36Z") // far in future - Builtin.jsonSerialize (d "3023-07-28T22:42:36Z") = "\"3023-07-28T22:42:36Z\"" + Builtin.jsonSerialize (d "3023-07-28T22:42:36Z") + == "\"3023-07-28T22:42:36Z\"" - Builtin.jsonParse "\"3023-07-28T22:42:36Z\"" = Result.Ok( - d "3023-07-28T22:42:36Z" - ) + Builtin.jsonParse "\"3023-07-28T22:42:36Z\"" + == Result.Ok(d "3023-07-28T22:42:36Z") module Errors = - (Builtin.jsonParse "\"3023-07-28T22:42:36\"") |> err = Result.Error - "Can't parse JSON `\"3023-07-28T22:42:36\"` as type `DateTime` at path: `root`" + (Builtin.jsonParse "\"3023-07-28T22:42:36\"") |> err + == Result.Error + ("Can't parse JSON `\"3023-07-28T22:42:36\"` as type `DateTime` at path: `root`") - (Builtin.jsonParse "\"2023-07-28\"") |> err = Result.Error - "Can't parse JSON `\"2023-07-28\"` as type `DateTime` at path: `root`" + (Builtin.jsonParse "\"2023-07-28\"") |> err + == Result.Error + ("Can't parse JSON `\"2023-07-28\"` as type `DateTime` at path: `root`") - (Builtin.jsonParse "1") |> err = Result.Error - "Can't parse JSON `1` as type `DateTime` at path: `root`" + (Builtin.jsonParse "1") |> err + == Result.Error("Can't parse JSON `1` as type `DateTime` at path: `root`") module Uuid = - let uuid (s: String) : Uuid = - (Stdlib.Uuid.parse_v0 s) |> Builtin.unwrap + let uuid (s: String) : Uuid = (Stdlib.Uuid.parse s) |> Builtin.unwrap // empty - Builtin.jsonSerialize (uuid "00000000-0000-0000-0000-000000000000") = "\"00000000-0000-0000-0000-000000000000\"" + Builtin.jsonSerialize (uuid "00000000-0000-0000-0000-000000000000") + == "\"00000000-0000-0000-0000-000000000000\"" - Builtin.jsonParse "\"00000000-0000-0000-0000-000000000000\"" = Result.Ok( - uuid "00000000-0000-0000-0000-000000000000" - ) + Builtin.jsonParse "\"00000000-0000-0000-0000-000000000000\"" + == Result.Ok(uuid "00000000-0000-0000-0000-000000000000") // normal - Builtin.jsonSerialize (uuid "3700adbc-7a46-4ff4-81d3-45afb03f6e2d") = "\"3700adbc-7a46-4ff4-81d3-45afb03f6e2d\"" + Builtin.jsonSerialize (uuid "3700adbc-7a46-4ff4-81d3-45afb03f6e2d") + == "\"3700adbc-7a46-4ff4-81d3-45afb03f6e2d\"" - Builtin.jsonParse "\"3700adbc-7a46-4ff4-81d3-45afb03f6e2d\"" = Result.Ok( - uuid "3700adbc-7a46-4ff4-81d3-45afb03f6e2d" - ) + Builtin.jsonParse "\"3700adbc-7a46-4ff4-81d3-45afb03f6e2d\"" + == Result.Ok(uuid "3700adbc-7a46-4ff4-81d3-45afb03f6e2d") - Builtin.jsonSerialize (uuid "11111111-2222-3333-4444-555555555555") = "\"11111111-2222-3333-4444-555555555555\"" + Builtin.jsonSerialize (uuid "11111111-2222-3333-4444-555555555555") + == "\"11111111-2222-3333-4444-555555555555\"" - Builtin.jsonParse "\"11111111-2222-3333-4444-555555555555\"" = Result.Ok( - uuid "11111111-2222-3333-4444-555555555555" - ) + Builtin.jsonParse "\"11111111-2222-3333-4444-555555555555\"" + == Result.Ok(uuid "11111111-2222-3333-4444-555555555555") module Errors = // needs one more 0 at the end - (Builtin.jsonParse "\"00000000-0000-0000-0000-00000000000\"") |> err = Result.Error + (Builtin.jsonParse "\"00000000-0000-0000-0000-00000000000\"") |> err + == Result.Error( "Can't parse JSON `\"00000000-0000-0000-0000-00000000000\"` as type `Uuid` at path: `root`" + ) module BadTypes = @@ -996,286 +1006,334 @@ module BadTypes = // Builtin.jsonParse<'a> "5" = Result.Ok [] // Builtin.jsonSerialize<'a> 5 = Result.Error "dunno what happens" - Builtin.jsonParse Int64> "{}" = Builtin.testDerrorMessage - "Unsupported type in JSON: (Int64) -> Int64. Some types are not supported in Json serialization, and cannot be used as arguments to jsonParse or jsonSerialize + Builtin.jsonParse Int64> "{}" + == Builtin.testDerrorMessage + """Unsupported type in JSON: (Int64) -> Int64. Some types are not supported in Json serialization, and cannot be used as arguments to jsonParse or jsonSerialize Expected: A supported type (Int64, String, etc) -Actual: (Int64) -> Int64" +Actual: (Int64) -> Int64""" - Builtin.jsonSerialize Int64> (fun i -> 5) = Builtin.testDerrorMessage - "Unsupported type in JSON: (Int64) -> Int64. Some types are not supported in Json serialization, and cannot be used as arguments to jsonParse or jsonSerialize + Builtin.jsonSerialize Int64> (fun i -> 5) + == Builtin.testDerrorMessage + """Unsupported type in JSON: (Int64) -> Int64. Some types are not supported in Json serialization, and cannot be used as arguments to jsonParse or jsonSerialize Expected: A supported type (Int64, String, etc) -Actual: (Int64) -> Int64" +Actual: (Int64) -> Int64""" module List = type MyString = String - Builtin.jsonSerialize> [] = "[]" - Builtin.jsonParse> "[]" = Result.Ok [] + Builtin.jsonSerialize> [] == "[]" + Builtin.jsonParse> "[]" == Result.Ok([]) - Builtin.jsonSerialize> [ 1L; 2L; 3L ] = "[1,2,3]" + Builtin.jsonSerialize> [ 1L; 2L; 3L ] == "[1,2,3]" - Builtin.jsonParse> "[1,2,3]" = Result.Ok [ 1L; 2L; 3L ] + Builtin.jsonParse> "[1,2,3]" == Result.Ok([ 1L; 2L; 3L ]) - (Builtin.jsonParse> "[1,2,3,]") |> err = Result.Error "Not JSON" + (Builtin.jsonParse> "[1,2,3,]") |> err == Result.Error("Not JSON") Builtin.jsonSerialize>>> - [ [ [ 1L; 2L; 3L ]; [ 4L; 5L; 6L ] ]; [ [ 7L; 8L ]; [ 9L; 0L ] ] ] = "[[[1,2,3],[4,5,6]],[[7,8],[9,0]]]" - - Builtin.jsonParse>>> "[[[1,2,3],[4,5,6]],[[7,8],[9,0]]]" = Result.Ok [ [ [ 1L; 2L; 3L ]; [ 4L; 5L; 6L ] ]; [ [ 7L; 8L ]; [ 9L; 0L ] ] ] + == "[[[1,2,3],[4,5,6]],[[7,8],[9,0]]]" + + Builtin.jsonParse>>> "[[[1,2,3],[4,5,6]],[[7,8],[9,0]]]" + == Result.Ok([ [ [ 1L; 2L; 3L ]; [ 4L; 5L; 6L ] ]; [ [ 7L; 8L ]; [ 9L; 0L ] ] ]) Builtin.jsonParse>> - """[{"name": "Alice", "role": "admin"}, {"name": "Bob", "role": "user"}, {"name": "Charlie", "role": "user"}]""" = Result.Ok + """[{"name": "Alice", "role": "admin"}, {"name": "Bob", "role": "user"}, {"name": "Charlie", "role": "user"}]""" + == Result.Ok( [ Dict { name = "Alice"; role = "admin" } Dict { name = "Bob"; role = "user" } Dict { name = "Charlie"; role = "user" } ] + ) Builtin.jsonSerialize>> [ Dict { name = "Alice"; role = "admin" } Dict { name = "Bob"; role = "user" } - Dict { name = "Charlie"; role = "user" } ] = """[{"name":"Alice","role":"admin"},{"name":"Bob","role":"user"},{"name":"Charlie","role":"user"}]""" + Dict { name = "Charlie"; role = "user" } ] + == """[{"name":"Alice","role":"admin"},{"name":"Bob","role":"user"},{"name":"Charlie","role":"user"}]""" Builtin.jsonParse> - """[{"Name": "Alice", "Age": 42}, {"Name": "Bob", "Age": 27}, {"Name": "Charlie", "Age": 99}]""" = Result.Ok - [ Person { Name = "Alice"; Age = 42L } - Person { Name = "Bob"; Age = 27L } - Person { Name = "Charlie"; Age = 99L } ] + """[{"name": "Alice", "age": 42}, {"name": "Bob", "age": 27}, {"name": "Charlie", "age": 99}]""" + == Result.Ok( + [ Person { name = "Alice"; age = 42L } + Person { name = "Bob"; age = 27L } + Person { name = "Charlie"; age = 99L } ] + ) Builtin.jsonSerialize> - [ Person { Name = "Alice"; Age = 42L } - Person { Name = "Bob"; Age = 27L } - Person { Name = "Charlie"; Age = 99L } ] = """[{"Age":42,"Name":"Alice"},{"Age":27,"Name":"Bob"},{"Age":99,"Name":"Charlie"}]""" + [ Person { name = "Alice"; age = 42L } + Person { name = "Bob"; age = 27L } + Person { name = "Charlie"; age = 99L } ] + == """[{"age":42,"name":"Alice"},{"age":27,"name":"Bob"},{"age":99,"name":"Charlie"}]""" Builtin.jsonParse>> - """[{"name": "Alice", "role": "admin"}, {"name": "Bob", "role": "user"}, {"name": "Charlie", "role": "user"}]""" = Result.Ok + """[{"name": "Alice", "role": "admin"}, {"name": "Bob", "role": "user"}, {"name": "Charlie", "role": "user"}]""" + == Result.Ok( [ Dict { name = "Alice"; role = "admin" } Dict { name = "Bob"; role = "user" } Dict { name = "Charlie"; role = "user" } ] + ) module Errors = - Builtin.jsonSerialize> [ 1L, 2L, "three" ] = Builtin.testDerrorMessage - "jsonSerialize's 1st argument (`arg`) should be a List. However, an (Int64, Int64, String) ((1, 2, \"th...) was passed instead. + Builtin.jsonSerialize> (1L, 2L, "three") + == Builtin.testDerrorMessage + """jsonSerialize's 1st argument (`arg`) should be a List. However, an (Int64, Int64, String) ((1, 2, \"th...) was passed instead. Expected: (arg: 'a) -Actual: an (Int64, Int64, String): (1, 2, \"three\")" +Actual: an (Int64, Int64, String): (1, 2, \"three\")""" - (Builtin.jsonParse> "[1, 2, \"three\"]") |> err = Result.Error + (Builtin.jsonParse> "[1, 2, \"three\"]") |> err + == Result.Error( "Can't parse JSON `\"three\"` as type `Int64` at path: `root[2]`" + ) - (Builtin.jsonParse> "[1, 2, ]") |> err = Result.Error "Not JSON" + (Builtin.jsonParse> "[1, 2, ]") |> err == Result.Error("Not JSON") (Builtin.jsonParse>>> "[[[1,2,3],[4,5.5,6]],[[7,8],[9,0]]]") - |> err = Result.Error + |> err + == Result.Error( "Can't parse JSON `5.5` as type `Int64` at path: `root[0][1][1]`" + ) (Builtin.jsonParse>> """[{"name": "Alice", "role": "admin"}, {"name": "Bob", "role": "user"}, {"name": "Charlie", "role": "user"}]""") - |> err = Result.Error + |> err + == Result.Error( "Can't parse JSON `\"Alice\"` as type `Int64` at path: `root[0].name`" + ) module Tuples = - Builtin.jsonSerialize (1L, "two", 3L) = "[1,\"two\",3]" + Builtin.jsonSerialize<(Int64 * String * Int64)> (1L, "two", 3L) + == "[1,\"two\",3]" - Builtin.jsonParse "[1,\"two\",3]" = Result.Ok( - (1L, "two", 3L) - ) + Builtin.jsonParse<(Int64 * String * Int64)> "[1,\"two\",3]" + == Result.Ok((1L, "two", 3L)) - (Builtin.jsonParse "[1,3]") |> err = Result.Error + (Builtin.jsonParse<(Int64 * String * Int64)> "[1,3]") |> err + == Result.Error( "Can't parse JSON `[1,3]` as type `(Int64 * String * Int64)` at path: `root`" + ) - Builtin.jsonSerialize * List> ( + Builtin.jsonSerialize<(List * List)> ( [ 1L; 2L; 3L ], - [ Person { Name = "Alice"; Age = 42L } ] - ) = "[[1,2,3],[{\"Age\":42,\"Name\":\"Alice\"}]]" - - Builtin.jsonParse * List> - "[[1,2,3],[{\"Age\":42,\"Name\":\"Alice\"}]]" = Result.Ok( - ([ 1L; 2L; 3L ], [ Person { Name = "Alice"; Age = 42L } ]) + [ Person { name = "Alice"; age = 42L } ] ) + == "[[1,2,3],[{\"age\":42,\"name\":\"Alice\"}]]" + + Builtin.jsonParse<(List * List)> + "[[1,2,3],[{\"age\":42,\"name\":\"Alice\"}]]" + == Result.Ok(([ 1L; 2L; 3L ], [ Person { name = "Alice"; age = 42L } ])) - Builtin.jsonSerialize<(Int64 * String) * (Person * Dict)> ( + Builtin.jsonSerialize<((Int64 * String) * (Person * Dict))> ( (1L, "two"), - (Person { Name = "Alice"; Age = 42L }, Stdlib.Dict.singleton "a" "b") - ) = "[[1,\"two\"],[{\"Age\":42,\"Name\":\"Alice\"},{\"a\":\"b\"}]]" + (Person { name = "Alice"; age = 42L }, Stdlib.Dict.singleton "a" "b") + ) + == "[[1,\"two\"],[{\"age\":42,\"name\":\"Alice\"},{\"a\":\"b\"}]]" - Builtin.jsonParse<(Int64 * String) * (Person * Dict)> - "[[1,\"two\"],[{\"Age\":42,\"Name\":\"Alice\"},{\"a\":\"b\"}]]" = Result.Ok( + Builtin.jsonParse<((Int64 * String) * (Person * Dict))> + "[[1,\"two\"],[{\"age\":42,\"name\":\"Alice\"},{\"a\":\"b\"}]]" + == Result.Ok( ((1L, "two"), - (Person { Name = "Alice"; Age = 42L }, Stdlib.Dict.singleton "a" "b")) + (Person { name = "Alice"; age = 42L }, Stdlib.Dict.singleton "a" "b")) ) - Builtin.jsonSerialize<(List * List) * - (Person * Dict)> ( + Builtin.jsonSerialize<((List<(Int64 * String)> * List) * + (Person * Dict))> ( ([ (1L, "two"); (3L, "four") ], []), - (Person { Name = "Alice"; Age = 42L }, Stdlib.Dict.singleton "a" "b") - ) = "[[[[1,\"two\"],[3,\"four\"]],[]],[{\"Age\":42,\"Name\":\"Alice\"},{\"a\":\"b\"}]]" - - Builtin.jsonParse<(List * List) * (Person * Dict)> - "[[[[1,\"two\"],[3,\"four\"]],[]],[{\"Age\":42,\"Name\":\"Alice\"},{\"a\":\"b\"}]]" = Result - .Ok( - (([ (1L, "two"); (3L, "four") ], []), - (Person { Name = "Alice"; Age = 42L }, Stdlib.Dict.singleton "a" "b")) - ) + (Person { name = "Alice"; age = 42L }, Stdlib.Dict.singleton "a" "b") + ) + == "[[[[1,\"two\"],[3,\"four\"]],[]],[{\"age\":42,\"name\":\"Alice\"},{\"a\":\"b\"}]]" + Builtin.jsonParse<((List<(Int64 * String)> * List) * (Person * Dict))> + "[[[[1,\"two\"],[3,\"four\"]],[]],[{\"age\":42,\"name\":\"Alice\"},{\"a\":\"b\"}]]" + == Result.Ok( + (([ (1L, "two"); (3L, "four") ], []), + (Person { name = "Alice"; age = 42L }, Stdlib.Dict.singleton "a" "b")) + ) - Builtin.jsonSerialize> ( - Person { Name = "Alice"; Age = 42L }, - Option.Some 1L - ) = "[{\"Age\":42,\"Name\":\"Alice\"},{\"Some\":[1]}]" - Builtin.jsonParse> - "[{\"Age\":42,\"Name\":\"Alice\"},{\"Some\":[1]}]" = Result.Ok( - (Person { Name = "Alice"; Age = 42L }, Option.Some 1L) + Builtin.jsonSerialize<(Person * Option)> ( + Person { name = "Alice"; age = 42L }, + Option.Some(1L) ) + == "[{\"age\":42,\"name\":\"Alice\"},{\"Some\":[1]}]" + +Builtin.jsonParse<(Person * Option)> + "[{\"age\":42,\"name\":\"Alice\"},{\"Some\":[1]}]" +== Result.Ok((Person { name = "Alice"; age = 42L }, Option.Some(1L))) - Builtin.jsonSerialize * Result> ( - Option.Some 1L, - Result.Ok 2L - ) = "[{\"Some\":[1]},{\"Ok\":[2]}]" + Builtin.jsonSerialize<(Option * Result)> ( + Option.Some(1L), + Result.Ok(2L) + ) + == "[{\"Some\":[1]},{\"Ok\":[2]}]" - Builtin.jsonParse * Result> - "[{\"Some\":[1]},{\"Ok\":[2]}]" = Result.Ok((Option.Some 1L, Result.Ok 2L)) + Builtin.jsonParse<(Option * Result)> + "[{\"Some\":[1]},{\"Ok\":[2]}]" + == Result.Ok((Option.Some(1L), Result.Ok(2L))) - Builtin.jsonSerialize ('a', true) = "[\"a\",true]" - Builtin.jsonParse "[\"a\",true]" = Result.Ok(('a', true)) + Builtin.jsonSerialize<(Char * Bool)> ('a', true) == "[\"a\",true]" + Builtin.jsonParse<(Char * Bool)> "[\"a\",true]" == Result.Ok(('a', true)) - Builtin.jsonSerialize ( + Builtin.jsonSerialize<(DateTime * Uuid)> ( DateTime.d "2023-07-28T22:42:36Z", Uuid.uuid "3700adbc-7a46-4ff4-81d3-45afb03f6e2d" - ) = "[\"2023-07-28T22:42:36Z\",\"3700adbc-7a46-4ff4-81d3-45afb03f6e2d\"]" + ) + == "[\"2023-07-28T22:42:36Z\",\"3700adbc-7a46-4ff4-81d3-45afb03f6e2d\"]" - Builtin.jsonParse - "[\"2023-07-28T22:42:36Z\",\"3700adbc-7a46-4ff4-81d3-45afb03f6e2d\"]" = Result.Ok( + Builtin.jsonParse<(DateTime * Uuid)> + "[\"2023-07-28T22:42:36Z\",\"3700adbc-7a46-4ff4-81d3-45afb03f6e2d\"]" + == Result.Ok( (DateTime.d "2023-07-28T22:42:36Z", Uuid.uuid "3700adbc-7a46-4ff4-81d3-45afb03f6e2d") ) - module Errors = - (Builtin.jsonParse """[1, "two", 3]""") |> err = Result.Error - "Can't parse JSON `1` as type `String` at path: `root[0]`" +module Errors = + (Builtin.jsonParse<(String * String * Int64)> """[1, "two", 3]""") |> err + == Result.Error("Can't parse JSON `1` as type `String` at path: `root[0]`") - (Builtin.jsonParse """[1, "two", 3]""") |> err = Result.Error - "Can't parse JSON `[1, \"two\", 3]` as type `String` at path: `root`" + (Builtin.jsonParse """[1, "two", 3]""") |> err + == Result.Error( + "Can't parse JSON `[1, \"two\", 3]` as type `String` at path: `root`" + ) - (Builtin.jsonParse """[1, "two", 3]""") |> err = Result.Error - "Can't parse JSON `[1, \"two\", 3]` as type `(Int64 * String)` at path: `root`" + (Builtin.jsonParse<(Int64 * String)> """[1, "two", 3]""") |> err + == Result.Error( + "Can't parse JSON `[1, \"two\", 3]` as type `(Int64 * String)` at path: `root`" + ) - (Builtin.jsonParse<((List) * Bytes) * (Person * Dict)> - "[[[[2,\"two\"],[3,\"four\"]],\"\"],[{\"Age\":42,\"Name\":\"Alice\"},{\"a\":1}]]") - |> err = Result.Error - "Can't parse JSON `2` as type `String` at path: `root[0][0][0][0]`" + (Builtin.jsonParse<((List<(String * String)>) * Bytes) * (Person * Dict)> + "[[[[2,\"two\"],[3,\"four\"]],\"\"],[{\"age\":42,\"name\":\"Alice\"},{\"a\":1}]]") + |> err + == Result.Error( + "Can't parse JSON `2` as type `String` at path: `root[0][0][0][0]`" + ) - (Builtin.jsonParse<(List>) * String> - "[[[1,\"two\"],[3,\"four\"]],\"\"]") - |> err = Result.Error - "Can't parse JSON `\"two\"` as type `List` at path: `root[0][0][1]`" + // this is passing, but I don't think it is parsing correctly to check + (Builtin.jsonParse<(List<(Int64 * List)> * String)> + "[[[1,\"two\"],[3,\"four\"]],\"\"]") + |> err + == Result.Error( + "Can't parse JSON `\"two\"` as type `List` at path: `root[0][0][1]`" + ) - (Builtin.jsonParse> - "[{\"Age\":42,\"Name\":\"Alice\"},{\"Some\":[\"one\"]}]") - |> err = Result.Error - "Can't parse JSON `\"one\"` as type `Int64` at path: `root[1].Some[0]`" + (Builtin.jsonParse<(Person * Option)> + "[{\"age\":42,\"name\":\"Alice\"},{\"Some\":[\"one\"]}]") + |> err + == Result.Error( + "Can't parse JSON `\"one\"` as type `Int64` at path: `root[1].Some[0]`" + ) module Option = // TODO: more... - Builtin.jsonSerialize> Option.None = "{\"None\":[]}" + Builtin.jsonSerialize> Option.None() == "{\"None\":[]}" - Builtin.jsonParse> "{\"None\":[]}" = Result.Ok Option.None + Builtin.jsonParse> "{\"None\":[]}" == Result.Ok(Option.None()) - Builtin.jsonSerialize> (Option.Some 1L) = "{\"Some\":[1]}" + Builtin.jsonSerialize> (Option.Some(1L)) == "{\"Some\":[1]}" - Builtin.jsonParse> "{\"Some\":[1]}" = Result.Ok(Option.Some 1L) + Builtin.jsonParse> "{\"Some\":[1]}" == Result.Ok(Option.Some(1L)) module Errors = // TODO: these might make good candidates for more ergonmic parsing - (Builtin.jsonParse> "null") |> err = Result.Error - "Can't parse JSON `null` as type `PACKAGE.Darklang.Stdlib.Option.Option` at path: `root`" + (Builtin.jsonParse> "null") |> err + == Result.Error + ("Can't parse JSON `null` as type `PACKAGE.Darklang.Stdlib.Option.Option` at path: `root`") - (Builtin.jsonParse> "1") |> err = Result.Error - "Can't parse JSON `1` as type `PACKAGE.Darklang.Stdlib.Option.Option` at path: `root`" + (Builtin.jsonParse> "1") |> err + == Result.Error + ("Can't parse JSON `1` as type `PACKAGE.Darklang.Stdlib.Option.Option` at path: `root`") - (Builtin.jsonParse>> "[1,2,3]") |> err = Result.Error - "Can't parse JSON `[1,2,3]` as type `PACKAGE.Darklang.Stdlib.Option.Option>` at path: `root`" + (Builtin.jsonParse>> "[1,2,3]") |> err + == Result.Error + ("Can't parse JSON `[1,2,3]` as type `PACKAGE.Darklang.Stdlib.Option.Option>` at path: `root`") module Result = - Builtin.jsonSerialize> (Result.Ok 1L) = "{\"Ok\":[1]}" - - Builtin.jsonParse> "{\"Ok\":[1]}" = Result.Ok(Result.Ok 1L) + // Note: I removed the parens around `Int64, String`, maybe add support for it in the grammar + Builtin.jsonSerialize> (Result.Ok(1L)) == "{\"Ok\":[1]}" - Builtin.jsonSerialize> (Result.Error "err message") = "{\"Error\":[\"err message\"]}" + Builtin.jsonParse> "{\"Ok\":[1]}" + == Result.Ok(Result.Ok(1L)) - Builtin.jsonParse> "{\"Error\":[\"err message\"]}" = Result - .Ok(Result.Error "err message") + Builtin.jsonSerialize> (Result.Error("err message")) + == "{\"Error\":[\"err message\"]}" - Builtin.jsonSerialize * Option>, String>> ( - Result.Ok - [ (Stdlib.Dict.singleton "a" "b", Option.Some 1L) - (Stdlib.Dict.singleton "c" "d", Option.None) ] - ) = "{\"Ok\":[[[{\"a\":\"b\"},{\"Some\":[1]}],[{\"c\":\"d\"},{\"None\":[]}]]]}" + Builtin.jsonParse> "{\"Error\":[\"err message\"]}" + == Result.Ok(Result.Error("err message")) - Builtin.jsonParse * Option>, String>> - "{\"Ok\":[[[{\"a\":\"b\"},{\"Some\":[1]}],[{\"c\":\"d\"},{\"None\":[]}]]]}" = Result - .Ok( - Result.Ok - [ (Stdlib.Dict.singleton "a" "b", Option.Some 1L) - (Stdlib.Dict.singleton "c" "d", Option.None) ] + Builtin.jsonSerialize * Option)>, String>> ( + Result.Ok( + [ (Stdlib.Dict.singleton "a" "b", Option.Some(1L)) + (Stdlib.Dict.singleton "c" "d", Option.None()) ] + ) + ) + == "{\"Ok\":[[[{\"a\":\"b\"},{\"Some\":[1]}],[{\"c\":\"d\"},{\"None\":[]}]]]}" + + Builtin.jsonParse * Option)>, String>> + "{\"Ok\":[[[{\"a\":\"b\"},{\"Some\":[1]}],[{\"c\":\"d\"},{\"None\":[]}]]]}" + == Result.Ok( + Result.Ok( + [ (Stdlib.Dict.singleton "a" "b", Option.Some(1L)) + (Stdlib.Dict.singleton "c" "d", Option.None()) ] ) + ) Builtin.jsonSerialize, String>> ( - Result.Ok(Result.Ok 1L) - ) = "{\"Ok\":[{\"Ok\":[1]}]}" + Result.Ok(Result.Ok(1L)) + ) + == "{\"Ok\":[{\"Ok\":[1]}]}" Builtin.jsonSerialize, String>> ( - Result.Ok(Result.Error "err message") - ) = "{\"Ok\":[{\"Error\":[\"err message\"]}]}" + Result.Ok(Result.Error("err message")) + ) + == "{\"Ok\":[{\"Error\":[\"err message\"]}]}" - Builtin.jsonParse, String>> "{\"Ok\":[{\"Ok\":[1]}]}" = Result - .Ok(Result.Ok(Result.Ok 1L)) + Builtin.jsonParse, String>> "{\"Ok\":[{\"Ok\":[1]}]}" + == Result.Ok(Result.Ok(Result.Ok(1L))) Builtin.jsonParse, String>> - "{\"Ok\":[{\"Error\":[\"err message\"]}]}" = Result.Ok( - Result.Ok(Result.Error "err message") - ) + "{\"Ok\":[{\"Error\":[\"err message\"]}]}" + == Result.Ok(Result.Ok(Result.Error("err message"))) Builtin.jsonSerialize>, String>, String>> ( - Result.Ok(Result.Ok(Option.Some(Result.Ok 1L))) - ) = "{\"Ok\":[{\"Ok\":[{\"Some\":[{\"Ok\":[1]}]}]}]}" + Result.Ok(Result.Ok(Option.Some(Result.Ok(1L)))) + ) + == "{\"Ok\":[{\"Ok\":[{\"Some\":[{\"Ok\":[1]}]}]}]}" Builtin.jsonParse>, String>, String>> - "{\"Ok\":[{\"Ok\":[{\"Some\":[{\"Ok\":[1]}]}]}]}" = Result.Ok( - Result.Ok(Result.Ok(Option.Some(Result.Ok 1L))) - ) + "{\"Ok\":[{\"Ok\":[{\"Some\":[{\"Ok\":[1]}]}]}]}" + == Result.Ok(Result.Ok(Result.Ok(Option.Some(Result.Ok(1L))))) module Dict = - Builtin.jsonSerialize> (Stdlib.Dict.singleton "a" "b") = """{"a":"b"}""" + Builtin.jsonSerialize> (Stdlib.Dict.singleton "a" "b") + == """{"a":"b"}""" - Builtin.jsonParse> """{"a":"b"}""" = Result.Ok( - Stdlib.Dict.singleton "a" "b" - ) + Builtin.jsonParse> """{"a":"b"}""" + == Result.Ok(Stdlib.Dict.singleton "a" "b") - Builtin.jsonSerialize> (Dict { a = "b"; c = "d" }) = """{"a":"b","c":"d"}""" + Builtin.jsonSerialize> (Dict { a = "b"; c = "d" }) + == """{"a":"b","c":"d"}""" - Builtin.jsonParse> """{"a":"b","c":"d"}""" = Result.Ok( - Dict { a = "b"; c = "d" } - ) + Builtin.jsonParse> """{"a":"b","c":"d"}""" + == Result.Ok(Dict { a = "b"; c = "d" }) module Errors = - (Builtin.jsonParse> """{1:"b",2:"d"}""") |> err = Result.Error - "Not JSON" + (Builtin.jsonParse> """{1:"b",2:"d"}""") |> err + == Result.Error("Not JSON") module UserDefinedEnums = @@ -1289,174 +1347,189 @@ module UserDefinedEnums = | Yes | No - Builtin.jsonSerialize PrettyLikely.Yeah = "{\"Yeah\":[]}" + Builtin.jsonSerialize PrettyLikely.Yeah() == "{\"Yeah\":[]}" - Builtin.jsonParse "{\"Yeah\":[]}" = Result.Ok PrettyLikely.Yeah + Builtin.jsonParse "{\"Yeah\":[]}" == Result.Ok(PrettyLikely.Yeah()) - Builtin.jsonSerialize (PrettyLikely.Enh("printer broke", 7L)) = "{\"Enh\":[\"printer broke\",7]}" + Builtin.jsonSerialize (PrettyLikely.Enh("printer broke", 7L)) + == "{\"Enh\":[\"printer broke\",7]}" - Builtin.jsonParse "{\"Enh\":[\"printer broke\",7]}" = Result.Ok( - PrettyLikely.Enh("printer broke", 7L) - ) + Builtin.jsonParse "{\"Enh\":[\"printer broke\",7]}" + == Result.Ok(PrettyLikely.Enh("printer broke", 7L)) - Builtin.jsonSerialize (PrettyLikely2.PrettyLikely PrettyLikely.Yeah) = "{\"PrettyLikely\":[{\"Yeah\":[]}]}" + Builtin.jsonSerialize (PrettyLikely2.PrettyLikely(PrettyLikely.Yeah())) + == "{\"PrettyLikely\":[{\"Yeah\":[]}]}" - Builtin.jsonParse "{\"PrettyLikely\":[{\"Yeah\":[]}]}" = Result.Ok( - PrettyLikely2.PrettyLikely PrettyLikely.Yeah - ) + Builtin.jsonParse "{\"PrettyLikely\":[{\"Yeah\":[]}]}" + == Result.Ok(PrettyLikely2.PrettyLikely(PrettyLikely.Yeah())) Builtin.jsonSerialize ( PrettyLikely2.PrettyLikely(PrettyLikely.Enh("printer broke", 7L)) - ) = "{\"PrettyLikely\":[{\"Enh\":[\"printer broke\",7]}]}" + ) + == "{\"PrettyLikely\":[{\"Enh\":[\"printer broke\",7]}]}" Builtin.jsonParse - "{\"PrettyLikely\":[{\"Enh\":[\"printer broke\",7]}]}" = Result.Ok( - PrettyLikely2.PrettyLikely(PrettyLikely.Enh("printer broke", 7L)) - ) + "{\"PrettyLikely\":[{\"Enh\":[\"printer broke\",7]}]}" + == Result.Ok(PrettyLikely2.PrettyLikely(PrettyLikely.Enh("printer broke", 7L))) module Errors = (Builtin.jsonParse "{\"Enh\":[\"printer broke\",\"not int\"]}") - |> err = Result.Error - "Can't parse JSON `\"not int\"` as type `Int64` at path: `root.Enh[1]`" + |> err + == Result.Error + ("Can't parse JSON `\"not int\"` as type `Int64` at path: `root.Enh[1]`") // EnumMissingField - (Builtin.jsonParse "{\"Enh\":[\"printer broke\"]}") |> err = Result.Error - "Can't parse JSON because argument 1 (`Int64`) is missing at path: `root.Enh`" + (Builtin.jsonParse "{\"Enh\":[\"printer broke\"]}") |> err + == Result.Error + ("Can't parse JSON because argument 1 (`Int64`) is missing at path: `root.Enh`") // EnumExtraField - (Builtin.jsonParse "{\"Enh\":[\"printer broke\", 1, 2.0]}") |> err = Result.Error - "Can't parse JSON due to an extra argument `2.0` at path: `root.Enh[2]`" + (Builtin.jsonParse "{\"Enh\":[\"printer broke\", 1, 2.0]}") |> err + == Result.Error + ("Can't parse JSON due to an extra argument `2.0` at path: `root.Enh[2]`") // CantMatchWithType - (Builtin.jsonParse "{}") |> err = Result.Error - "Can't parse JSON `{}` as type `UserDefinedEnums.PrettyLikely` at path: `root`" + (Builtin.jsonParse "{}") |> err + == Result.Error + ("Can't parse JSON `{}` as type `UserDefinedEnums.PrettyLikely` at path: `root`") - (Builtin.jsonParse "[]") |> err = Result.Error - "Can't parse JSON `[]` as type `UserDefinedEnums.PrettyLikely` at path: `root`" + (Builtin.jsonParse "[]") |> err + == Result.Error + ("Can't parse JSON `[]` as type `UserDefinedEnums.PrettyLikely` at path: `root`") // EnumInvalidCasename (Builtin.jsonParse "{\"Wrong\":[\"printer broke\", 1, 2.0]}") - |> err = Result.Error - "Can't parse JSON as `Wrong` is not a known case of type `UserDefinedEnums.PrettyLikely` at path: `root`" + |> err + == Result.Error + ("Can't parse JSON as `Wrong` is not a known case of type `UserDefinedEnums.PrettyLikely` at path: `root`") // EnumTooManyCases (Builtin.jsonParse "{\"Enh\":[\"printer broke\", 1], \"Extra\": \"field\"}") - |> err = Result.Error - "Can't parse JSON with multiple fields (`Enh`, `Extra`) as type `UserDefinedEnums.PrettyLikely` at path: `root`" + |> err + == Result.Error + ("Can't parse JSON with multiple fields (`Enh`, `Extra`) as type `UserDefinedEnums.PrettyLikely` at path: `root`") module UserDefinedRecords = - Builtin.jsonSerialize (Person { Name = "Bob"; Age = 42L }) = """{"Age":42,"Name":"Bob"}""" + Builtin.jsonSerialize (Person { name = "Bob"; age = 42L }) + == """{"age":42,"name":"Bob"}""" - Builtin.jsonParse """{ "Name": "Bob", "Age": 42 }""" = Result.Ok( - Person { Name = "Bob"; Age = 42L } - ) + Builtin.jsonParse """{ "name": "Bob", "age": 42 }""" + == Result.Ok(Person { name = "Bob"; age = 42L }) // can parse even if the JSON has _extra_ fields - Builtin.jsonParse """{ "Name": "Bob", "Age": 42, "Height": "6 ft" }""" = Result - .Ok(Person { Name = "Bob"; Age = 42L }) + Builtin.jsonParse """{ "name": "Bob", "age": 42, "height": "6 ft" }""" + == Result.Ok(Person { name = "Bob"; age = 42L }) - (let personMaybe = Builtin.jsonParse """{ "Name": "Bob", "Age": 42 }""" + (let personMaybe = Builtin.jsonParse """{ "name": "Bob", "age": 42 }""" match personMaybe with - | Ok person -> person.Age - | Error _ -> 0) = 42L + | Ok(person) -> person.age + | Error(_) -> 0) + == 42L type People = - { GroupName: String - People: List } + { groupName: String + people: List } Builtin.jsonSerialize ( People - { GroupName = "Two Georges" - People = - [ Person { Name = "George A"; Age = 27L } - Person { Name = "George B"; Age = 42L } ] } - ) = """{"GroupName":"Two Georges","People":[{"Age":27,"Name":"George A"},{"Age":42,"Name":"George B"}]}""" + { groupName = "Two Georges" + people = + [ Person { name = "George A"; age = 27L } + Person { name = "George B"; age = 42L } ] } + ) + == """{"groupName":"Two Georges","people":[{"age":27,"name":"George A"},{"age":42,"name":"George B"}]}""" Builtin.jsonParse - """{"GroupName":"Two Georges","People":[{"Age":27,"Name":"George A"},{"Age":42,"Name":"George B"}]}""" = Result - .Ok( - People - { GroupName = "Two Georges" - People = - [ Person { Name = "George A"; Age = 27L } - Person { Name = "George B"; Age = 42L } ] } - ) + """{"groupName":"Two Georges","people":[{"age":27,"name":"George A"},{"age":42,"name":"George B"}]}""" + == Result.Ok( + People + { groupName = "Two Georges" + people = + [ Person { name = "George A"; age = 27L } + Person { name = "George B"; age = 42L } ] } + ) type Combo<'e1, 'e2> = { e1: 'e1; e2: 'e2 } Builtin.jsonSerialize>> ( Combo - { e1 = Person { Name = "Bob"; Age = 42L } + { e1 = Person { name = "Bob"; age = 42L } e2 = Combo { e1 = People - { GroupName = "Two Georges" - People = - [ Person { Name = "George A"; Age = 27L } - Person { Name = "George B"; Age = 42L } ] } + { groupName = "Two Georges" + people = + [ Person { name = "George A"; age = 27L } + Person { name = "George B"; age = 42L } ] } e2 = 5L } } - ) = """{"e1":{"Age":42,"Name":"Bob"},"e2":{"e1":{"GroupName":"Two Georges","People":[{"Age":27,"Name":"George A"},{"Age":42,"Name":"George B"}]},"e2":5}}""" + ) + == """{"e1":{"age":42,"name":"Bob"},"e2":{"e1":{"groupName":"Two Georges","people":[{"age":27,"name":"George A"},{"age":42,"name":"George B"}]},"e2":5}}""" Builtin.jsonParse>> - """{"e1":{"Age":42,"Name":"Bob"},"e2":{"e1":{"GroupName":"Two Georges","People":[{"Age":27,"Name":"George A"},{"Age":42,"Name":"George B"}]},"e2":5}}""" = Result - .Ok( - Combo - { e1 = Person { Name = "Bob"; Age = 42L } - e2 = - Combo - { e1 = - People - { GroupName = "Two Georges" - People = - [ Person { Name = "George A"; Age = 27L } - Person { Name = "George B"; Age = 42L } ] } - e2 = 5L } } - ) + """{"e1":{"age":42,"name":"Bob"},"e2":{"e1":{"groupName":"Two Georges","people":[{"age":27,"name":"George A"},{"age":42,"name":"George B"}]},"e2":5}}""" + == Result.Ok( + Combo + { e1 = Person { name = "Bob"; age = 42L } + e2 = + Combo + { e1 = + People + { groupName = "Two Georges" + people = + [ Person { name = "George A"; age = 27L } + Person { name = "George B"; age = 42L } ] } + e2 = 5L } } + ) (Combo - { e1 = Person { Name = "Bob"; Age = 42L } + { e1 = Person { name = "Bob"; age = 42L } e2 = Combo { e1 = People - { GroupName = "Two Georges" - People = - [ Person { Name = "George A"; Age = 27L } - Person { Name = "George B"; Age = 42L } ] } + { groupName = "Two Georges" + people = + [ Person { name = "George A"; age = 27L } + Person { name = "George B"; age = 42L } ] } e2 = 5L } }) |> Builtin.jsonSerialize>> |> Builtin.jsonParse>> - |> Builtin.unwrap = (Combo - { e1 = Person { Name = "Bob"; Age = 42L } + |> Builtin.unwrap + == (Combo + { e1 = Person { name = "Bob"; age = 42L } e2 = Combo { e1 = People - { GroupName = "Two Georges" - People = - [ Person { Name = "George A"; Age = 27L } - Person { Name = "George B"; Age = 42L } ] } + { groupName = "Two Georges" + people = + [ Person { name = "George A"; age = 27L } + Person { name = "George B"; age = 42L } ] } e2 = 5L } }) module Errors = - (Builtin.jsonParse "[]") |> err = Result.Error - "Can't parse JSON `[]` as type `Person` at path: `root`" + (Builtin.jsonParse "[]") |> err + == Result.Error("Can't parse JSON `[]` as type `Person` at path: `root`") // Extra fields are allowed, but missing fields are not - (Builtin.jsonParse "{\"notAField\": 5}") |> err = Result.Error - "Can't parse JSON because `Name` field is not provided at path: `root`" + (Builtin.jsonParse "{\"notAField\": 5}") |> err + == Result.Error( + "Can't parse JSON because `name` field is not provided at path: `root`" + ) - (Builtin.jsonParse "{\"Age\": 5, \"Age\": 6, \"Name\": \"\"}") |> err = Result.Error - "Can't parse JSON because `Age` is defined more than once at path: `root`" + (Builtin.jsonParse "{\"age\": 5, \"age\": 6, \"name\": \"\"}") |> err + == Result.Error( + "Can't parse JSON because `age` is defined more than once at path: `root`" + ) @@ -1465,42 +1538,44 @@ module UserDefinedAliases = type MyInt = Int64 - Builtin.jsonSerialize 42L = "42" - Builtin.jsonParse "42" = Result.Ok 42L + Builtin.jsonSerialize 42L == "42" + Builtin.jsonParse "42" == Result.Ok(42L) type MyPerson = Person - Builtin.jsonSerialize (Person { Name = "Bob"; Age = 42L }) = """{"Age":42,"Name":"Bob"}""" + Builtin.jsonSerialize (Person { name = "Bob"; age = 42L }) + == """{"age":42,"name":"Bob"}""" - Builtin.jsonParse """{ "Name": "Bob", "Age": 42 }""" = Result.Ok( - Person { Name = "Bob"; Age = 42L } - ) + Builtin.jsonParse """{ "name": "Bob", "age": 42 }""" + == Result.Ok(Person { name = "Bob"; age = 42L }) type MyPrettyLikely = UserDefinedEnums.PrettyLikely Builtin.jsonSerialize ( UserDefinedEnums.PrettyLikely.Enh("printer broke", 7L) - ) = "{\"Enh\":[\"printer broke\",7]}" - - Builtin.jsonParse "{\"Enh\":[\"printer broke\",7]}" = Result.Ok( - UserDefinedEnums.PrettyLikely.Enh("printer broke", 7L) ) + == "{\"Enh\":[\"printer broke\",7]}" + Builtin.jsonParse "{\"Enh\":[\"printer broke\",7]}" + == Result.Ok(UserDefinedEnums.PrettyLikely.Enh("printer broke", 7L)) - type Person1 = { Name: String; Age: Int64 } - type Person2 = { Name: String; Age: Int64 } - Builtin.jsonSerialize (Person1 { Name = "Bob"; Age = 42L }) = Builtin.testDerrorMessage - "jsonSerialize's 1st argument (`arg`) should be an UserDefinedAliases.Person2. However, an UserDefinedAliases.Person1 (UserDefine...) was passed instead. + type Person1 = { name: String; age: Int64 } + type Person2 = { name: String; age: Int64 } + + Builtin.jsonSerialize (Person1 { name = "Bob"; age = 42L }) + == Builtin.testDerrorMessage + """jsonSerialize's 1st argument (`arg`) should be an UserDefinedAliases.Person2. However, an UserDefinedAliases.Person1 (UserDefine...) was passed instead. Expected: (arg: 'a) -Actual: an UserDefinedAliases.Person1: UserDefinedAliases.Person1 {\n Age: 42,\n Name: \"Bob\"\n}" +Actual: an UserDefinedAliases.Person1: UserDefinedAliases.Person1 {\n age: 42,\n name: "Bob"\n}""" type StringResult<'a> = Result<'a, String> - Builtin.jsonSerialize> (Result.Ok 1L) = "{\"Ok\":[1]}" + Builtin.jsonSerialize> (Result.Ok(1L)) == "{\"Ok\":[1]}" - Builtin.jsonSerialize> (Result.Error "err") = "{\"Error\":[\"err\"]}" + Builtin.jsonSerialize> (Result.Error("err")) + == "{\"Error\":[\"err\"]}" // This test currently slips by the typechecker, and so we get an internal exception // Builtin.jsonSerialize> (Result.Error 1) = Result.Error @@ -1508,37 +1583,40 @@ Actual: an UserDefinedAliases.Person1: UserDefinedAliases.Person1 {\n Age: 42,\ module Package = - Builtin.jsonSerialize> Option.None = "{\"None\":[]}" + Builtin.jsonSerialize> Option.None() == "{\"None\":[]}" - Builtin.jsonParse> "{\"None\":[]}" = Result.Ok Option.None + Builtin.jsonParse> "{\"None\":[]}" == Result.Ok(Option.None()) - Builtin.jsonSerialize> (Result.Ok 1L) = "{\"Ok\":[1]}" + Builtin.jsonSerialize> (Result.Ok(1L)) == "{\"Ok\":[1]}" - Builtin.jsonSerialize> (Result.Error "err message") = "{\"Error\":[\"err message\"]}" + Builtin.jsonSerialize> (Result.Error("err message")) + == "{\"Error\":[\"err message\"]}" - Builtin.jsonParse> "{\"Ok\":[1]}" = Result.Ok(Result.Ok 1L) + Builtin.jsonParse> "{\"Ok\":[1]}" + == Result.Ok(Result.Ok(1L)) - Builtin.jsonParse> "{\"Error\":[\"err message\"]}" = Result - .Ok(Result.Error "err message") + Builtin.jsonParse> "{\"Error\":[\"err message\"]}" + == Result.Ok(Result.Error("err message")) - Builtin.jsonSerialize 42L = "42" - Builtin.jsonParse "42" = Result.Ok 42L + Builtin.jsonSerialize 42L == "42" + Builtin.jsonParse "42" == Result.Ok(42L) Builtin.jsonSerialize - PACKAGE.Darklang.LanguageTools.Sign.Positive = "{\"Positive\":[]}" + PACKAGE.Darklang.LanguageTools.Sign.Positive() + == "{\"Positive\":[]}" - Builtin.jsonParse "{\"Positive\":[]}" = Result.Ok - PACKAGE.Darklang.LanguageTools.Sign.Positive + Builtin.jsonParse "{\"Positive\":[]}" + == Result.Ok(PACKAGE.Darklang.LanguageTools.Sign.Positive()) Builtin.jsonSerialize ( PACKAGE.Darklang.OpenAI.Completion.ResponseChoice { text = "hello" } - ) = "{\"text\":\"hello\"}" + ) + == "{\"text\":\"hello\"}" Builtin.jsonParse - "{\"text\":\"hello\"}" = Result.Ok( - PACKAGE.Darklang.OpenAI.Completion.ResponseChoice { text = "hello" } - ) + "{\"text\":\"hello\"}" + == Result.Ok(PACKAGE.Darklang.OpenAI.Completion.ResponseChoice { text = "hello" }) Builtin.jsonSerialize ( PACKAGE.Darklang.OpenAI.Completion.Request @@ -1546,92 +1624,96 @@ module Package = prompt = "test" max_tokens = 5L temperature = 0.7 } - ) = "{\"max_tokens\":5,\"model\":\"davinci\",\"prompt\":\"test\",\"temperature\":0.7}" + ) + == "{\"max_tokens\":5,\"model\":\"davinci\",\"prompt\":\"test\",\"temperature\":0.7}" Builtin.jsonParse - "{\"max_tokens\":5,\"model\":\"davinci\",\"prompt\":\"test\",\"temperature\":0.7}" = Result - .Ok( - PACKAGE.Darklang.OpenAI.Completion.Request - { model = "davinci" - prompt = "test" - max_tokens = 5L - temperature = 0.7 } - ) + "{\"max_tokens\":5,\"model\":\"davinci\",\"prompt\":\"test\",\"temperature\":0.7}" + == Result.Ok( + PACKAGE.Darklang.OpenAI.Completion.Request + { model = "davinci" + prompt = "test" + max_tokens = 5L + temperature = 0.7 } + ) Builtin.jsonSerialize ( PACKAGE.Darklang.LanguageTools.RuntimeErrors.NameResolution.ErrorType.InvalidPackageName - [ "NamePart" ] - ) = "{\"InvalidPackageName\":[[\"NamePart\"]]}" + ([ "NamePart" ]) + ) + == "{\"InvalidPackageName\":[[\"NamePart\"]]}" Builtin.jsonParse - "{\"NotFound\":[[\"NamePart\"]]}" = Result.Ok( + "{\"NotFound\":[[\"NamePart\"]]}" + == Result.Ok( PACKAGE.Darklang.LanguageTools.RuntimeErrors.NameResolution.ErrorType.NotFound - [ "NamePart" ] + ([ "NamePart" ]) ) Builtin.jsonSerialize> [ (PACKAGE.Darklang.LanguageTools.RuntimeErrors.NameResolution.ErrorType.InvalidPackageName - [ "NamePart" ]) + ([ "NamePart" ])) (PACKAGE.Darklang.LanguageTools.RuntimeErrors.NameResolution.ErrorType.MissingEnumModuleName - "Ok") + ("Ok")) (PACKAGE.Darklang.LanguageTools.RuntimeErrors.NameResolution.ErrorType.NotFound - [ "NamePart" ]) ] = "[{\"InvalidPackageName\":[[\"NamePart\"]]},{\"MissingEnumModuleName\":[\"Ok\"]},{\"NotFound\":[[\"NamePart\"]]}]" + ([ "NamePart" ])) ] + == "[{\"InvalidPackageName\":[[\"NamePart\"]]},{\"MissingEnumModuleName\":[\"Ok\"]},{\"NotFound\":[[\"NamePart\"]]}]" Builtin.jsonParse> - "[{\"InvalidPackageName\":[[\"NamePart\"]]},{\"MissingEnumModuleName\":[\"Ok\"]},{\"NotFound\":[[\"NamePart\"]]}]" = Result - .Ok( - [ (PACKAGE.Darklang.LanguageTools.RuntimeErrors.NameResolution.ErrorType.InvalidPackageName - [ "NamePart" ]) - (PACKAGE.Darklang.LanguageTools.RuntimeErrors.NameResolution.ErrorType.MissingEnumModuleName - "Ok") - (PACKAGE.Darklang.LanguageTools.RuntimeErrors.NameResolution.ErrorType.NotFound - [ "NamePart" ]) ] - ) + "[{\"InvalidPackageName\":[[\"NamePart\"]]},{\"MissingEnumModuleName\":[\"Ok\"]},{\"NotFound\":[[\"NamePart\"]]}]" + == Result.Ok( + [ (PACKAGE.Darklang.LanguageTools.RuntimeErrors.NameResolution.ErrorType.InvalidPackageName + ([ "NamePart" ])) + (PACKAGE.Darklang.LanguageTools.RuntimeErrors.NameResolution.ErrorType.MissingEnumModuleName + ("Ok")) + (PACKAGE.Darklang.LanguageTools.RuntimeErrors.NameResolution.ErrorType.NotFound + ([ "NamePart" ])) ] + ) // from old tests - worth reviewing to see if we have missing cases -//Builtin.jsonParse "{Id : 1.0}" = null -//Builtin.jsonParse "{Id : 1.}" = null +// Builtin.jsonParse "{Id : 1.0}" = null +// Builtin.jsonParse "{Id : 1.}" = null -//Builtin.jsonParse "[ {date : \"2013-11-05\", locations : {Japan: 3, Germany: 1}} ]" = null -//Builtin.jsonParse "({id : 555, edition : \"First\", author : \"Dennis Ritchie\"})" = null -//Builtin.jsonParse "" = null -//Builtin.jsonParse "1,0/0,0" = null -//Builtin.jsonParse "1" = 1 +// Builtin.jsonParse "[ {date : \"2013-11-05\", locations : {Japan: 3, Germany: 1}} ]" = null +// Builtin.jsonParse "({id : 555, edition : \"First\", author : \"Dennis Ritchie\"})" = null +// Builtin.jsonParse "" = null +// Builtin.jsonParse "1,0/0,0" = null +// Builtin.jsonParse "1" = 1 -//Builtin.jsonParse "{Id : 1.0}" = Builtin.Test.runtimeError "'I' is an invalid start of a property name. Expected a '\"'. LineNumber: 0 | BytePositionInLine: 1." -//Builtin.jsonParse "{\"Id\" : 1.}" = Builtin.Test.runtimeError "'}' is invalid within a number, immediately after a decimal point ('.'). Expected a digit ('0'-'9'). LineNumber: 0 | BytePositionInLine: 10." -//Builtin.jsonParse "{id : 555, edition : \"First\", author : \"Dennis Ritchie\"}" = Builtin.Test.runtimeError "'i' is an invalid start of a property name. Expected a '\"'. LineNumber: 0 | BytePositionInLine: 1." -//Builtin.jsonParse "\"\"" = "" +// Builtin.jsonParse "{Id : 1.0}" = Builtin.Test.runtimeError "'I' is an invalid start of a property name. Expected a '\"'. LineNumber: 0 | BytePositionInLine: 1." +// Builtin.jsonParse "{\"Id\" : 1.}" = Builtin.Test.runtimeError "'}' is invalid within a number, immediately after a decimal point ('.'). Expected a digit ('0'-'9'). LineNumber: 0 | BytePositionInLine: 10." +// Builtin.jsonParse "{id : 555, edition : \"First\", author : \"Dennis Ritchie\"}" = Builtin.Test.runtimeError "'i' is an invalid start of a property name. Expected a '\"'. LineNumber: 0 | BytePositionInLine: 1." +// Builtin.jsonParse "\"\"" = "" -//Builtin.jsonParse "" = Builtin.Test.runtimeError "JSON string was empty" +// Builtin.jsonParse "" = Builtin.Test.runtimeError "JSON string was empty" -//Builtin.jsonParse "{ \"v\": 4611686018427387903 }" = { v = 4611686018427387903L } -//Builtin.jsonParse "{ \"v\": 4611686018427387904 }" = { v = 4611686018427387904L } +// Builtin.jsonParse "{ \"v\": 4611686018427387903 }" = { v = 4611686018427387903L } +// Builtin.jsonParse "{ \"v\": 4611686018427387904 }" = { v = 4611686018427387904L } -//Builtin.jsonParse "''" = Builtin.Test.runtimeError "''' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0." -//Builtin.jsonParse "" = Builtin.Test.runtimeError "JSON string was empty" -//Builtin.jsonParse "{Id : 1.0}" = Builtin.Test.runtimeError "'I' is an invalid start of a property name. Expected a '\"'. LineNumber: 0 | BytePositionInLine: 1." -//Builtin.jsonParse "{\"Id\" : 1.}" = Builtin.Test.runtimeError "'}' is invalid within a number, immediately after a decimal point ('.'). Expected a digit ('0'-'9'). LineNumber: 0 | BytePositionInLine: 10.")" -//Builtin.jsonParse "{id : 555, edition : \"First\", author : \"Dennis Ritchie\"}" = Builtin.Test.runtimeError "'i' is an invalid start of a property name. Expected a '\"'. LineNumber: 0 | BytePositionInLine: 1." +// Builtin.jsonParse "''" = Builtin.Test.runtimeError "''' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0." +// Builtin.jsonParse "" = Builtin.Test.runtimeError "JSON string was empty" +// Builtin.jsonParse "{Id : 1.0}" = Builtin.Test.runtimeError "'I' is an invalid start of a property name. Expected a '\"'. LineNumber: 0 | BytePositionInLine: 1." +// Builtin.jsonParse "{\"Id\" : 1.}" = Builtin.Test.runtimeError "'}' is invalid within a number, immediately after a decimal point ('.'). Expected a digit ('0'-'9'). LineNumber: 0 | BytePositionInLine: 10.")" +// Builtin.jsonParse "{id : 555, edition : \"First\", author : \"Dennis Ritchie\"}" = Builtin.Test.runtimeError "'i' is an invalid start of a property name. Expected a '\"'. LineNumber: 0 | BytePositionInLine: 1." -//Builtin.jsonParse "{ \"v\": 4611686018427387903 }" = Result.Ok { v = 4611686018427387903L } -//Builtin.jsonParse "{ \"v\": 4611686018427387904 }" = Result.Ok { v = 4611686018427387904L } +// Builtin.jsonParse "{ \"v\": 4611686018427387903 }" = Result.Ok { v = 4611686018427387903L } +// Builtin.jsonParse "{ \"v\": 4611686018427387904 }" = Result.Ok { v = 4611686018427387904L } -//Builtin.jsonParse "" = Result.Error "JSON string was empty" -//Builtin.jsonParse "{3: false}" = Result.Error "'3' is an invalid start of a property name. Expected a '\"'. LineNumber: 0 | BytePositionInLine: 1." +// Builtin.jsonParse "" = Result.Error "JSON string was empty" +// Builtin.jsonParse "{3: false}" = Result.Error "'3' is an invalid start of a property name. Expected a '\"'. LineNumber: 0 | BytePositionInLine: 1." -//Builtin.jsonParse "{Id : 1.0}" = Result.Error "'I' is an invalid start of a property name. Expected a '\"'. LineNumber: 0 | BytePositionInLine: 1." -//Builtin.jsonParse "{\"Id\" : Infinity }" = Result.Error "'I' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 8." -//Builtin.jsonParse "{\"Id\" : -Infinity }" = Result.Error "'I' is invalid within a number, immediately after a sign character ('+' or '-'). Expected a digit ('0'-'9'). LineNumber: 0 | BytePositionInLine: 9." -//Builtin.jsonParse "{\"Id\" : NaN }" = Result.Error "'N' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 8." -//Builtin.jsonParse "{\"Id\" : 1.}" = Result.Error "'}' is invalid within a number, immediately after a decimal point ('.'). Expected a digit ('0'-'9'). LineNumber: 0 | BytePositionInLine: 10." -//Builtin.jsonParse "[ {\"date\" : \"2013-11-05\", locations : {Japan: 3, Germany: 1}} ]" = Result.Error "'l' is an invalid start of a property name. Expected a '\"'. LineNumber: 0 | BytePositionInLine: 26." -//Builtin.jsonParse "{\"id\" : 555, edition : \"First\", author : \"Dennis Ritchie\"}" = Result.Error "'e' is an invalid start of a property name. Expected a '\"'. LineNumber: 0 | BytePositionInLine: 13." -//Builtin.jsonParse "{\"id\" : 555, \"edition\" : 'First' }" = Result.Error "''' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 25." -//Builtin.jsonParse "({\"id\" : 555, \"edition\" : \"First\", \"author\" : \"Dennis Ritchie\"})" = Result.Error "'(' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0." +// Builtin.jsonParse "{Id : 1.0}" = Result.Error "'I' is an invalid start of a property name. Expected a '\"'. LineNumber: 0 | BytePositionInLine: 1." +// Builtin.jsonParse "{\"Id\" : Infinity }" = Result.Error "'I' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 8." +// Builtin.jsonParse "{\"Id\" : -Infinity }" = Result.Error "'I' is invalid within a number, immediately after a sign character ('+' or '-'). Expected a digit ('0'-'9'). LineNumber: 0 | BytePositionInLine: 9." +// Builtin.jsonParse "{\"Id\" : NaN }" = Result.Error "'N' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 8." +// Builtin.jsonParse "{\"Id\" : 1.}" = Result.Error "'}' is invalid within a number, immediately after a decimal point ('.'). Expected a digit ('0'-'9'). LineNumber: 0 | BytePositionInLine: 10." +// Builtin.jsonParse "[ {\"date\" : \"2013-11-05\", locations : {Japan: 3, Germany: 1}} ]" = Result.Error "'l' is an invalid start of a property name. Expected a '\"'. LineNumber: 0 | BytePositionInLine: 26." +// Builtin.jsonParse "{\"id\" : 555, edition : \"First\", author : \"Dennis Ritchie\"}" = Result.Error "'e' is an invalid start of a property name. Expected a '\"'. LineNumber: 0 | BytePositionInLine: 13." +// Builtin.jsonParse "{\"id\" : 555, \"edition\" : 'First' }" = Result.Error "''' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 25." +// Builtin.jsonParse "({\"id\" : 555, \"edition\" : \"First\", \"author\" : \"Dennis Ritchie\"})" = Result.Error "'(' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0." // ## Nested types (lists, tuples, records, etc.) // Builtin.jsonSerialize> * Dict>>>>> = Ok "test" diff --git a/backend/testfiles/execution/stdlib/list.dark b/backend/testfiles/execution/stdlib/list.dark index 61af9f13c3..fb0dc943f6 100644 --- a/backend/testfiles/execution/stdlib/list.dark +++ b/backend/testfiles/execution/stdlib/list.dark @@ -4,315 +4,334 @@ //[(1,10);(2,20);(3,30,40)] = Builtin.testDerrorMessage "Cannot form a list of mixed types" -Stdlib.List.all_v0 [] (fun item -> item < 3L) = true -Stdlib.List.all_v0 [ 2L ] (fun item -> item < 3L) = true -Stdlib.List.all_v0 [ 1L; 2L ] (fun item -> item < 3L) = true -Stdlib.List.all_v0 [ 4L ] (fun item -> item < 3L) = false -Stdlib.List.all_v0 [ 1L; 4L ] (fun item -> item < 3L) = false - - -Stdlib.List.append_v0 [ 1L; 2L; 3L ] [ 4L; 5L; 6L ] = [ 1L; 2L; 3L; 4L; 5L; 6L ] - -Stdlib.List.append_v0 [ 3L; 4L ] [ 5L; 6L ] = [ 3L; 4L; 5L; 6L ] -Stdlib.List.append_v0 [ 1L ] [ 2L ] = [ 1L; 2L ] -Stdlib.List.append_v0 [] [] = [] - - -Stdlib.List.drop_v0 [ "a"; "b"; "c"; "d" ] -3L = [ "a"; "b"; "c"; "d" ] - -Stdlib.List.drop_v0 [ "a"; "b"; "c"; "d" ] 3L = [ "d" ] -Stdlib.List.drop_v0 [ 1L; 2L; 3L; 4L ] -1L = [ 1L; 2L; 3L; 4L ] -Stdlib.List.drop_v0 [ 1L; 2L; 3L; 4L ] 0L = [ 1L; 2L; 3L; 4L ] -Stdlib.List.drop_v0 [ 1L; 2L; 3L; 4L ] 440737095L = [] -Stdlib.List.drop_v0 [ 1L; 2L; 3L; 4L ] 1184467440737095L = [] -Stdlib.List.drop_v0 [ 1L; 2L; 3L; 4L ] 2L = [ 3L; 4L ] -Stdlib.List.drop_v0 [ 1L; 2L; 3L; 4L ] 4L = [] -Stdlib.List.drop_v0 [ 1L; 2L; 3L; 4L ] 5L = [] -Stdlib.List.drop_v0 [ 3L; 3L; 3L ] 0L = [ 3L; 3L; 3L ] -Stdlib.List.drop_v0 [ 5L; 4L; 3L; 2L; 1L ] 5L = [] -Stdlib.List.drop_v0 [ 5L ] 4L = [] -Stdlib.List.drop_v0 [] 4L = [] - -Stdlib.List.dropWhile_v0 [ 1L; 2L; 3L; 4L ] (fun item -> 0L - 1L) = Builtin.testDerrorMessage - "If only supports Booleans" - -Stdlib.List.dropWhile_v0 [ 1L; 2L; 3L; 4L ] (fun item -> item < 3L) = [ 3L; 4L ] - -Stdlib.List.dropWhile_v0 [ 1L; 2L; 3L; 4L ] (fun item -> item >= 1L) = [] - -Stdlib.List.dropWhile_v0 [ 1L; 5L; 2L; 2L ] (fun item -> item < 3L) = [ 5L; 2L; 2L ] - -Stdlib.List.dropWhile_v0 [] (fun item -> item < 3L) = [] - -Stdlib.List.empty_v0 = [] - -(Stdlib.List.iter [ 1L; 2L; 3L ] (fun x -> Builtin.testIncrementSideEffectCounter ()) - - Builtin.testSideEffectCount ()) = 3L - -(Stdlib.List.iter [ 1L; 2L; 3L; 4L; 5L ] (fun x -> - if x % 2L == 0L then - Builtin.testIncrementSideEffectCounter ()) - - Builtin.testSideEffectCount ()) = 2L - -(Stdlib.List.iter [] (fun x -> Builtin.testIncrementSideEffectCounter ()) - - Builtin.testSideEffectCount ()) = 0L - -(Stdlib.List.iter [ 10L; 20L; 30L ] (fun x -> - Builtin.testIncrementSideEffectCounter () - Builtin.testIncrementSideEffectCounter ()) - - Builtin.testSideEffectCount ()) = 6L - -(Stdlib.List.iter [ 1L; 2L; 3L ] (fun x -> - if x > 2L then - Builtin.testIncrementSideEffectCounter ()) - - Builtin.testSideEffectCount ()) = 1L - +Stdlib.List.all [] (fun item -> item < 3L) == true +Stdlib.List.all [ 2L ] (fun item -> item < 3L) == true +Stdlib.List.all [ 1L; 2L ] (fun item -> item < 3L) == true +Stdlib.List.all [ 4L ] (fun item -> item < 3L) == false +Stdlib.List.all [ 1L; 4L ] (fun item -> item < 3L) == false + + +Stdlib.List.append [ 1L; 2L; 3L ] [ 4L; 5L; 6L ] == [ 1L; 2L; 3L; 4L; 5L; 6L ] + +Stdlib.List.append [ 3L; 4L ] [ 5L; 6L ] == [ 3L; 4L; 5L; 6L ] +Stdlib.List.append [ 1L ] [ 2L ] == [ 1L; 2L ] +Stdlib.List.append [] [] == [] + + +Stdlib.List.drop [ "a"; "b"; "c"; "d" ] -3L == [ "a"; "b"; "c"; "d" ] + +Stdlib.List.drop [ "a"; "b"; "c"; "d" ] 3L == [ "d" ] +Stdlib.List.drop [ 1L; 2L; 3L; 4L ] -1L == [ 1L; 2L; 3L; 4L ] +Stdlib.List.drop [ 1L; 2L; 3L; 4L ] 0L == [ 1L; 2L; 3L; 4L ] +Stdlib.List.drop [ 1L; 2L; 3L; 4L ] 440737095L == [] +Stdlib.List.drop [ 1L; 2L; 3L; 4L ] 1184467440737095L == [] +Stdlib.List.drop [ 1L; 2L; 3L; 4L ] 2L == [ 3L; 4L ] +Stdlib.List.drop [ 1L; 2L; 3L; 4L ] 4L == [] +Stdlib.List.drop [ 1L; 2L; 3L; 4L ] 5L == [] +Stdlib.List.drop [ 3L; 3L; 3L ] 0L == [ 3L; 3L; 3L ] +Stdlib.List.drop [ 5L; 4L; 3L; 2L; 1L ] 5L == [] +Stdlib.List.drop [ 5L ] 4L == [] +Stdlib.List.drop [] 4L == [] + +Stdlib.List.dropWhile [ 1L; 2L; 3L; 4L ] (fun item -> 0L - 1L) +== Builtin.testDerrorMessage "If only supports Booleans" + +Stdlib.List.dropWhile [ 1L; 2L; 3L; 4L ] (fun item -> item < 3L) == [ 3L; 4L ] + +Stdlib.List.dropWhile [ 1L; 2L; 3L; 4L ] (fun item -> item >= 1L) == [] + +Stdlib.List.dropWhile [ 1L; 5L; 2L; 2L ] (fun item -> item < 3L) +== [ 5L; 2L; 2L ] + +Stdlib.List.dropWhile [] (fun item -> item < 3L) == [] + +Stdlib.List.empty == [] + +//CLEANUP: had to use `let _ =` because we don't have support for EStatement yet + (had to align lambda's parens for the tests to parse correctly) +(let _ = + Stdlib.List.iter + [ 1L; 2L; 3L ] + (fun x -> Builtin.testIncrementSideEffectCounter ()) + Builtin.testSideEffectCount ()) +== 3L + +(let _ = + Stdlib.List.iter + [ 1L; 2L; 3L; 4L; 5L ] + (fun x -> + if x % 2L == 0L then + Builtin.testIncrementSideEffectCounter () + ) + Builtin.testSideEffectCount ()) +== 2L + +(let _ = + Stdlib.List.iter + [] + (fun x -> Builtin.testIncrementSideEffectCounter ()) + Builtin.testSideEffectCount ()) +== 0L + +(let _ = + Stdlib.List.iter + [ 10L; 20L; 30L ] + (fun x -> + let _ = Builtin.testIncrementSideEffectCounter () + Builtin.testIncrementSideEffectCounter () + ) + Builtin.testSideEffectCount ()) +== 6L + +(let _ = + Stdlib.List.iter + [ 1L; 2L; 3L ] + (fun x -> + if x > 2L then + Builtin.testIncrementSideEffectCounter () + ) + Builtin.testSideEffectCount ()) +== 1L Stdlib.List.filter [ 1L; 2L; 3L ] (fun item -> match item with - | 1L -> Stdlib.Option.Option.None + | 1L -> Stdlib.Option.Option.None() | 2L -> false - | 3L -> true) = Builtin.testDerrorMessage "If only supports Booleans" + | 3L -> true) == Builtin.testDerrorMessage "If only supports Booleans" -Stdlib.List.filter [ true; false; true ] (fun item -> "a") = Builtin.testDerrorMessage +Stdlib.List.filter [ true; false; true ] (fun item -> "a") == Builtin.testDerrorMessage "If only supports Booleans" Stdlib.List.filter [ 1L; 2L; 3L ] (fun item -> match item with | 1L -> true | 2L -> false - | 3L -> true) = [ 1L; 3L ] + | 3L -> true) == [ 1L; 3L ] -Stdlib.List.filter [] (fun item -> true) = [] -Stdlib.List.filter [ -20L; 5L; 9L ] (fun x -> x > 20L) = [] -Stdlib.List.filter [] (fun item -> "a") = [] +Stdlib.List.filter [] (fun item -> true) == [] +Stdlib.List.filter [ -20L; 5L; 9L ] (fun x -> x > 20L) == [] +Stdlib.List.filter [] (fun item -> "a") == [] -Stdlib.List.filterMap_v0 [ 1L; 2L; 3L ] (fun item -> +Stdlib.List.filterMap [ 1L; 2L; 3L ] (fun item -> if item == 2L then - Stdlib.Option.Option.None + Stdlib.Option.Option.None() else - (Stdlib.Option.Option.Some(item * 2L))) = [ 2L; 6L ] + (Stdlib.Option.Option.Some(item * 2L))) == [ 2L; 6L ] -Stdlib.List.filterMap_v0 [] (fun item -> 0L) = [] +Stdlib.List.filterMap [] (fun item -> 0L) == [] -Stdlib.List.findFirst [ 1L; 2L; 3L ] (fun x -> x > 5L) = Stdlib.Option.Option.None -Stdlib.List.findFirst [] (fun x -> x) = Stdlib.Option.Option.None +Stdlib.List.findFirst [ 1L; 2L; 3L ] (fun x -> x > 5L) == Stdlib.Option.Option.None() +Stdlib.List.findFirst [] (fun x -> x) == Stdlib.Option.Option.None() -Stdlib.List.findFirst [ 1L; 2L; 3L; 1L; 4L ] (fun x -> x > 1L) = Stdlib.Option.Option.Some - 2L +Stdlib.List.findFirst [ 1L; 2L; 3L; 1L; 4L ] (fun x -> x > 1L) == Stdlib.Option.Option.Some(2L) -Stdlib.List.findFirst [ 0L; 5L; -6L; -10L ] (fun x -> x < 0L) = Stdlib.Option.Option.Some - -6L +Stdlib.List.findFirst [ 0L; 5L; -6L; -10L ] (fun x -> x < 0L) == Stdlib.Option.Option.Some(-6L) -Stdlib.List.findFirst [ 1L; -33L; 3L; -2L; 12L ] (fun x -> (x < 0L && x % 2L == 0L)) = Stdlib.Option.Option.Some - -2L +Stdlib.List.findFirst [ 1L; -33L; 3L; -2L; 12L ] (fun x -> (x < 0L && x % 2L == 0L)) == Stdlib.Option.Option.Some(-2L) -// CLEANUP once DList contains typeRefs, this test may be uncommented and the error message updated: -// Stdlib.List.flatten_v0 [1;2;3] = -// Builtin.testRuntimeError "In List.flatten's 1st argument (`list`), the value should be a List>. However, a List ([1; 2; 3]) was passed instead.\n\nExpected: List>\nActual: List: [1; 2; 3]" -Stdlib.List.flatten_v0 [ [ 1L ]; [ 2L ]; [ 3L ] ] = [ 1L; 2L; 3L ] +// CLEANUP once DList contains typeRefs, this test may be uncommented and the error message updated +Stdlib.List.flatten [1;2;3] = + Builtin.testRuntimeError "In List.flatten's 1st argument (`list`), the value should be a List>. However, a List ([1; 2; 3]) was passed instead.\n\nExpected: List>\nActual: List: [1; 2; 3]" +Stdlib.List.flatten [ [ 1L ]; [ 2L ]; [ 3L ] ] == [ 1L; 2L; 3L ] -Stdlib.List.flatten_v0 [ [ 1L ]; [ [ 2L; 3L ] ] ] = Builtin.testDerrorMessage +Stdlib.List.flatten [ [ 1L ]; [ [ 2L; 3L ] ] ] == Builtin.testDerrorMessage "Could not merge types List>> and List>" -Stdlib.List.flatten_v0 [ [ [] ] ] = [ [] ] -Stdlib.List.flatten_v0 [ [] ] = [] -Stdlib.List.flatten_v0 [] = [] +Stdlib.List.flatten [ [ [] ] ] == [ [] ] +Stdlib.List.flatten [ [] ] == [] +Stdlib.List.flatten [] == [] -Stdlib.List.fold_v0 [ "a"; "b"; "c"; "d" ] "x" (fun accum curr -> accum ++ curr) = "xabcd" +Stdlib.List.fold [ "a"; "b"; "c"; "d" ] "x" (fun accum curr -> accum ++ curr) == "xabcd" -Stdlib.List.fold_v0 [ 1L; 2L; 3L; 4L; 5L ] [] (fun accum curr -> - Stdlib.List.pushBack_v0 accum (curr + 1L)) = [ 2L; 3L; 4L; 5L; 6L ] +Stdlib.List.fold [ 1L; 2L; 3L; 4L; 5L ] [] (fun accum curr -> + Stdlib.List.pushBack accum (curr + 1L)) == [ 2L; 3L; 4L; 5L; 6L ] -Stdlib.List.fold_v0 [] [] (fun accum curr -> 5L) = [] +Stdlib.List.fold [] [] (fun accum curr -> 5L) == [] -Stdlib.List.getAt [ "a"; "b"; "c"; "d" ] -1L = Stdlib.Option.Option.None -Stdlib.List.getAt [ 0L ] 1L = Stdlib.Option.Option.None -Stdlib.List.getAt [] 1L = Stdlib.Option.Option.None -Stdlib.List.getAt [ 1L; 2L; 3L; 4L ] 6018427387902L = Stdlib.Option.Option.None +Stdlib.List.getAt [ "a"; "b"; "c"; "d" ] -1L == Stdlib.Option.Option.None() +Stdlib.List.getAt [ 0L ] 1L == Stdlib.Option.Option.None() +Stdlib.List.getAt [] 1L == Stdlib.Option.Option.None() +Stdlib.List.getAt [ 1L; 2L; 3L; 4L ] 6018427387902L == Stdlib.Option.Option.None() -Stdlib.List.getAt [ 1L; 2L; 3L; 4L ] 0L = Stdlib.Option.Option.Some 1L +Stdlib.List.getAt [ 1L; 2L; 3L; 4L ] 0L == Stdlib.Option.Option.Some(1L) -Stdlib.List.getAt [ 3L; 3L; 3L ] -5L = Stdlib.Option.Option.None -Stdlib.List.getAt [ 3L; 3L; 3L ] 2147483648L = Stdlib.Option.Option.None +Stdlib.List.getAt [ 3L; 3L; 3L ] -5L == Stdlib.Option.Option.None() +Stdlib.List.getAt [ 3L; 3L; 3L ] 2147483648L == Stdlib.Option.Option.None() -Stdlib.List.head [ 1L; 2L; 3L ] = Stdlib.Option.Option.Some 1L +Stdlib.List.head [ 1L; 2L; 3L ] == Stdlib.Option.Option.Some(1L) -Stdlib.List.head [ Builtin.testRuntimeError "test" ] = Builtin.testDerrorMessage +Stdlib.List.head [ Builtin.testRuntimeError "test" ] == Builtin.testDerrorMessage "test" -Stdlib.List.head [] = Stdlib.Option.Option.None +Stdlib.List.head [] == Stdlib.Option.Option.None() -Stdlib.List.indexedMap_v0 [ 3L; 2L; 1L ] (fun i v -> v - i) = [ 3L; 1L; -1L ] +Stdlib.List.indexedMap [ 3L; 2L; 1L ] (fun i v -> v - i) == [ 3L; 1L; -1L ] -Stdlib.List.indexedMap_v0 [] (fun i v -> v - i) = [] +Stdlib.List.indexedMap [] (fun i v -> v - i) == [] -Stdlib.List.indexedMap_v0 [ 3L; 2L; 1L ] (fun i v -> i) = [ 0L; 1L; 2L ] +Stdlib.List.indexedMap [ 3L; 2L; 1L ] (fun i v -> i) == [ 0L; 1L; 2L ] -Stdlib.List.interleave_v0 [ 1L; 2L; 3L ] [ 4L; 5L; 6L ] = [ 1L; 4L; 2L; 5L; 3L; 6L ] +Stdlib.List.interleave [ 1L; 2L; 3L ] [ 4L; 5L; 6L ] +== [ 1L; 4L; 2L; 5L; 3L; 6L ] -Stdlib.List.interleave_v0 [ 1L; 2L; 3L ] [ 4L ] = [ 1L; 4L; 2L; 3L ] -Stdlib.List.interleave_v0 [ 1L; 2L; 3L ] [] = [ 1L; 2L; 3L ] -Stdlib.List.interleave_v0 [ 1L ] [ 4L; 5L; 6L ] = [ 1L; 4L; 5L; 6L ] -Stdlib.List.interleave_v0 [] [ 4L; 5L; 6L ] = [ 4L; 5L; 6L ] -Stdlib.List.interleave_v0 [] [] = [] +Stdlib.List.interleave [ 1L; 2L; 3L ] [ 4L ] == [ 1L; 4L; 2L; 3L ] +Stdlib.List.interleave [ 1L; 2L; 3L ] [] == [ 1L; 2L; 3L ] +Stdlib.List.interleave [ 1L ] [ 4L; 5L; 6L ] == [ 1L; 4L; 5L; 6L ] +Stdlib.List.interleave [] [ 4L; 5L; 6L ] == [ 4L; 5L; 6L ] +Stdlib.List.interleave [] [] == [] -Stdlib.List.interleave_v0 [ "a"; "b"; "c" ] [ 0L ] = Builtin.testDerrorMessage - "Could not merge types List and List" +Stdlib.List.interleave [ "a"; "b"; "c" ] [ 0L ] +== Builtin.testDerrorMessage "Could not merge types List and List" + +Stdlib.List.interpose [ 1L; 2L; 3L ] 5L == [ 1L; 5L; 2L; 5L; 3L ] +Stdlib.List.interpose [ 1L ] 5L == [ 1L ] -Stdlib.List.interpose_v0 [ 1L; 2L; 3L ] 5L = [ 1L; 5L; 2L; 5L; 3L ] -Stdlib.List.interpose_v0 [ 1L ] 5L = [ 1L ] -Stdlib.List.interpose_v0 [] 5L = [] +Stdlib.List.interpose [] 5L == [] -Stdlib.List.interpose_v0 [ "a"; "b"; "c" ] 0L = Builtin.testDerrorMessage +Stdlib.List.interpose [ "a"; "b"; "c" ] 0L == Builtin.testDerrorMessage "Could not merge types List and List" -Stdlib.List.isEmpty_v0 [ 1L ] = false -Stdlib.List.isEmpty_v0 [] = true +Stdlib.List.isEmpty [ 1L ] == false +Stdlib.List.isEmpty [] == true -Stdlib.List.last [ 1L; 2L; 3L ] = Stdlib.Option.Option.Some 3L +Stdlib.List.last [ 1L; 2L; 3L ] == Stdlib.Option.Option.Some(3L) -Stdlib.List.last [ Builtin.testRuntimeError "test" ] = Builtin.testDerrorMessage +Stdlib.List.last [ Builtin.testRuntimeError "test" ] == Builtin.testDerrorMessage "test" -Stdlib.List.last [] = Stdlib.Option.Option.None +Stdlib.List.last [] == Stdlib.Option.Option.None() -Stdlib.List.length_v0 [ 1L; 2L; 3L ] = 3L -Stdlib.List.length_v0 [] = 0L +Stdlib.List.length [ 1L; 2L; 3L ] == 3L +Stdlib.List.length [] == 0L -Stdlib.List.map_v0 (Stdlib.List.range_v0 1L 5L) (fun x -> x + 1L) = [ 2L - 3L - 4L - 5L - 6L ] +Stdlib.List.map (Stdlib.List.range 1L 5L) (fun x -> x + 1L) == [ 2L + 3L + 4L + 5L + 6L ] -Stdlib.List.map_v0 [ 1L; 2L; 3L ] (fun x -> - Stdlib.Bool.and_v0 - (Stdlib.Int64.greaterThanOrEqualTo_v0 x 0L) - (Stdlib.Int64.lessThanOrEqualTo_v0 x 4L)) = [ true; true; true ] +(Stdlib.List.map [ 1L; 2L; 3L ] (fun x -> + Stdlib.Bool.and + (Stdlib.Int64.greaterThanOrEqualTo x 0L) + (Stdlib.Int64.lessThanOrEqualTo x 4L))) == [ true; true; true ] -Stdlib.List.map_v0 [ 1L; 2L ] (fun x -> x + 1L) = [ 2L; 3L ] -Stdlib.List.map_v0 [] (fun x -> x + 1L) = [] +Stdlib.List.map [ 1L; 2L ] (fun x -> x + 1L) == [ 2L; 3L ] +Stdlib.List.map [] (fun x -> x + 1L) == [] -Stdlib.List.map2_v0 [ 10L; 20L; 30L ] [ 1L; 2L; 3L ] (fun a b -> a - b) = Stdlib.Option.Option.Some - [ 9L; 18L; 27L ] +Stdlib.List.map2 [ 10L; 20L; 30L ] [ 1L; 2L; 3L ] (fun a b -> a - b) == Stdlib.Option.Option.Some([ 9L; 18L; 27L ]) -Stdlib.List.map2_v0 [ 10L; 20L ] [ 1L; 2L; 3L ] (fun a b -> a - b) = Stdlib.Option.Option.None +Stdlib.List.map2 [ 10L; 20L ] [ 1L; 2L; 3L ] (fun a b -> a - b) == Stdlib.Option.Option.None() -Stdlib.List.map2_v0 [] [] (fun a b -> a - b) = Stdlib.Option.Option.Some [] +Stdlib.List.map2 [] [] (fun a b -> a - b) == Stdlib.Option.Option.Some([]) -Stdlib.List.map2shortest_v0 [ 10L; 20L; 30L ] [ 1L; 2L; 3L ] (fun a b -> a - b) = [ 9L - 18L - 27L ] +Stdlib.List.map2shortest [ 10L; 20L; 30L ] [ 1L; 2L; 3L ] (fun a b -> a - b) == [ 9L + 18L + 27L ] -Stdlib.List.map2shortest_v0 [ 10L; 20L ] [ 1L; 2L; 3L ] (fun a b -> a - b) = [ 9L - 18L ] +Stdlib.List.map2shortest [ 10L; 20L ] [ 1L; 2L; 3L ] (fun a b -> a - b) == [ 9L + 18L ] -Stdlib.List.map2shortest_v0 [] [ 1L; 2L; 3L ] (fun a b -> a - b) = [] -Stdlib.List.map2shortest_v0 [ 1L; 2L; 3L ] [] (fun a b -> a - b) = [] +Stdlib.List.map2shortest [] [ 1L; 2L; 3L ] (fun a b -> a - b) == [] +Stdlib.List.map2shortest [ 1L; 2L; 3L ] [] (fun a b -> a - b) == [] -Stdlib.List.member_v0 [ 1L; 2L; 3L ] 2L = true -Stdlib.List.member_v0 [ 1L; 2L; 3L ] 4L = false -Stdlib.List.member_v0 [] 1L = false +Stdlib.List.member [ 1L; 2L; 3L ] 2L == true +Stdlib.List.member [ 1L; 2L; 3L ] 4L == false +Stdlib.List.member [] 1L == false -Stdlib.List.partition_v0 [ -20L; 5L; 9L ] (fun x -> x > 0L) = ([ 5L; 9L ], [ -20L ]) +Stdlib.List.partition [ -20L; 5L; 9L ] (fun x -> x > 0L) == ([ 5L; 9L ], [ -20L ]) -Stdlib.List.partition_v0 [] (fun item -> true) = ([], []) -Stdlib.List.partition_v0 [] (fun item -> "a") = ([], []) +Stdlib.List.partition [] (fun item -> true) == ([], []) +Stdlib.List.partition [] (fun item -> "a") == ([], []) -Stdlib.List.partition_v0 [ 1L; 2L; 3L ] (fun item -> +Stdlib.List.partition [ 1L; 2L; 3L ] (fun item -> match item with | 1L -> true | 2L -> false - | 3L -> true) = ([ 1L; 3L ], [ 2L ]) + | 3L -> true) == ([ 1L; 3L ], [ 2L ]) -Stdlib.List.partition_v0 [ true; false; true ] (fun item -> "a") = Builtin.testDerrorMessage - "If only supports Booleans" +//recheck this +Stdlib.List.partition [ true; false; true ] (fun item -> "a") == Builtin.testDerrorMessage "If only supports Booleans" -Stdlib.List.partition_v0 [ 1L; 2L; 3L ] (fun item -> +Stdlib.List.partition [ 1L; 2L; 3L ] (fun item -> match item with - | 1L -> Stdlib.Option.Option.None + | 1L -> Stdlib.Option.Option.None() | 2L -> false - | 3L -> true) = Builtin.testDerrorMessage "If only supports Booleans" + | 3L -> true) == Builtin.testDerrorMessage "If only supports Booleans" + +Stdlib.List.pushBack [ 2L; 3L ] 1L == [ 2L; 3L; 1L ] -Stdlib.List.pushBack_v0 [ 2L; 3L ] 1L = [ 2L; 3L; 1L ] -Stdlib.List.pushBack_v0 [] 1L = [ 1L ] +Stdlib.List.pushBack [] 1L == [ 1L ] -Stdlib.List.push_v0 [ 2L; 3L ] 1L = [ 1L; 2L; 3L ] -Stdlib.List.push_v0 [] 1L = [ 1L ] +Stdlib.List.push [ 2L; 3L ] 1L == [ 1L; 2L; 3L ] +Stdlib.List.push [] 1L == [ 1L ] -Stdlib.List.randomElement_v0 [ 1L ] = Stdlib.Option.Option.Some 1L +Stdlib.List.randomElement [ 1L ] == Stdlib.Option.Option.Some(1L) -Stdlib.List.randomElement_v0 [ Builtin.testRuntimeError "test" ] = Builtin.testDerrorMessage +Stdlib.List.randomElement [ Builtin.testRuntimeError "test" ] == Builtin.testDerrorMessage "test" -Stdlib.List.randomElement_v0 [] = Stdlib.Option.Option.None +Stdlib.List.randomElement [] == Stdlib.Option.Option.None() -Stdlib.List.range_v0 -1L 0L = [ -1L; 0L ] +Stdlib.List.range -1L 0L == [ -1L; 0L ] -Stdlib.List.range_v0 -5L 5L = [ -5L; -4L; -3L; -2L; -1L; 0L; 1L; 2L; 3L; 4L; 5L ] +Stdlib.List.range -5L 5L == [ -5L; -4L; -3L; -2L; -1L; 0L; 1L; 2L; 3L; 4L; 5L ] -Stdlib.List.range_v0 5L 0L = [] +Stdlib.List.range 5L 0L == [] -Stdlib.List.repeat_v0 0L 1L = Stdlib.Result.Result.Ok [] +Stdlib.List.repeat 0L 1L == Stdlib.Result.Result.Ok([]) -Stdlib.List.repeat_v0 1L "a" = Stdlib.Result.Result.Ok [ "a" ] +Stdlib.List.repeat 1L "a" == Stdlib.Result.Result.Ok([ "a" ]) -Stdlib.List.repeat_v0 1L 1L = Stdlib.Result.Result.Ok [ 1L ] +Stdlib.List.repeat 1L 1L == Stdlib.Result.Result.Ok([ 1L ]) -Stdlib.List.repeat_v0 3L 1L = Stdlib.Result.Result.Ok [ 1L; 1L; 1L ] +Stdlib.List.repeat 3L 1L == Stdlib.Result.Result.Ok([ 1L; 1L; 1L ]) -Stdlib.List.repeat_v0 3L 3L = Stdlib.Result.Result.Ok [ 3L; 3L; 3L ] +Stdlib.List.repeat 3L 3L == Stdlib.Result.Result.Ok([ 3L; 3L; 3L ]) -Stdlib.List.repeat_v0 5L "a" = Stdlib.Result.Result.Ok [ "a"; "a"; "a"; "a"; "a" ] +Stdlib.List.repeat 5L "a" == Stdlib.Result.Result.Ok([ "a"; "a"; "a"; "a"; "a" ]) -Stdlib.List.repeat_v0 -4L "a" = Stdlib.Result.Result.Error - "Expected `times` to be positive, but it was `-4`" +Stdlib.List.repeat -4L "a" == Stdlib.Result.Result.Error + ("Expected `times` to be positive, but it was `-4`") -Stdlib.List.repeat_v0 3L [ 1L; 2L; 3L ] = Stdlib.Result.Result.Ok - [ [ 1L; 2L; 3L ]; [ 1L; 2L; 3L ]; [ 1L; 2L; 3L ] ] +Stdlib.List.repeat 3L [ 1L; 2L; 3L ] == Stdlib.Result.Result.Ok + ([ [ 1L; 2L; 3L ]; [ 1L; 2L; 3L ]; [ 1L; 2L; 3L ] ]) -Stdlib.List.repeat_v0 3L [] = Stdlib.Result.Result.Ok [ []; []; [] ] +Stdlib.List.repeat 3L [] == Stdlib.Result.Result.Ok([ []; []; [] ]) -Stdlib.List.reverse_v0 [ "a"; "b"; "c"; "d" ] = [ "d"; "c"; "b"; "a" ] +Stdlib.List.reverse [ "a"; "b"; "c"; "d" ] == [ "d"; "c"; "b"; "a" ] -Stdlib.List.reverse_v0 [ 5L; 4L; 3L; 2L; 1L ] = [ 1L; 2L; 3L; 4L; 5L ] +Stdlib.List.reverse [ 5L; 4L; 3L; 2L; 1L ] == [ 1L; 2L; 3L; 4L; 5L ] -Stdlib.List.reverse_v0 [] = [] +Stdlib.List.reverse [] == [] -Stdlib.List.singleton_v0 1L = [ 1L ] +Stdlib.List.singleton 1L == [ 1L ] -Stdlib.List.sortBy_v0 [ 6L; 2L; 8L; 3L ] (fun x -> 0L - x) = [ 8L; 6L; 3L; 2L ] +Stdlib.List.sortBy [ 6L; 2L; 8L; 3L ] (fun x -> 0L - x) == [ 8L; 6L; 3L; 2L ] -Stdlib.List.sortBy_v0 [] (fun x -> 0L - x) = [] +Stdlib.List.sortBy [] (fun x -> 0L - x) == [] -Stdlib.List.sort_v0 [ "6"; "2"; "8"; "3" ] = [ "2"; "3"; "6"; "8" ] -Stdlib.List.sort_v0 [ 6L; 2L; 8L; 3L ] = [ 2L; 3L; 6L; 8L ] -Stdlib.List.sort_v0 [] = [] +Stdlib.List.sort [ "6"; "2"; "8"; "3" ] == [ "2"; "3"; "6"; "8" ] +Stdlib.List.sort [ 6L; 2L; 8L; 3L ] == [ 2L; 3L; 6L; 8L ] +Stdlib.List.sort [] == [] -Stdlib.List.sortByComparator_v0 [ 3L; 1L; 2L ] (fun a b -> 0.1) = Builtin.testDerrorMessage +Stdlib.List.sortByComparator [ 3L; 1L; 2L ] (fun a b -> 0.1) == Builtin.testDerrorMessage "Function return value should be an Int64. However, a Float (0.1) was returned instead.\n\nExpected: Int64\nActual: a Float: 0.1" -Stdlib.List.sortByComparator_v0 [ 3L; 1L; 2L ] (fun a b -> 3L) = Stdlib.Result.Result.Error - "Expected comparator function to return -1, 0, or 1, but it returned 3" +Stdlib.List.sortByComparator [ 3L; 1L; 2L ] (fun a b -> 3L) == Stdlib.Result.Result.Error + ("Expected comparator function to return -1, 0, or 1, but it returned 3") -Stdlib.List.sortByComparator_v0 [ 1L; 2L; 3L ] (fun a b -> "㧑༷釺") = Builtin.testDerrorMessage +Stdlib.List.sortByComparator [ 1L; 2L; 3L ] (fun a b -> "㧑༷釺") == Builtin.testDerrorMessage "Function return value should be an Int64. However, a String (\"㧑༷釺\") was returned instead.\n\nExpected: Int64\nActual: a String: \"㧑༷釺\"" -Stdlib.List.sortByComparator_v0 [ 3L; 1L; 2L ] (fun a b -> - if Stdlib.Int64.lessThan_v0 a b then -1L else 1L) = Stdlib.Result.Result.Ok - [ 1L; 2L; 3L ] +Stdlib.List.sortByComparator [ 3L; 1L; 2L ] (fun a b -> + if Stdlib.Int64.lessThan a b then -1L else 1L) == Stdlib.Result.Result.Ok + ([ 1L; 2L; 3L ]) -Stdlib.List.sortByComparator_v0 [] (fun a b -> - if Stdlib.Int64.lessThan_v0 a b then -1L else 1L) = Stdlib.Result.Result.Ok [] +Stdlib.List.sortByComparator [] (fun a b -> + if Stdlib.Int64.lessThan a b then -1L else 1L) == Stdlib.Result.Result.Ok([]) -Stdlib.List.sortByComparator_v0 +// had to change the format of this test for it to pass +Stdlib.List.sortByComparator [ 3L 1L 2L @@ -332,180 +351,176 @@ Stdlib.List.sortByComparator_v0 -1L -1L -1L ] - (fun a b -> if Stdlib.Int64.lessThan_v0 a b then -1L else 1L) = Stdlib.Result.Result.Ok - [ -1L - -1L - -1L - -1L - 1L - 2L - 2L - 2L - 3L - 3L - 3L - 3L - 5L - 5L - 5L - 6L - 6L - 63L - 67L ] + (fun a b -> if Stdlib.Int64.lessThan a b then -1L else 1L) +== Stdlib.Result.Result.Ok + ([ -1L + -1L + -1L + -1L + 1L + 2L + 2L + 2L + 3L + 3L + 3L + 3L + 5L + 5L + 5L + 6L + 6L + 63L + 67L ]) // CLEANUP this error message is not ideal in 2 ways: // - The error does not provide context that the issue is with the fn specifically // - it seems to be from the perspective of the lambda // (I'm a lambda and I'm expecting 2 arguments, but I got 1!!) // rather than from the perspective of the function it's being used in -Stdlib.List.sortByComparator_v0 [ 6.0; 2.0 ] (fun x -> x) = Builtin.testDerrorMessage +Stdlib.List.sortByComparator [ 6.0; 2.0 ] (fun x -> x) == Builtin.testDerrorMessage "Expected 1 arguments, got 2" -Stdlib.List.tail_v0 [ 10L; 20L; 30L; 40L ] = Stdlib.Option.Option.Some - [ 20L; 30L; 40L ] +Stdlib.List.tail [ 10L; 20L; 30L; 40L ] == Stdlib.Option.Option.Some + ([ 20L; 30L; 40L ]) -Stdlib.List.tail_v0 [] = Stdlib.Option.Option.None +Stdlib.List.tail [] == Stdlib.Option.Option.None() -Stdlib.List.take_v0 [ "a"; "b"; "c"; "d" ] -1L = [] +Stdlib.List.take [ "a"; "b"; "c"; "d" ] -1L == [] -Stdlib.List.take_v0 [ "a"; "b"; "c"; "d" ] 2147483648L = [ "a"; "b"; "c"; "d" ] +Stdlib.List.take [ "a"; "b"; "c"; "d" ] 2147483648L == [ "a"; "b"; "c"; "d" ] -Stdlib.List.take_v0 [ "a"; "b"; "c"; "d" ] 3L = [ "a"; "b"; "c" ] -Stdlib.List.take_v0 [ 3L; 3L; 3L ] 0L = [] +Stdlib.List.take [ "a"; "b"; "c"; "d" ] 3L == [ "a"; "b"; "c" ] +Stdlib.List.take [ 3L; 3L; 3L ] 0L == [] -Stdlib.List.take_v0 [ 5L; 4L; 3L; 2L; 1L ] 5L = [ 5L; 4L; 3L; 2L; 1L ] +Stdlib.List.take [ 5L; 4L; 3L; 2L; 1L ] 5L == [ 5L; 4L; 3L; 2L; 1L ] -Stdlib.List.take_v0 [ 5L ] 4L = [ 5L ] -Stdlib.List.take_v0 [] 4L = [] +Stdlib.List.take [ 5L ] 4L == [ 5L ] +Stdlib.List.take [] 4L == [] //TODO: better error message -Stdlib.List.takeWhile_v0 [ 1L; 2L; 3L; 4L ] (fun item -> 0L - 1L) = Builtin.testDerrorMessage +Stdlib.List.takeWhile [ 1L; 2L; 3L; 4L ] (fun item -> 0L - 1L) == Builtin.testDerrorMessage "If only supports Booleans" -Stdlib.List.takeWhile_v0 [ 1L; 2L; 3L; 4L ] (fun item -> item < 1L) = [] +Stdlib.List.takeWhile [ 1L; 2L; 3L; 4L ] (fun item -> item < 1L) == [] -Stdlib.List.takeWhile_v0 [ 1L; 2L; 3L; 4L ] (fun item -> item < 3L) = [ 1L; 2L ] +Stdlib.List.takeWhile [ 1L; 2L; 3L; 4L ] (fun item -> item < 3L) == [ 1L; 2L ] -Stdlib.List.takeWhile_v0 [ 1L; 5L; 2L; 2L ] (fun item -> item < 3L) = [ 1L ] -Stdlib.List.takeWhile_v0 [] (fun item -> item < 3L) = [] +Stdlib.List.takeWhile [ 1L; 5L; 2L; 2L ] (fun item -> item < 3L) == [ 1L ] +Stdlib.List.takeWhile [] (fun item -> item < 3L) == [] // it isn't specified which is the right value to keep when there are duplicates -Stdlib.List.uniqueBy_v0 [ 1L; 2L; 3L; 4L ] (fun x -> Stdlib.Int64.divide_v0 x 2L) = [ 1L - 2L - 4L ] +Stdlib.List.uniqueBy [ 1L; 2L; 3L; 4L ] (fun x -> Stdlib.Int64.divide x 2L) == [ 1L + 2L + 4L ] -Stdlib.List.uniqueBy_v0 [ 1L; 2L; 3L; 4L ] (fun x -> x) = [ 1L; 2L; 3L; 4L ] +Stdlib.List.uniqueBy [ 1L; 2L; 3L; 4L ] (fun x -> x) == [ 1L; 2L; 3L; 4L ] -Stdlib.List.uniqueBy_v0 [ 1L; 1L; 1L; 1L ] (fun x -> x) = [ 1L ] +Stdlib.List.uniqueBy [ 1L; 1L; 1L; 1L ] (fun x -> x) == [ 1L ] -Stdlib.List.uniqueBy_v0 [ 7L; 42L; 7L; 2L; 10L ] (fun x -> x) = [ 2L; 7L; 10L; 42L ] +Stdlib.List.uniqueBy [ 7L; 42L; 7L; 2L; 10L ] (fun x -> x) == [ 2L; 7L; 10L; 42L ] -Stdlib.List.uniqueBy_v0 [] (fun x -> x) = [] +Stdlib.List.uniqueBy [] (fun x -> x) == [] -Stdlib.List.uniqueBy_v0 [ 6L; 2.0 ] (fun x -> x) = Builtin.testDerrorMessage +Stdlib.List.uniqueBy [ 6L; 2.0 ] (fun x -> x) == Builtin.testDerrorMessage "Could not merge types List and List" -Stdlib.List.unique_v0 [ 1L; 2L; 3L; 4L ] = [ 1L; 2L; 3L; 4L ] -Stdlib.List.unique_v0 [ 1L; 1L; 1L; 1L ] = [ 1L ] +Stdlib.List.unique [ 1L; 2L; 3L; 4L ] == [ 1L; 2L; 3L; 4L ] +Stdlib.List.unique [ 1L; 1L; 1L; 1L ] == [ 1L ] -Stdlib.List.unique_v0 [ 7L; 42L; 7L; 2L; 10L ] = [ 2L; 7L; 10L; 42L ] +Stdlib.List.unique [ 7L; 42L; 7L; 2L; 10L ] == [ 2L; 7L; 10L; 42L ] -Stdlib.List.unique_v0 [] = [] +Stdlib.List.unique [] == [] // TODO: more tests, with values of more complex types -Stdlib.List.unzip_v0 [ (1L, 10L); (2L, 20L); (3L, 30L) ] = ([ 1L; 2L; 3L ], - [ 10L; 20L; 30L ]) +Stdlib.List.unzip [ (1L, 10L); (2L, 20L); (3L, 30L) ] == ([ 1L; 2L; 3L ], [ 10L; 20L; 30L ]) -Stdlib.List.unzip_v0 [ (10L, 6L) ] = ([ 10L ], [ 6L ]) +Stdlib.List.unzip [ (10L, 6L) ] == ([ 10L ], [ 6L ]) -Stdlib.List.zipShortest_v0 [ 10L; 20L; 30L ] [ 1L; 2L; 3L ] = [ (10L, 1L) - (20L, 2L) - (30L, 3L) ] +Stdlib.List.zipShortest [ 10L; 20L; 30L ] [ 1L; 2L; 3L ] == [ (10L, 1L) + (20L, 2L) + (30L, 3L) ] -Stdlib.List.zipShortest_v0 [ 10L; 20L; 30L ] [ "a"; "bc"; "d" ] = [ (10L, "a") - (20L, "bc") - (30L, "d") ] +Stdlib.List.zipShortest [ 10L; 20L; 30L ] [ "a"; "bc"; "d" ] == [ (10L, "a") + (20L, "bc") + (30L, "d") ] -Stdlib.List.zipShortest_v0 [ 10L; 20L ] [ 1L; 2L; 3L ] = [ (10L, 1L); (20L, 2L) ] +Stdlib.List.zipShortest [ 10L; 20L ] [ 1L; 2L; 3L ] == [ (10L, 1L); (20L, 2L) ] -Stdlib.List.zipShortest_v0 [ 1L; 2L; 3L ] [ 10L; 20L ] = [ (1L, 10L); (2L, 20L) ] +Stdlib.List.zipShortest [ 1L; 2L; 3L ] [ 10L; 20L ] == [ (1L, 10L); (2L, 20L) ] -Stdlib.List.zipShortest_v0 [ 10L; 20L ] [ "a"; "bc"; "d" ] = [ (10L, "a") - (20L, "bc") ] +Stdlib.List.zipShortest [ 10L; 20L ] [ "a"; "bc"; "d" ] == [ (10L, "a") + (20L, "bc") ] -Stdlib.List.zipShortest_v0 [ "a"; "bc"; "d" ] [ 10L; 20L ] = [ ("a", 10L) - ("bc", 20L) ] +Stdlib.List.zipShortest [ "a"; "bc"; "d" ] [ 10L; 20L ] == [ ("a", 10L) + ("bc", 20L) ] -Stdlib.List.zipShortest_v0 [ "b"; "v"; "z" ] [] = [] -Stdlib.List.zipShortest_v0 [] [ "b"; "v"; "z" ] = [] +Stdlib.List.zipShortest [ "b"; "v"; "z" ] [] == [] +Stdlib.List.zipShortest [] [ "b"; "v"; "z" ] == [] -Stdlib.List.zip_v0 [ 10L; 20L; 30L ] [ 1L; 2L; 3L ] = Stdlib.Option.Option.Some - [ (10L, 1L); (20L, 2L); (30L, 3L) ] +Stdlib.List.zip [ 10L; 20L; 30L ] [ 1L; 2L; 3L ] == Stdlib.Option.Option.Some + ([ (10L, 1L); (20L, 2L); (30L, 3L) ]) -Stdlib.List.zip_v0 [ 10L; 20L ] [ 1L; 2L; 3L ] = Stdlib.Option.Option.None +Stdlib.List.zip [ 10L; 20L ] [ 1L; 2L; 3L ] == Stdlib.Option.Option.None() -Stdlib.List.zip_v0 [] [] = Stdlib.Option.Option.Some [] +Stdlib.List.zip [] [] == Stdlib.Option.Option.Some([]) -Stdlib.List.zip_v0 [ Builtin.testRuntimeError "msg" ] [ Some "" ] = Builtin.testDerrorMessage +Stdlib.List.zip [ Builtin.testRuntimeError "msg" ] [ Some("") ] == Builtin.testDerrorMessage "msg" -Stdlib.List.groupByWithKey_v0 [ 1L; 2L; 3L; 4L; 5L ] (fun x -> - Stdlib.Int64.mod_v0 x 2L) = [ (1L, [ 1L; 3L; 5L ]); (0L, [ 2L; 4L ]) ] +Stdlib.List.groupByWithKey [ 1L; 2L; 3L; 4L; 5L ] (fun x -> + Stdlib.Int64.mod x 2L) == [ (1L, [ 1L; 3L; 5L ]); (0L, [ 2L; 4L ]) ] -Stdlib.List.groupByWithKey_v0 [ 1L; 2L; 3L; 4L; 5L ] (fun x -> - Stdlib.Int64.mod_v0 x 2L) = [ (1L, [ 1L; 3L; 5L ]); (0L, [ 2L; 4L ]) ] +Stdlib.List.groupByWithKey [ 1L; 2L; 3L; 4L; 5L ] (fun x -> + Stdlib.Int64.mod x 2L) == [ (1L, [ 1L; 3L; 5L ]); (0L, [ 2L; 4L ]) ] -Stdlib.List.groupByWithKey_v0 +Stdlib.List.groupByWithKey [ "apple"; "banana"; "avocado"; "grape"; "apricot" ] - (fun s -> Stdlib.String.first_v0 s 1L) = [ ("a", [ "apple"; "avocado"; "apricot" ]) - ("b", [ "banana" ]) - ("g", [ "grape" ]) ] + (fun s -> Stdlib.String.first s 1L) +== [ ("a", [ "apple"; "avocado"; "apricot" ]) + ("b", [ "banana" ]) + ("g", [ "grape" ]) ] -Stdlib.List.groupByWithKey_v0 [ 'a'; 'b'; 'c'; 'a'; 'b' ] (fun c -> c) = [ ('a', - [ 'a' - 'a' ]) - ('b', - [ 'b' - 'b' ]) - ('c', - [ 'c' ]) ] +Stdlib.List.groupByWithKey [ 'a'; 'b'; 'c'; 'a'; 'b' ] (fun c -> c) == [ ('a', [ 'a'; 'a' ]) + ('b', [ 'b'; 'b' ]) + ('c', [ 'c' ]) ] -Stdlib.List.groupByWithKey_v0 [ 1L; 2L; 3L; 4L; 5L ] (fun x -> - Stdlib.Int64.mod_v0 x 2L == 0L) = [ (false, [ 1L; 3L; 5L ]); (true, [ 2L; 4L ]) ] +Stdlib.List.groupByWithKey [ 1L; 2L; 3L; 4L; 5L ] (fun x -> + Stdlib.Int64.mod x 2L == 0L) == [ (false, [ 1L; 3L; 5L ]); (true, [ 2L; 4L ]) ] -Stdlib.List.groupByWithKey_v0 [ 1L; 2L; 3L; 4L; 5L ] (fun x -> - ((Stdlib.Int64.mod_v0 x 2L), "test")) = [ ((1L, "test"), [ 1L; 3L; 5L ]) - ((0L, "test"), [ 2L; 4L ]) ] +Stdlib.List.groupByWithKey [ 1L; 2L; 3L; 4L; 5L ] (fun x -> + ((Stdlib.Int64.mod x 2L), "test")) == [ ((1L, "test"), [ 1L; 3L; 5L ]) + ((0L, "test"), [ 2L; 4L ]) ] -Stdlib.List.groupByWithKey_v0 [] (fun x -> x) = [] +Stdlib.List.groupByWithKey [] (fun x -> x) == [] -Stdlib.List.dropLast [ 1L; 2L; 3L; 4L; 5L ] = [ 1L; 2L; 3L; 4L ] -Stdlib.List.dropLast [ 1L ] = [] -Stdlib.List.dropLast [] = [] +Stdlib.List.dropLast [ 1L; 2L; 3L; 4L; 5L ] == [ 1L; 2L; 3L; 4L ] +Stdlib.List.dropLast [ 1L ] == [] +Stdlib.List.dropLast [] == [] -Stdlib.List.chunkBySize_v0 [ 1L; 2L; 3L; 4L; 5L ] 2L = Stdlib.Result.Result.Ok - [ [ 1L; 2L ]; [ 3L; 4L ]; [ 5L ] ] +Stdlib.List.chunkBySize [ 1L; 2L; 3L; 4L; 5L ] 2L == Stdlib.Result.Result.Ok + ([ [ 1L; 2L ]; [ 3L; 4L ]; [ 5L ] ]) -Stdlib.List.chunkBySize_v0 [ 1L; 2L; 3L; 4L; 5L; 6L ] 3L = Stdlib.Result.Result.Ok - [ [ 1L; 2L; 3L ]; [ 4L; 5L; 6L ] ] +Stdlib.List.chunkBySize [ 1L; 2L; 3L; 4L; 5L; 6L ] 3L == Stdlib.Result.Result.Ok + ([ [ 1L; 2L; 3L ]; [ 4L; 5L; 6L ] ]) -Stdlib.List.chunkBySize_v0 [ 1L; 2L; 3L ] 1L = Stdlib.Result.Result.Ok - [ [ 1L ]; [ 2L ]; [ 3L ] ] +Stdlib.List.chunkBySize [ 1L; 2L; 3L ] 1L == Stdlib.Result.Result.Ok + ([ [ 1L ]; [ 2L ]; [ 3L ] ]) -Stdlib.List.chunkBySize_v0 [ 1L; 2L ] 3L = Stdlib.Result.Result.Ok [ [ 1L; 2L ] ] +Stdlib.List.chunkBySize [ 1L; 2L ] 3L == Stdlib.Result.Result.Ok([ [ 1L; 2L ] ]) -Stdlib.List.chunkBySize_v0 [] 4L = Stdlib.Result.Result.Ok [] +Stdlib.List.chunkBySize [] 4L == Stdlib.Result.Result.Ok([]) -Stdlib.List.chunkBySize_v0 [ 1L; 2L; 3L; 4L ] 0L = Stdlib.Result.Result.Error - Stdlib.List.ChunkBySizeError.SizeMustBeGreaterThanZero +Stdlib.List.chunkBySize [ 1L; 2L; 3L; 4L ] 0L == Stdlib.Result.Result.Error + (Stdlib.List.ChunkBySizeError.SizeMustBeGreaterThanZero()) -Stdlib.List.chunkBySize_v0 [ 1L; 2L; 3L; 4L ] -1L = Stdlib.Result.Result.Error - Stdlib.List.ChunkBySizeError.SizeMustBeGreaterThanZero +Stdlib.List.chunkBySize [ 1L; 2L; 3L; 4L ] -1L == Stdlib.Result.Result.Error + (Stdlib.List.ChunkBySizeError.SizeMustBeGreaterThanZero()) -Stdlib.List.splitLast [] = Stdlib.Option.Option.None -Stdlib.List.splitLast [ 1L ] = Stdlib.Option.Option.Some(([], 1L)) -Stdlib.List.splitLast [ 1L; 2L ] = Stdlib.Option.Option.Some(([ 1L ], 2L)) -Stdlib.List.splitLast [ 1L; 2L; 3L ] = Stdlib.Option.Option.Some(([ 1L; 2L ], 3L)) \ No newline at end of file +Stdlib.List.splitLast [] == Stdlib.Option.Option.None() +Stdlib.List.splitLast [ 1L ] == Stdlib.Option.Option.Some(([], 1L)) +Stdlib.List.splitLast [ 1L; 2L ] == Stdlib.Option.Option.Some(([ 1L ], 2L)) +Stdlib.List.splitLast [ 1L; 2L; 3L ] == Stdlib.Option.Option.Some(([ 1L; 2L ], 3L)) \ No newline at end of file diff --git a/backend/testfiles/execution/stdlib/math.dark b/backend/testfiles/execution/stdlib/math.dark index bfaf2ba0fb..94750fca88 100644 --- a/backend/testfiles/execution/stdlib/math.dark +++ b/backend/testfiles/execution/stdlib/math.dark @@ -1,57 +1,56 @@ -Stdlib.Math.acos_v0 -1.0 = Stdlib.Option.Option.Some 3.14159265359 +Stdlib.Math.acos -1.0 == Stdlib.Option.Option.Some(3.14159265359) -Stdlib.Math.acos_v0 1.0 = Stdlib.Option.Option.Some 0.0 +Stdlib.Math.acos 1.0 == Stdlib.Option.Option.Some(0.0) -Stdlib.Math.acos_v0 5.0 = Stdlib.Option.Option.None +Stdlib.Math.acos 5.0 == Stdlib.Option.Option.None() -Stdlib.Math.asin_v0 0.0 = Stdlib.Option.Option.Some 0.0 +Stdlib.Math.asin 0.0 == Stdlib.Option.Option.Some(0.0) -Stdlib.Math.asin_v0 1.0 = Stdlib.Option.Option.Some 1.57079632679 +Stdlib.Math.asin 1.0 == Stdlib.Option.Option.Some(1.57079632679) -Stdlib.Math.asin_v0 5.0 = Stdlib.Option.Option.None +Stdlib.Math.asin 5.0 == Stdlib.Option.Option.None() -Stdlib.Math.atan_v0 0.0 = 0.0 -Stdlib.Math.atan_v0 1.0 = 0.785398163397 +Stdlib.Math.atan 0.0 == 0.0 +Stdlib.Math.atan 1.0 == 0.785398163397 -Stdlib.Math.atan2_v0 -1.0 -1.0 = -2.35619449019 -Stdlib.Math.atan2_v0 -1.0 1.0 = -0.785398163397 -Stdlib.Math.atan2_v0 0.0 1.0 = 0.0 -Stdlib.Math.atan2_v0 1.0 -1.0 = 2.35619449019 -Stdlib.Math.atan2_v0 1.0 1.0 = 0.785398163397 +Stdlib.Math.atan2 -1.0 -1.0 == -2.35619449019 +Stdlib.Math.atan2 -1.0 1.0 == -0.785398163397 +Stdlib.Math.atan2 0.0 1.0 == 0.0 +Stdlib.Math.atan2 1.0 -1.0 == 2.35619449019 +Stdlib.Math.atan2 1.0 1.0 == 0.785398163397 -Stdlib.Math.cos_v0 0.0 = 1.0 -Stdlib.Math.cos_v0 Stdlib.Math.pi = -1.0 +Stdlib.Math.cos 0.0 == 1.0 +Stdlib.Math.cos Stdlib.Math.pi == -1.0 -Stdlib.Math.cosh_v0 0.0 = 1.0 +Stdlib.Math.cosh 0.0 == 1.0 -Stdlib.Math.degrees_v0 -180.0 = Stdlib.Float.negate_v0 Stdlib.Math.pi +Stdlib.Math.degrees -180.0 == Stdlib.Float.negate Stdlib.Math.pi -Stdlib.Math.degrees_v0 360.0 = Stdlib.Float.multiply_v0 2.0 Stdlib.Math.pi +Stdlib.Math.degrees 360.0 == Stdlib.Float.multiply 2.0 Stdlib.Math.pi -Stdlib.Math.pi = 3.14159265359 +Stdlib.Math.pi == 3.14159265359 -Stdlib.Math.radians_v0 (Stdlib.Float.negate_v0 3.141592653589793) = Stdlib.Float.negate_v0 - Stdlib.Math.pi +Stdlib.Math.radians (Stdlib.Float.negate 3.141592653589793) +== Stdlib.Float.negate Stdlib.Math.pi -Stdlib.Math.radians_v0 6.283185307179586 = Stdlib.Float.multiply_v0 - 2.0 - Stdlib.Math.pi +Stdlib.Math.radians 6.283185307179586 +== Stdlib.Float.multiply 2.0 Stdlib.Math.pi -Stdlib.Math.sin_v0 (Stdlib.Float.divide_v0 Stdlib.Math.pi 2.0) = 1.0 +Stdlib.Math.sin (Stdlib.Float.divide Stdlib.Math.pi 2.0) == 1.0 -Stdlib.Math.sin_v0 0.0 = 0.0 +Stdlib.Math.sin 0.0 == 0.0 -Stdlib.Math.sinh_v0 0.0 = 0.0 -Stdlib.Math.sinh_v0 1.0 = 1.17520119364 +Stdlib.Math.sinh 0.0 == 0.0 +Stdlib.Math.sinh 1.0 == 1.17520119364 -Stdlib.Math.tan_v0 (Stdlib.Float.divide_v0 Stdlib.Math.pi 4.0) = 1.0 +Stdlib.Math.tan (Stdlib.Float.divide Stdlib.Math.pi 4.0) == 1.0 -Stdlib.Math.tan_v0 0.0 = 0.0 -Stdlib.Math.tanh_v0 0.0 = 0.0 +Stdlib.Math.tan 0.0 == 0.0 +Stdlib.Math.tanh 0.0 == 0.0 -Stdlib.Math.tau = Stdlib.Float.multiply_v0 2.0 Stdlib.Math.pi +Stdlib.Math.tau == Stdlib.Float.multiply 2.0 Stdlib.Math.pi -Stdlib.Math.turns_v0 (Stdlib.Float.negate_v0 0.5) = Stdlib.Float.negate_v0 - Stdlib.Math.pi +Stdlib.Math.turns (Stdlib.Float.negate 0.5) +== Stdlib.Float.negate Stdlib.Math.pi -Stdlib.Math.turns_v0 1.0 = Stdlib.Float.multiply_v0 2.0 Stdlib.Math.pi \ No newline at end of file +Stdlib.Math.turns 1.0 == Stdlib.Float.multiply 2.0 Stdlib.Math.pi \ No newline at end of file diff --git a/backend/testfiles/execution/stdlib/nomodule.dark b/backend/testfiles/execution/stdlib/nomodule.dark index 6007ee8971..b39a0611bb 100644 --- a/backend/testfiles/execution/stdlib/nomodule.dark +++ b/backend/testfiles/execution/stdlib/nomodule.dark @@ -102,367 +102,431 @@ module Equals = type EEnum2UInt128 = EEnumUInt128 - (5Q == 5Q) = true - (5Q != 6Q) = true + (5Q == 5Q) == true + (5Q != 6Q) == true - (5Z == 5Z) = true - (5Z != 6Z) = true + (5Z == 5Z) == true + (5Z != 6Z) == true - (5L == 5L) = true - (5L != 6L) = true + (5L == 5L) == true + (5L != 6L) == true - (5l == 5l) = true - (5l != 6l) = true + (5l == 5l) == true + (5l != 6l) == true - (5ul == 5ul) = true - (5ul != 6ul) = true + (5ul == 5ul) == true + (5ul != 6ul) == true - (5y == 5y) = true - (5y != 6y) = true + (5y == 5y) == true + (5y != 6y) == true - (5uy == 5uy) = true - (5uy != 6uy) = true + (5uy == 5uy) == true + (5uy != 6uy) == true - (5s == 5s) = true - (5s != 6s) = true + (5s == 5s) == true + (5s != 6s) == true - (5us == 5us) = true - (5us != 6us) = true + (5us == 5us) == true + (5us != 6us) == true - (5.6 == 5.6) = true - (-55555555555555555555555555555.5 == -55555555555555555555555555555.5) = true - (5.6 != 5.7) = true + (5.6 == 5.6) == true + (-55555555555555555555555555555.5 == -55555555555555555555555555555.5) == true + (5.6 != 5.7) == true + (0.0 == -0.0) == true - ("asd" == "asd") = true - ("asd" != "sad") = true + ("asd" == "asd") == true + ("asd" != "sad") == true - (true == true) = true - (false == false) = true - (true != false) = true + (true == true) == true + (false == false) == true + (true != false) == true - (() == ()) = true + (() == ()) == true - ([ 1L; 2L; 3L ] == [ 1L; 2L; 3L ]) = true - ([ 1L; 2L; 3L ] != [ 3L; 2L; 1L ]) = true - ([ 1l; 2l; 3l ] == [ 1l; 2l; 3l ]) = true - ([ 1l; 2l; 3l ] != [ 3l; 2l; 1l ]) = true - ([ 1ul; 2ul; 3ul ] == [ 1ul; 2ul; 3ul ]) = true - ([ 1ul; 2ul; 3ul ] != [ 3ul; 2ul; 1ul ]) = true - ([ 1s; 2s; 3s ] == [ 1s; 2s; 3s ]) = true - ([ 1s; 2s; 3s ] != [ 3s; 2s; 1s ]) = true - ([ 1us; 2us; 3us ] == [ 1us; 2us; 3us ]) = true - ([ 1us; 2us; 3us ] != [ 3us; 2us; 1us ]) = true - ([ 1y; 2y; 3y ] == [ 1y; 2y; 3y ]) = true - ([ 1y; 2y; 3y ] != [ 3y; 2y; 1y ]) = true - ([ 1uy; 2uy; 3uy ] == [ 1uy; 2uy; 3uy ]) = true - ([ 1uy; 2uy; 3uy ] != [ 3uy; 2uy; 1uy ]) = true + ([ 1L; 2L; 3L ] == [ 1L; 2L; 3L ]) == true + ([ 1L; 2L; 3L ] != [ 3L; 2L; 1L ]) == true + ([ 1l; 2l; 3l ] == [ 1l; 2l; 3l ]) == true + ([ 1l; 2l; 3l ] != [ 3l; 2l; 1l ]) == true + ([ 1ul; 2ul; 3ul ] == [ 1ul; 2ul; 3ul ]) == true + ([ 1ul; 2ul; 3ul ] != [ 3ul; 2ul; 1ul ]) == true + ([ 1s; 2s; 3s ] == [ 1s; 2s; 3s ]) == true + ([ 1s; 2s; 3s ] != [ 3s; 2s; 1s ]) == true + ([ 1us; 2us; 3us ] == [ 1us; 2us; 3us ]) == true + ([ 1us; 2us; 3us ] != [ 3us; 2us; 1us ]) == true + ([ 1y; 2y; 3y ] == [ 1y; 2y; 3y ]) == true + ([ 1y; 2y; 3y ] != [ 3y; 2y; 1y ]) == true + ([ 1uy; 2uy; 3uy ] == [ 1uy; 2uy; 3uy ]) == true + ([ 1uy; 2uy; 3uy ] != [ 3uy; 2uy; 1uy ]) == true - ((Stdlib.String.toBytes_v0 "🧑🏽‍🦰🧑🏼‍💻🧑🏻‍🍼") - == (Stdlib.String.toBytes_v0 "🧑🏽‍🦰🧑🏼‍💻🧑🏻‍🍼")) = true + ((Stdlib.String.toBytes "🧑🏽‍🦰🧑🏼‍💻🧑🏻‍🍼") + == (Stdlib.String.toBytes "🧑🏽‍🦰🧑🏼‍💻🧑🏻‍🍼")) + == true ((Stdlib.DateTime.parse "2019-07-28T22:42:36Z") - == (Stdlib.DateTime.parse "2019-07-28T22:42:36Z")) = true + == (Stdlib.DateTime.parse "2019-07-28T22:42:36Z")) + == true ((Stdlib.DateTime.parse "2019-07-28T22:42:37Z") - != (Stdlib.DateTime.parse "2019-07-28T22:42:36Z")) = true - - (Stdlib.Uuid.parse_v0 "3700adbc-7a46-4ff4-81d3-45afb03f6e2d" - == Stdlib.Uuid.parse_v0 "3700adbc-7a46-4ff4-81d3-45afb03f6e2d") = true - - (Stdlib.Uuid.parse_v0 "3700adbc-7a46-4ff4-81d3-45afb03f6e2e" - != Stdlib.Uuid.parse_v0 "3700adbc-7a46-4ff4-81d3-45afb03f6e2d") = true - - (fun x -> y) = (fun x -> y) - ((fun x -> let y = 1Q in y) == (fun x -> let y = 1Q in y)) = true - ((fun x -> let y = 1Q in y) != (fun x -> let y = 2Q in x)) = true - - ((fun x -> let y = 1Z in y) == (fun x -> let y = 1Z in y)) = true - ((fun x -> let y = 1Z in y) != (fun x -> let y = 2Z in x)) = true - - ((fun x -> let y = 1L in y) == (fun x -> let y = 1L in y)) = true - ((fun x -> let y = 1L in y) != (fun x -> let y = 2L in x)) = true - - ((fun x -> let y = 1l in y) == (fun x -> let y = 1l in y)) = true - ((fun x -> let y = 1l in y) != (fun x -> let y = 2l in x)) = true - - ((fun x -> let y = 1ul in y) == (fun x -> let y = 1ul in y)) = true - ((fun x -> let y = 1ul in y) != (fun x -> let y = 2ul in x)) = true - - ((fun x -> let y = 1s in y) == (fun x -> let y = 1s in y)) = true - ((fun x -> let y = 1s in y) != (fun x -> let y = 2s in x)) = true - - ((fun x -> let y = 1us in y) == (fun x -> let y = 1us in y)) = true - ((fun x -> let y = 1us in y) != (fun x -> let y = 2us in x)) = true - - ((fun x -> let y = 1y in y) == (fun x -> let y = 1y in y)) = true - ((fun x -> let y = 1y in y) != (fun x -> let y = 2y in x)) = true - - ((fun x -> let y = 1uy in y) == (fun x -> let y = 1uy in y)) = true - ((fun x -> let y = 1uy in y) != (fun x -> let y = 2uy in x)) = true - - - (ERecInt128 { x = 6Q; y = 7Q } == ERecInt128 { x = 6Q; y = 7Q }) = true - (ERecInt128 { x = 6Q; y = 7Q } == ERecInt128 { y = 7Q; x = 6Q }) = true - (ERecInt128 { x = 6Q; y = 7Q } != ERecInt128 { x = 7Q; y = 6Q }) = true - (ERecInt128 { x = 6Q; y = 7Q } == ERec2Int128 { y = 7Q; x = 6Q }) = true - - (ERecUInt128 { x = 6Z; y = 7Z } == ERecUInt128 { x = 6Z; y = 7Z }) = true - (ERecUInt128 { x = 6Z; y = 7Z } == ERecUInt128 { y = 7Z; x = 6Z }) = true - (ERecUInt128 { x = 6Z; y = 7Z } != ERecUInt128 { x = 7Z; y = 6Z }) = true - (ERecUInt128 { x = 6Z; y = 7Z } == ERec2UInt128 { y = 7Z; x = 6Z }) = true - - (ERec { x = 6L; y = 7L } == ERec { x = 6L; y = 7L }) = true - (ERec { x = 6L; y = 7L } == ERec { y = 7L; x = 6L }) = true - (ERec { x = 6L; y = 7L } != ERec { x = 7L; y = 6L }) = true - (ERec { x = 6L; y = 7L } == ERec2 { y = 7L; x = 6L }) = true - - (ERecUInt64 { x = 6UL; y = 7UL } == ERecUInt64 { x = 6UL; y = 7UL }) = true - (ERecUInt64 { x = 6UL; y = 7UL } == ERecUInt64 { y = 7UL; x = 6UL }) = true - (ERecUInt64 { x = 6UL; y = 7UL } != ERecUInt64 { x = 7UL; y = 6UL }) = true - (ERecUInt64 { x = 6UL; y = 7UL } == ERec2UInt64 { y = 7UL; x = 6UL }) = true - - (ERecInt32 { x = 6l; y = 7l } == ERecInt32 { x = 6l; y = 7l }) = true - (ERecInt32 { x = 6l; y = 7l } == ERecInt32 { y = 7l; x = 6l }) = true - (ERecInt32 { x = 6l; y = 7l } != ERecInt32 { x = 7l; y = 6l }) = true - (ERecInt32 { x = 6l; y = 7l } == ERec2Int32 { y = 7l; x = 6l }) = true - - (ERecUInt32 { x = 6ul; y = 7ul } == ERecUInt32 { x = 6ul; y = 7ul }) = true - (ERecUInt32 { x = 6ul; y = 7ul } == ERecUInt32 { y = 7ul; x = 6ul }) = true - (ERecUInt32 { x = 6ul; y = 7ul } != ERecUInt32 { x = 7ul; y = 6ul }) = true - (ERecUInt32 { x = 6ul; y = 7ul } == ERec2UInt32 { y = 7ul; x = 6ul }) = true - - (ERecInt16 { x = 6s; y = 7s } == ERecInt16 { x = 6s; y = 7s }) = true - (ERecInt16 { x = 6s; y = 7s } == ERecInt16 { y = 7s; x = 6s }) = true - (ERecInt16 { x = 6s; y = 7s } != ERecInt16 { x = 7s; y = 6s }) = true - (ERecInt16 { x = 6s; y = 7s } == ERec2Int16 { y = 7s; x = 6s }) = true - - (ERecUInt16 { x = 6us; y = 7us } == ERecUInt16 { x = 6us; y = 7us }) = true - (ERecUInt16 { x = 6us; y = 7us } == ERecUInt16 { y = 7us; x = 6us }) = true - (ERecUInt16 { x = 6us; y = 7us } != ERecUInt16 { x = 7us; y = 6us }) = true - (ERecUInt16 { x = 6us; y = 7us } == ERec2UInt16 { y = 7us; x = 6us }) = true - - (ERecInt8 { x = 6y; y = 7y } == ERecInt8 { x = 6y; y = 7y }) = true - (ERecInt8 { x = 6y; y = 7y } == ERecInt8 { y = 7y; x = 6y }) = true - (ERecInt8 { x = 6y; y = 7y } != ERecInt8 { x = 7y; y = 6y }) = true - (ERecInt8 { x = 6y; y = 7y } == ERec2Int8 { y = 7y; x = 6y }) = true - - (ERecUInt8 { x = 6uy; y = 7uy } == ERecUInt8 { x = 6uy; y = 7uy }) = true - (ERecUInt8 { x = 6uy; y = 7uy } == ERecUInt8 { y = 7uy; x = 6uy }) = true - (ERecUInt8 { x = 6uy; y = 7uy } != ERecUInt8 { x = 7uy; y = 6uy }) = true - - (EEnumInt128.E1 == EEnumInt128.E1) = true - (EEnumInt128.E1 != EEnumInt128.E2) = true - (EEnumUInt128.E1 == EEnumUInt128.E1) = true - (EEnumUInt128.E1 != EEnumUInt128.E2) = true - (EEnumInt128.E3 5Q == EEnumInt128.E3 5Q) = true - (EEnumInt128.E3 5Q != EEnumInt128.E3 6Q) = true - - (EEnum.E1 == EEnum.E1) = true - (EEnum.E1 != EEnum.E2) = true - (EEnum.E3 5L == EEnum.E3 5L) = true - (EEnum.E3 5L != EEnum.E3 6L) = true - - (EEnumUIn64.E1 == EEnumUIn64.E1) = true - (EEnumUIn64.E1 != EEnumUIn64.E2) = true - (EEnumUIn64.E3 5UL == EEnumUIn64.E3 5UL) = true - (EEnumUIn64.E3 5UL != EEnumUIn64.E3 6UL) = true - - (EEnumInt32.E1 == EEnumInt32.E1) = true - (EEnumInt32.E1 != EEnumInt32.E2) = true - (EEnumInt32.E3 5l == EEnumInt32.E3 5l) = true - (EEnumInt32.E3 5l != EEnumInt32.E3 6l) = true - - (EEnumUInt32.E1 == EEnumUInt32.E1) = true - (EEnumUInt32.E1 != EEnumUInt32.E2) = true - (EEnumUInt32.E3 5ul == EEnumUInt32.E3 5ul) = true - (EEnumUInt32.E3 5ul != EEnumUInt32.E3 6ul) = true - - (EEnumInt16.E1 == EEnumInt16.E1) = true - (EEnumInt16.E1 != EEnumInt16.E2) = true - (EEnumInt16.E3 5s == EEnumInt16.E3 5s) = true - (EEnumInt16.E3 5s != EEnumInt16.E3 6s) = true - - (EEnumUInt16.E1 == EEnumUInt16.E1) = true - (EEnumUInt16.E1 != EEnumUInt16.E2) = true - (EEnumUInt16.E3 5us == EEnumUInt16.E3 5us) = true - (EEnumUInt16.E3 5us != EEnumUInt16.E3 6us) = true - - (EEnumInt8.E1 == EEnumInt8.E1) = true - (EEnumInt8.E1 != EEnumInt8.E2) = true - (EEnumInt8.E3 5y == EEnumInt8.E3 5y) = true - (EEnumInt8.E3 5y != EEnumInt8.E3 6y) = true + != (Stdlib.DateTime.parse "2019-07-28T22:42:36Z")) + == true + + (Stdlib.Uuid.parse "3700adbc-7a46-4ff4-81d3-45afb03f6e2d" + == Stdlib.Uuid.parse "3700adbc-7a46-4ff4-81d3-45afb03f6e2d") + == true + + (Stdlib.Uuid.parse "3700adbc-7a46-4ff4-81d3-45afb03f6e2e" + != Stdlib.Uuid.parse "3700adbc-7a46-4ff4-81d3-45afb03f6e2d") + == true + + (fun x -> y) == (fun x -> y) + ((fun x -> let y = 1Q + y) == + (fun x -> let y = 1Q + y)) == true + ((fun x -> let y = 1Q + y) != + (fun x -> let y = 2Q + x)) == true + + ((fun x -> let y = 1Z + y) == + (fun x -> let y = 1Z + y)) == true + ((fun x -> let y = 1Z + y) != + (fun x -> let y = 2Z + x)) == true + + ((fun x -> let y = 1L + y) == + (fun x -> let y = 1L + y)) == true + ((fun x -> let y = 1L + y) != + (fun x -> let y = 2L + x)) == true + + ((fun x -> let y = 1l + y) == + (fun x -> let y = 1l + y)) == true + ((fun x -> let y = 1l + y) != + (fun x -> let y = 2l + x)) == true + + ((fun x -> let y = 1ul + y) == + (fun x -> let y = 1ul + y)) == true + ((fun x -> let y = 1ul + y) != + (fun x -> let y = 2ul + x)) == true + + ((fun x -> let y = 1s + y) == + (fun x -> let y = 1s + y)) == true + ((fun x -> let y = 1s + y) != + (fun x -> let y = 2s + x)) == true + + ((fun x -> let y = 1us + y) == + (fun x -> let y = 1us + y)) == true + ((fun x -> let y = 1us + y) != + (fun x -> let y = 2us + x)) == true + + ((fun x -> let y = 1y + y) == + (fun x -> let y = 1y + y)) == true + ((fun x -> let y = 1y + y) != + (fun x -> let y = 2y + x)) == true + + ((fun x -> let y = 1uy + y) == + (fun x -> let y = 1uy + y)) == true + ((fun x -> let y = 1uy + y) != + (fun x -> let y = 2uy + x)) == true + + + (ERecInt128 { x = 6Q; y = 7Q } == ERecInt128 { x = 6Q; y = 7Q }) == true + (ERecInt128 { x = 6Q; y = 7Q } == ERecInt128 { y = 7Q; x = 6Q }) == true + (ERecInt128 { x = 6Q; y = 7Q } != ERecInt128 { x = 7Q; y = 6Q }) == true + (ERecInt128 { x = 6Q; y = 7Q } == ERec2Int128 { y = 7Q; x = 6Q }) == true + + (ERecUInt128 { x = 6Z; y = 7Z } == ERecUInt128 { x = 6Z; y = 7Z }) == true + (ERecUInt128 { x = 6Z; y = 7Z } == ERecUInt128 { y = 7Z; x = 6Z }) == true + (ERecUInt128 { x = 6Z; y = 7Z } != ERecUInt128 { x = 7Z; y = 6Z }) == true + (ERecUInt128 { x = 6Z; y = 7Z } == ERec2UInt128 { y = 7Z; x = 6Z }) == true + + (ERec { x = 6L; y = 7L } == ERec { x = 6L; y = 7L }) == true + (ERec { x = 6L; y = 7L } == ERec { y = 7L; x = 6L }) == true + (ERec { x = 6L; y = 7L } != ERec { x = 7L; y = 6L }) == true + (ERec { x = 6L; y = 7L } == ERec2 { y = 7L; x = 6L }) == true + + (ERecUInt64 { x = 6UL; y = 7UL } == ERecUInt64 { x = 6UL; y = 7UL }) == true + (ERecUInt64 { x = 6UL; y = 7UL } == ERecUInt64 { y = 7UL; x = 6UL }) == true + (ERecUInt64 { x = 6UL; y = 7UL } != ERecUInt64 { x = 7UL; y = 6UL }) == true + (ERecUInt64 { x = 6UL; y = 7UL } == ERec2UInt64 { y = 7UL; x = 6UL }) == true + + (ERecInt32 { x = 6l; y = 7l } == ERecInt32 { x = 6l; y = 7l }) == true + (ERecInt32 { x = 6l; y = 7l } == ERecInt32 { y = 7l; x = 6l }) == true + (ERecInt32 { x = 6l; y = 7l } != ERecInt32 { x = 7l; y = 6l }) == true + (ERecInt32 { x = 6l; y = 7l } == ERec2Int32 { y = 7l; x = 6l }) == true + + (ERecUInt32 { x = 6ul; y = 7ul } == ERecUInt32 { x = 6ul; y = 7ul }) == true + (ERecUInt32 { x = 6ul; y = 7ul } == ERecUInt32 { y = 7ul; x = 6ul }) == true + (ERecUInt32 { x = 6ul; y = 7ul } != ERecUInt32 { x = 7ul; y = 6ul }) == true + (ERecUInt32 { x = 6ul; y = 7ul } == ERec2UInt32 { y = 7ul; x = 6ul }) == true + + (ERecInt16 { x = 6s; y = 7s } == ERecInt16 { x = 6s; y = 7s }) == true + (ERecInt16 { x = 6s; y = 7s } == ERecInt16 { y = 7s; x = 6s }) == true + (ERecInt16 { x = 6s; y = 7s } != ERecInt16 { x = 7s; y = 6s }) == true + (ERecInt16 { x = 6s; y = 7s } == ERec2Int16 { y = 7s; x = 6s }) == true + + (ERecUInt16 { x = 6us; y = 7us } == ERecUInt16 { x = 6us; y = 7us }) == true + (ERecUInt16 { x = 6us; y = 7us } == ERecUInt16 { y = 7us; x = 6us }) == true + (ERecUInt16 { x = 6us; y = 7us } != ERecUInt16 { x = 7us; y = 6us }) == true + (ERecUInt16 { x = 6us; y = 7us } == ERec2UInt16 { y = 7us; x = 6us }) == true + + (ERecInt8 { x = 6y; y = 7y } == ERecInt8 { x = 6y; y = 7y }) == true + (ERecInt8 { x = 6y; y = 7y } == ERecInt8 { y = 7y; x = 6y }) == true + (ERecInt8 { x = 6y; y = 7y } != ERecInt8 { x = 7y; y = 6y }) == true + (ERecInt8 { x = 6y; y = 7y } == ERec2Int8 { y = 7y; x = 6y }) == true + + (ERecUInt8 { x = 6uy; y = 7uy } == ERecUInt8 { x = 6uy; y = 7uy }) == true + (ERecUInt8 { x = 6uy; y = 7uy } == ERecUInt8 { y = 7uy; x = 6uy }) == true + (ERecUInt8 { x = 6uy; y = 7uy } != ERecUInt8 { x = 7uy; y = 6uy }) == true + + (EEnumInt128.E1() == EEnumInt128.E1()) == true + (EEnumInt128.E1() != EEnumInt128.E2()) == true + (EEnumUInt128.E1() == EEnumUInt128.E1()) == true + (EEnumUInt128.E1() != EEnumUInt128.E2()) == true + (EEnumInt128.E3 5Q == EEnumInt128.E3 5Q) == true + (EEnumInt128.E3 5Q != EEnumInt128.E3 6Q) == true + + (EEnum.E1() == EEnum.E1()) == true + (EEnum.E1() != EEnum.E2()) == true + (EEnum.E3 5L == EEnum.E3 5L) == true + (EEnum.E3 5L != EEnum.E3 6L) == true + + (EEnumUIn64.E1() == EEnumUIn64.E1()) == true + (EEnumUIn64.E1() != EEnumUIn64.E2()) == true + (EEnumUIn64.E3 5UL == EEnumUIn64.E3 5UL) == true + (EEnumUIn64.E3 5UL != EEnumUIn64.E3 6UL) == true + + (EEnumInt32.E1() == EEnumInt32.E1()) == true + (EEnumInt32.E1() != EEnumInt32.E2()) == true + (EEnumInt32.E3 5l == EEnumInt32.E3 5l) == true + (EEnumInt32.E3 5l != EEnumInt32.E3 6l) == true + + (EEnumUInt32.E1() == EEnumUInt32.E1()) == true + (EEnumUInt32.E1() != EEnumUInt32.E2()) == true + (EEnumUInt32.E3 5ul == EEnumUInt32.E3 5ul) == true + (EEnumUInt32.E3 5ul != EEnumUInt32.E3 6ul) == true + + (EEnumInt16.E1() == EEnumInt16.E1()) == true + (EEnumInt16.E1() != EEnumInt16.E2()) == true + (EEnumInt16.E3 5s == EEnumInt16.E3 5s) == true + (EEnumInt16.E3 5s != EEnumInt16.E3 6s) == true + + (EEnumUInt16.E1() == EEnumUInt16.E1()) == true + (EEnumUInt16.E1() != EEnumUInt16.E2()) == true + (EEnumUInt16.E3 5us == EEnumUInt16.E3 5us) == true + (EEnumUInt16.E3 5us != EEnumUInt16.E3 6us) == true + + (EEnumInt8.E1() == EEnumInt8.E1()) == true + (EEnumInt8.E1() != EEnumInt8.E2()) == true + (EEnumInt8.E3 5y == EEnumInt8.E3 5y) == true + (EEnumInt8.E3 5y != EEnumInt8.E3 6y) == true // aliases - (EEnum2Int128.E1 == EEnumInt128.E1) = true - (EEnum2Int128.E1 != EEnumInt128.E2) = true - (EEnum2UInt128.E1 == EEnumUInt128.E1) = true - (EEnum2UInt128.E1 != EEnumUInt128.E2) = true - - (EEnum2.E1 == EEnum.E1) = true - (EEnum2.E1 != EEnum.E2) = true - (EEnum2UIn64.E1 == EEnumUIn64.E1) = true - (EEnum2UIn64.E1 != EEnumUIn64.E2) = true + (EEnum2Int128.E1() == EEnumInt128.E1()) == true + (EEnum2Int128.E1() != EEnumInt128.E2()) == true + (EEnum2UInt128.E1() == EEnumUInt128.E1()) == true + (EEnum2UInt128.E1() != EEnumUInt128.E2()) == true - (EEnum2Int32.E1 == EEnumInt32.E1) = true - (EEnum2Int32.E1 != EEnumInt32.E2) = true - (EEnum2UInt32.E1 == EEnumUInt32.E1) = true - (EEnum2UInt32.E1 != EEnumUInt32.E2) = true + (EEnum2.E1() == EEnum.E1()) == true + (EEnum2.E1() != EEnum.E2()) == true + (EEnum2UIn64.E1() == EEnumUIn64.E1()) == true + (EEnum2UIn64.E1() != EEnumUIn64.E2()) == true - (EEnum2Int16.E1 == EEnumInt16.E1) = true - (EEnum2Int16.E1 != EEnumInt16.E2) = true - (EEnum2UInt16.E1 == EEnumUInt16.E1) = true - (EEnum2UInt16.E1 != EEnumUInt16.E2) = true + (EEnum2Int32.E1() == EEnumInt32.E1()) == true + (EEnum2Int32.E1() != EEnumInt32.E2()) == true + (EEnum2UInt32.E1() == EEnumUInt32.E1()) == true + (EEnum2UInt32.E1() != EEnumUInt32.E2()) == true - (EEnum2Int8.E1 == EEnumInt8.E1) = true - (EEnum2Int8.E1 != EEnumInt8.E2) = true - (EEnum2UInt8.E1 == EEnumUInt8.E1) = true - (EEnum2UInt8.E1 != EEnumUInt8.E2) = true + (EEnum2Int16.E1() == EEnumInt16.E1()) == true + (EEnum2Int16.E1() != EEnumInt16.E2()) == true + (EEnum2UInt16.E1() == EEnumUInt16.E1()) == true + (EEnum2UInt16.E1() != EEnumUInt16.E2()) == true + (EEnum2Int8.E1() == EEnumInt8.E1()) == true + (EEnum2Int8.E1() != EEnumInt8.E2()) == true + (EEnum2UInt8.E1() == EEnumUInt8.E1()) == true + (EEnum2UInt8.E1() != EEnumUInt8.E2()) == true - (Stdlib.Option.Option.None == Stdlib.Option.Option.None) = true - (Stdlib.Option.Option.None != Stdlib.Option.Option.Some Stdlib.Option.Option.None) = true + (Stdlib.Option.Option.None() == Stdlib.Option.Option.None()) == true - (Stdlib.Option.Option.Some 5L == Stdlib.Option.Option.Some 5L) = true + (Stdlib.Option.Option.None() != Stdlib.Option.Option.Some(Stdlib.Option.Option.None())) + == true - (Stdlib.Option.Option.Some 5L != Stdlib.Option.Option.Some 6L) = true + ((Stdlib.Option.Option.Some(5L)) == Stdlib.Option.Option.Some(5L)) == true - (Stdlib.Option.Option.Some(Stdlib.Option.Option.Some 0L) - != Stdlib.Option.Option.Some(Stdlib.Option.Option.Some 1L)) = true + (Stdlib.Option.Option.Some(5L) != Stdlib.Option.Option.Some(6L)) == true - (Stdlib.Option.Option.Some(Stdlib.Option.Option.Some 0L) - == Stdlib.Option.Option.Some(Stdlib.Option.Option.Some 0L)) = true + (Stdlib.Option.Option.Some(Stdlib.Option.Option.Some(0L)) + != Stdlib.Option.Option.Some(Stdlib.Option.Option.Some(1L))) + == true - (Stdlib.Result.Result.Error 0L == Stdlib.Result.Result.Error 0L) = true + (Stdlib.Option.Option.Some(Stdlib.Option.Option.Some(0L)) + == Stdlib.Option.Option.Some(Stdlib.Option.Option.Some(0L))) + == (Stdlib.Result.Result.Error(0L) == Stdlib.Result.Result.Error(0L)) + == true - (Stdlib.Result.Result.Ok 0L == Stdlib.Result.Result.Ok 0L) = true + (Stdlib.Result.Result.Ok(0L) == Stdlib.Result.Result.Ok(0L)) == true - (Stdlib.Result.Result.Ok 0L != Stdlib.Result.Result.Error 0L) = true + (Stdlib.Result.Result.Ok(0L) != Stdlib.Result.Result.Error(0L)) == true - type MyDBType = { x: String; y: String } + // type MyDBType = { x: String; y: String } - [] - type MyDB = MyDBType + // [] + // type MyDB = MyDBType - (MyDB == MyDB) = true + // (MyDB == MyDB) == true - module TypeErrors = - (5.7 != 6L) = Builtin.testDerrorMessage "Both values must be the same type" - (5.7 != 5L) = Builtin.testDerrorMessage "Both values must be the same type" +module TypeErrors = + (5.7 != 6L) == Builtin.testDerrorMessage "Both values must be the same type" + (5.7 != 5L) == Builtin.testDerrorMessage "Both values must be the same type" - (5us == 5s) = Builtin.testDerrorMessage "Both values must be the same type" - (5y == 5l) = Builtin.testDerrorMessage "Both values must be the same type" - (5L == 5l) = Builtin.testDerrorMessage "Both values must be the same type" - (5us != 6s) = Builtin.testDerrorMessage "Both values must be the same type" + (5us == 5s) == Builtin.testDerrorMessage "Both values must be the same type" + (5y == 5l) == Builtin.testDerrorMessage "Both values must be the same type" + (5L == 5l) == Builtin.testDerrorMessage "Both values must be the same type" + (5us != 6s) == Builtin.testDerrorMessage "Both values must be the same type" - (Builtin.testRuntimeError "test" != Builtin.testRuntimeError "different msg") = Builtin.testDerrorMessage - "test" + (Builtin.testRuntimeError "test" != Builtin.testRuntimeError "different msg") + == Builtin.testDerrorMessage "test" - (() != Stdlib.Option.Option.None) = Builtin.testDerrorMessage - "Both values must be the same type" + (() != Stdlib.Option.Option.None()) + == Builtin.testDerrorMessage "Both values must be the same type" - (() != false) = Builtin.testDerrorMessage "Both values must be the same type" - (() != 0) = Builtin.testDerrorMessage "Both values must be the same type" - (() != 0.0) = Builtin.testDerrorMessage "Both values must be the same type" - (MyDB != 5L) = Builtin.testDerrorMessage "Both values must be the same type" + (() != false) == Builtin.testDerrorMessage "Both values must be the same type" + (() != 0) == Builtin.testDerrorMessage "Both values must be the same type" + (() != 0.0) == Builtin.testDerrorMessage "Both values must be the same type" + // (MyDB != 5L) == Builtin.testDerrorMessage "Both values must be the same type" // Other ways to call it - Stdlib.equals_v0 1Q 1Q = true - (==) 1Q 1Q = true - 1Q == 1Q = true + Stdlib.equals 1Q 1Q == true + // (==) 1Q 1Q == true + 1Q == 1Q == true - Stdlib.equals_v0 1Z 1Z = true - (==) 1Z 1Z = true - 1Z == 1Z = true + Stdlib.equals 1Z 1Z == true + // (==) 1Z 1Z == true + 1Z == 1Z == true - Stdlib.equals_v0 1L 1L = true - (==) 1L 1L = true - 1L == 1L = true + Stdlib.equals 1L 1L == true + // (==) 1L 1L == true + 1L == 1L == true - Stdlib.equals_v0 1l 1l = true - (==) 1l 1l = true - 1l == 1l = true + Stdlib.equals 1l 1l == true + // (==) 1l 1l == true + 1l == 1l == true - Stdlib.equals_v0 1ul 1ul = true - (==) 1ul 1ul = true - 1ul == 1ul = true + Stdlib.equals 1ul 1ul == true + // (==) 1ul 1ul == true + 1ul == 1ul == true - Stdlib.equals_v0 1s 1s = true - (==) 1s 1s = true - 1s == 1s = true + Stdlib.equals 1s 1s == true + // (==) 1s 1s == true + 1s == 1s == true - Stdlib.equals_v0 1us 1us = true - (==) 1us 1us = true - 1us == 1us = true + Stdlib.equals 1us 1us == true + // (==) 1us 1us == true + 1us == 1us == true - Stdlib.equals_v0 1y 1y = true - (==) 1y 1y = true - 1y == 1y = true - - Stdlib.equals_v0 1uy 1uy = true - (==) 1uy 1uy = true - 1uy == 1uy = true + Stdlib.equals 1y 1y == true + // (==) 1y 1y == true + 1y == 1y == true + Stdlib.equals 1uy 1uy == true + // (==) 1uy 1uy == true + 1uy == 1uy == true module NotEquals = - Stdlib.notEquals_v0 1Q 1Q = false - Stdlib.notEquals_v0 1Z 1Z = false - Stdlib.notEquals_v0 1L 1L = false - Stdlib.notEquals_v0 1l 1l = false - Stdlib.notEquals_v0 1ul 1ul = false - Stdlib.notEquals_v0 1s 1s = false - Stdlib.notEquals_v0 1us 1us = false - Stdlib.notEquals_v0 1y 1y = false - Stdlib.notEquals_v0 1uy 1uy = false - Stdlib.notEquals_v0 "abc" "abc" = false - Stdlib.notEquals_v0 "abd" "abc" = true - - Stdlib.notEquals_v0 - (Stdlib.DateTime.parse "2021-07-28T22:42:36Z") - (Stdlib.DateTime.parse "2019-07-28T22:42:36Z") = true - - (!=) 1Q 1Q = false - (!=) 1Z 1Z = false - (!=) 1L 1L = false - (!=) 1l 1l = false - (!=) 1ul 1ul = false - (!=) 1s 1s = false - (!=) 1us 1us = false - (!=) 1y 1y = false - (!=) 1uy 1uy = false - (!=) "abc" "abc" = false - (!=) "abd" "abc" = true - - (!=) + Stdlib.notEquals 1Q 1Q == false + Stdlib.notEquals 1Z 1Z == false + Stdlib.notEquals 1L 1L == false + Stdlib.notEquals 1l 1l == false + Stdlib.notEquals 1ul 1ul == false + Stdlib.notEquals 1s 1s == false + Stdlib.notEquals 1us 1us == false + Stdlib.notEquals 1y 1y == false + Stdlib.notEquals 1uy 1uy == false + Stdlib.notEquals "abc" "abc" == false + Stdlib.notEquals "abd" "abc" == true + + Stdlib.notEquals (Stdlib.DateTime.parse "2021-07-28T22:42:36Z") - (Stdlib.DateTime.parse "2019-07-28T22:42:36Z") = true - - 1Q != 1Q = false - 1Z != 1Z = false - 1L != 1L = false - 1l != 1l = false - 1ul != 1ul = false - 1s != 1s = false - 1us != 1us = false - 1y != 1y = false - 1uy != 1uy = false - "abc" != "abc" = false - "abd" != "abc" = true + (Stdlib.DateTime.parse "2019-07-28T22:42:36Z") + == true + + // (!=) 1Q 1Q == false + // (!=) 1Z 1Z == false + // (!=) 1L 1L == false + // (!=) 1l 1l == false + // (!=) 1ul 1ul == false + // (!=) 1s 1s == false + // (!=) 1us 1us == false + // (!=) 1y 1y == false + // (!=) 1uy 1uy == false + // (!=) "abc" "abc" == false + // (!=) "abd" "abc" == true + + // (!=) + // (Stdlib.DateTime.parse "2021-07-28T22:42:36Z") + // (Stdlib.DateTime.parse "2019-07-28T22:42:36Z") + // == true + + 1Q != 1Q == false + 1Z != 1Z == false + 1L != 1L == false + 1l != 1l == false + 1ul != 1ul == false + 1s != 1s == false + 1us != 1us == false + 1y != 1y == false + 1uy != 1uy == false + "abc" != "abc" == false + "abd" != "abc" == true (Stdlib.DateTime.parse "2021-07-28T22:42:36Z") - != (Stdlib.DateTime.parse "2019-07-28T22:42:36Z") = true + != (Stdlib.DateTime.parse "2019-07-28T22:42:36Z") + == true // Moving to packages -// AWS.urlencode_v0 "%" = "" -// AWS.urlencode_v0 "%%" = "" -// AWS.urlencode_v0 "%A" = "A" -// AWS.urlencode_v0 "%AA" = "%AA" -// AWS.urlencode_v0 "" = "" -// AWS.urlencode_v0 "殢" = "%E6%AE%A2" -// AWS.urlencode_v0 "https://google.com?q=left shark&l=en" = "https%3A//google.com%3Fq%3Dleft%20shark%26l%3Den" // Test fails without a comment here -// AWS.urlencode_v0 "گچپژ" = "%DA%AF%DA%86%D9%BE%DA%98" -// AWS.urlencode_v0 "" = "%3Cfoo%20val%3D%E2%80%9Dbar%E2%80%9C%20/%3E" -// AWS.urlencode_v0 "表ポあA鷗ŒéB逍Üߪąñ丂㐀𠀀" = "%E8%A1%A8%E3%83%9D%E3%81%82A%E9%B7%97%C5%92%C3%A9%EF%BC%A2%E9%80%8D%C3%9C%C3%9F%C2%AA%C4%85%C3%B1%E4%B8%82%E3%90%80%F0%A0%80%80" -// Twitter.urlencode_v0 "https://google.com?q=left shark&l=en" = "https%3A%2F%2Fgoogle.com%3Fq%3Dleft%20shark%26l%3Den" // URL percent encoding \ No newline at end of file +// AWS.urlencode "%" = "" +// AWS.urlencode "%%" = "" +// AWS.urlencode "%A" = "A" +// AWS.urlencode "%AA" = "%AA" +// AWS.urlencode "" = "" +// AWS.urlencode "殢" = "%E6%AE%A2" +// AWS.urlencode "https://google.com?q=left shark&l=en" = "https%3A//google.com%3Fq%3Dleft%20shark%26l%3Den" // Test fails without a comment here +// AWS.urlencode "گچپژ" = "%DA%AF%DA%86%D9%BE%DA%98" +// AWS.urlencode "" = "%3Cfoo%20val%3D%E2%80%9Dbar%E2%80%9C%20/%3E" +// AWS.urlencode "表ポあA鷗ŒéB逍Üߪąñ丂㐀𠀀" = "%E8%A1%A8%E3%83%9D%E3%81%82A%E9%B7%97%C5%92%C3%A9%EF%BC%A2%E9%80%8D%C3%9C%C3%9F%C2%AA%C4%85%C3%B1%E4%B8%82%E3%90%80%F0%A0%80%80" +// Twitter.urlencode "https://google.com?q=left shark&l=en" = "https%3A%2F%2Fgoogle.com%3Fq%3Dleft%20shark%26l%3Den" // URL percent encoding \ No newline at end of file diff --git a/backend/testfiles/execution/stdlib/option.dark b/backend/testfiles/execution/stdlib/option.dark index 5ec690610a..4ae8c8eae2 100644 --- a/backend/testfiles/execution/stdlib/option.dark +++ b/backend/testfiles/execution/stdlib/option.dark @@ -1,357 +1,384 @@ -Stdlib.Option.andThen_v0 (Stdlib.Option.Option.Some 5L) (fun x -> - Stdlib.Option.Option.Some(1L + x)) = Stdlib.Option.Option.Some 6L +Stdlib.Option.andThen (Stdlib.Option.Option.Some(5L)) (fun x -> + Stdlib.Option.Option.Some(1L + x)) == Stdlib.Option.Option.Some(6L) -Stdlib.Option.andThen_v0 (Stdlib.Option.Option.Some 5L) (fun x -> - Stdlib.Option.Option.None) = Stdlib.Option.Option.None +Stdlib.Option.andThen (Stdlib.Option.Option.Some(5L)) (fun x -> + Stdlib.Option.Option.None()) == Stdlib.Option.Option.None() -Stdlib.Option.andThen_v0 Stdlib.Option.Option.None (fun x -> - Stdlib.Option.Option.Some 5L) = Stdlib.Option.Option.None +Stdlib.Option.andThen Stdlib.Option.Option.None() (fun x -> + Stdlib.Option.Option.Some(5L)) == Stdlib.Option.Option.None() -Stdlib.Option.andThen_v0 Stdlib.Option.Option.None (fun x -> - Stdlib.Option.Option.None) = Stdlib.Option.Option.None +Stdlib.Option.andThen Stdlib.Option.Option.None() (fun x -> + Stdlib.Option.Option.None()) == Stdlib.Option.Option.None() -Stdlib.Option.andThen_v0 (Stdlib.Option.Option.Some 8L) (fun x -> - Stdlib.Option.Option.Some(Stdlib.Int64.divide_v0 x 2L)) = Stdlib.Option.Option.Some - 4L +Stdlib.Option.andThen (Stdlib.Option.Option.Some(8L)) (fun x -> + Stdlib.Option.Option.Some(Stdlib.Int64.divide x 2L)) == Stdlib.Option.Option.Some(4L) -Stdlib.Option.andThen_v0 (Stdlib.Option.Option.Some 8L) (fun x -> - Stdlib.Option.Option.Some(Stdlib.Int64.divide_v0 x 0L)) = Builtin.testDerrorMessage +Stdlib.Option.andThen (Stdlib.Option.Option.Some(8L)) (fun x -> + Stdlib.Option.Option.Some(Stdlib.Int64.divide x 0L)) == Builtin.testDerrorMessage "Division by zero" -Stdlib.Option.andThen2_v0 - (Stdlib.Option.Option.Some 5L) - (Stdlib.Option.Option.Some 6L) - (fun x y -> Stdlib.Option.Option.Some(x + y)) = Stdlib.Option.Option.Some 11L - -Stdlib.Option.andThen2_v0 - (Stdlib.Option.Option.Some 5L) - Stdlib.Option.Option.None - (fun x y -> Stdlib.Option.Option.Some(x + y)) = Stdlib.Option.Option.None - -Stdlib.Option.andThen2_v0 - Stdlib.Option.Option.None - (Stdlib.Option.Option.Some 6L) - (fun x y -> Stdlib.Option.Option.Some(x + y)) = Stdlib.Option.Option.None - -Stdlib.Option.andThen2_v0 - Stdlib.Option.Option.None - Stdlib.Option.Option.None - (fun x y -> Stdlib.Option.Option.Some(x + y)) = Stdlib.Option.Option.None - - -Stdlib.Option.andThen3_v0 - (Stdlib.Option.Option.Some 5L) - (Stdlib.Option.Option.Some 6L) - (Stdlib.Option.Option.Some 7L) - (fun x y z -> Stdlib.Option.Option.Some(x + y + z)) = Stdlib.Option.Option.Some 18L - - -Stdlib.Option.andThen3_v0 - Stdlib.Option.Option.None - (Stdlib.Option.Option.Some 6L) - (Stdlib.Option.Option.Some 7L) - (fun x y z -> Stdlib.Option.Option.Some(x + y + z)) = Stdlib.Option.Option.None - -Stdlib.Option.andThen3_v0 - (Stdlib.Option.Option.Some 5L) - Stdlib.Option.Option.None - (Stdlib.Option.Option.Some 7L) - (fun x y z -> Stdlib.Option.Option.Some(x + y + z)) = Stdlib.Option.Option.None - -Stdlib.Option.andThen3_v0 - (Stdlib.Option.Option.Some 5L) - (Stdlib.Option.Option.Some 6L) - Stdlib.Option.Option.None - (fun x y z -> Stdlib.Option.Option.Some(x + y + z)) = Stdlib.Option.Option.None - -Stdlib.Option.andThen3_v0 - Stdlib.Option.Option.None - Stdlib.Option.Option.None - Stdlib.Option.Option.None - (fun x y z -> Stdlib.Option.Option.Some(x + y + z)) = Stdlib.Option.Option.None - - -Stdlib.Option.andThen4_v0 - (Stdlib.Option.Option.Some 5L) - (Stdlib.Option.Option.Some 6L) - (Stdlib.Option.Option.Some 7L) - (Stdlib.Option.Option.Some 8L) - (fun x y z w -> Stdlib.Option.Option.Some(x + y + z + w)) = Stdlib.Option.Option.Some - 26L - - -Stdlib.Option.andThen4_v0 - Stdlib.Option.Option.None - (Stdlib.Option.Option.Some 6L) - (Stdlib.Option.Option.Some 7L) - (Stdlib.Option.Option.Some 8L) - (fun x y z w -> Stdlib.Option.Option.Some(x + y + z + w)) = Stdlib.Option.Option.None - -Stdlib.Option.andThen4_v0 - (Stdlib.Option.Option.Some 5L) - Stdlib.Option.Option.None - (Stdlib.Option.Option.Some 7L) - (Stdlib.Option.Option.Some 8L) - (fun x y z w -> Stdlib.Option.Option.Some(x + y + z + w)) = Stdlib.Option.Option.None - -Stdlib.Option.andThen4_v0 - (Stdlib.Option.Option.Some 5L) - (Stdlib.Option.Option.Some 6L) - Stdlib.Option.Option.None - (Stdlib.Option.Option.Some 8L) - (fun x y z w -> Stdlib.Option.Option.Some(x + y + z + w)) = Stdlib.Option.Option.None - -Stdlib.Option.andThen4_v0 - (Stdlib.Option.Option.Some 5L) - (Stdlib.Option.Option.Some 6L) - (Stdlib.Option.Option.Some 7L) - Stdlib.Option.Option.None - (fun x y z w -> Stdlib.Option.Option.Some(x + y + z + w)) = Stdlib.Option.Option.None - -Stdlib.Option.andThen4_v0 - Stdlib.Option.Option.None - Stdlib.Option.Option.None - Stdlib.Option.Option.None - Stdlib.Option.Option.None - (fun x y z w -> Stdlib.Option.Option.Some(x + y + z + w)) = Stdlib.Option.Option.None - - -Stdlib.Option.map (Stdlib.Option.Option.Some 4L) (fun x -> - Stdlib.Int64.divide_v0 x 2L) = Stdlib.Option.Option.Some 2L - -Stdlib.Option.map Stdlib.Option.Option.None (fun x -> Stdlib.Int64.divide_v0 x 2L) = Stdlib.Option.Option.None - - -Stdlib.Option.map2_v0 - (Stdlib.Option.Option.Some 10L) - (Stdlib.Option.Option.Some 1L) - (fun a b -> a - b) = Stdlib.Option.Option.Some 9L - -Stdlib.Option.map2_v0 - (Stdlib.Option.Option.Some 10L) - Stdlib.Option.Option.None - (fun a b -> a - b) = Stdlib.Option.Option.None - -Stdlib.Option.map2_v0 - Stdlib.Option.Option.None - (Stdlib.Option.Option.Some 1L) - (fun a b -> a - b) = Stdlib.Option.Option.None - -Stdlib.Option.map2_v0 Stdlib.Option.Option.None Stdlib.Option.Option.None (fun a b -> - a - b) = Stdlib.Option.Option.None - - -Stdlib.Option.map3_v0 - (Stdlib.Option.Option.Some 10L) - (Stdlib.Option.Option.Some 1L) - (Stdlib.Option.Option.Some 2L) - (fun a b c -> a - b - c) = Stdlib.Option.Option.Some 7L - -Stdlib.Option.map3_v0 - (Stdlib.Option.Option.Some 10L) - Stdlib.Option.Option.None - (Stdlib.Option.Option.Some 2L) - (fun a b c -> a - b - c) = Stdlib.Option.Option.None - -Stdlib.Option.map3_v0 - Stdlib.Option.Option.None - (Stdlib.Option.Option.Some 1L) - (Stdlib.Option.Option.Some 2L) - (fun a b c -> a - b - c) = Stdlib.Option.Option.None - -Stdlib.Option.map3_v0 - Stdlib.Option.Option.None - Stdlib.Option.Option.None - (Stdlib.Option.Option.Some 2L) - (fun a b c -> a - b - c) = Stdlib.Option.Option.None - -Stdlib.Option.map3_v0 - Stdlib.Option.Option.None - Stdlib.Option.Option.None - Stdlib.Option.Option.None - (fun a b c -> a - b - c) = Stdlib.Option.Option.None - - -Stdlib.Option.map4_v0 - (Stdlib.Option.Option.Some 10L) - (Stdlib.Option.Option.Some 1L) - (Stdlib.Option.Option.Some 2L) - (Stdlib.Option.Option.Some 3L) - (fun a b c d -> a - b - c - d) = Stdlib.Option.Option.Some 4L +Stdlib.Option.andThen2 + (Stdlib.Option.Option.Some(5L)) + (Stdlib.Option.Option.Some(6L)) + (fun x y -> Stdlib.Option.Option.Some(x + y)) +== Stdlib.Option.Option.Some(11L) + +Stdlib.Option.andThen2 + (Stdlib.Option.Option.Some(5L)) + Stdlib.Option.Option.None() + (fun x y -> Stdlib.Option.Option.Some(x + y)) +== Stdlib.Option.Option.None() + +Stdlib.Option.andThen2 + Stdlib.Option.Option.None() + (Stdlib.Option.Option.Some(6L)) + (fun x y -> Stdlib.Option.Option.Some(x + y)) +== Stdlib.Option.Option.None() + +Stdlib.Option.andThen2 + Stdlib.Option.Option.None() + Stdlib.Option.Option.None() + (fun x y -> Stdlib.Option.Option.Some(x + y)) +== Stdlib.Option.Option.None() + + +Stdlib.Option.andThen3 + (Stdlib.Option.Option.Some(5L)) + (Stdlib.Option.Option.Some(6L)) + (Stdlib.Option.Option.Some(7L)) + (fun x y z -> Stdlib.Option.Option.Some(x + y + z)) +== Stdlib.Option.Option.Some(18L) + + +Stdlib.Option.andThen3 + Stdlib.Option.Option.None() + (Stdlib.Option.Option.Some(6L)) + (Stdlib.Option.Option.Some(7L)) + (fun x y z -> Stdlib.Option.Option.Some(x + y + z)) +== Stdlib.Option.Option.None() + +Stdlib.Option.andThen3 + (Stdlib.Option.Option.Some(5L)) + Stdlib.Option.Option.None() + (Stdlib.Option.Option.Some(7L)) + (fun x y z -> Stdlib.Option.Option.Some(x + y + z)) +== Stdlib.Option.Option.None() + +Stdlib.Option.andThen3 + (Stdlib.Option.Option.Some(5L)) + (Stdlib.Option.Option.Some(6L)) + Stdlib.Option.Option.None() + (fun x y z -> Stdlib.Option.Option.Some(x + y + z)) +== Stdlib.Option.Option.None() + +Stdlib.Option.andThen3 + Stdlib.Option.Option.None() + Stdlib.Option.Option.None() + Stdlib.Option.Option.None() + (fun x y z -> Stdlib.Option.Option.Some(x + y + z)) +== Stdlib.Option.Option.None() + + +Stdlib.Option.andThen4 + (Stdlib.Option.Option.Some(5L)) + (Stdlib.Option.Option.Some(6L)) + (Stdlib.Option.Option.Some(7L)) + (Stdlib.Option.Option.Some(8L)) + (fun x y z w -> Stdlib.Option.Option.Some(x + y + z + w)) +== Stdlib.Option.Option.Some(26L) + + +Stdlib.Option.andThen4 + Stdlib.Option.Option.None() + (Stdlib.Option.Option.Some(6L)) + (Stdlib.Option.Option.Some(7L)) + (Stdlib.Option.Option.Some(8L)) + (fun x y z w -> Stdlib.Option.Option.Some(x + y + z + w)) +== Stdlib.Option.Option.None() + +Stdlib.Option.andThen4 + (Stdlib.Option.Option.Some(5L)) + Stdlib.Option.Option.None() + (Stdlib.Option.Option.Some(7L)) + (Stdlib.Option.Option.Some(8L)) + (fun x y z w -> Stdlib.Option.Option.Some(x + y + z + w)) +== Stdlib.Option.Option.None() + +Stdlib.Option.andThen4 + (Stdlib.Option.Option.Some(5L)) + (Stdlib.Option.Option.Some(6L)) + Stdlib.Option.Option.None() + (Stdlib.Option.Option.Some(8L)) + (fun x y z w -> Stdlib.Option.Option.Some(x + y + z + w)) +== Stdlib.Option.Option.None() + +Stdlib.Option.andThen4 + (Stdlib.Option.Option.Some(5L)) + (Stdlib.Option.Option.Some(6L)) + (Stdlib.Option.Option.Some(7L)) + Stdlib.Option.Option.None() + (fun x y z w -> Stdlib.Option.Option.Some(x + y + z + w)) +== Stdlib.Option.Option.None() + +Stdlib.Option.andThen4 + Stdlib.Option.Option.None() + Stdlib.Option.Option.None() + Stdlib.Option.Option.None() + Stdlib.Option.Option.None() + (fun x y z w -> Stdlib.Option.Option.Some(x + y + z + w)) +== Stdlib.Option.Option.None() + + +Stdlib.Option.map (Stdlib.Option.Option.Some(4L)) (fun x -> + Stdlib.Int64.divide x 2L) == Stdlib.Option.Option.Some(2L) + +Stdlib.Option.map Stdlib.Option.Option.None() (fun x -> Stdlib.Int64.divide x 2L) == Stdlib.Option.Option.None() + + +Stdlib.Option.map2 + (Stdlib.Option.Option.Some(10L)) + (Stdlib.Option.Option.Some(1L)) + (fun a b -> a - b) +== Stdlib.Option.Option.Some(9L) + +Stdlib.Option.map2 + (Stdlib.Option.Option.Some(10L)) + Stdlib.Option.Option.None() + (fun a b -> a - b) +== Stdlib.Option.Option.None() + +Stdlib.Option.map2 + Stdlib.Option.Option.None() + (Stdlib.Option.Option.Some(1L)) + (fun a b -> a - b) +== Stdlib.Option.Option.None() + +Stdlib.Option.map2 Stdlib.Option.Option.None() Stdlib.Option.Option.None() (fun a b -> + a - b) == Stdlib.Option.Option.None() + + +Stdlib.Option.map3 + (Stdlib.Option.Option.Some(10L)) + (Stdlib.Option.Option.Some(1L)) + (Stdlib.Option.Option.Some(2L)) + (fun a b c -> a - b - c) +== Stdlib.Option.Option.Some(7L) + +Stdlib.Option.map3 + (Stdlib.Option.Option.Some(10L)) + Stdlib.Option.Option.None() + (Stdlib.Option.Option.Some(2L)) + (fun a b c -> a - b - c) +== Stdlib.Option.Option.None() + +Stdlib.Option.map3 + Stdlib.Option.Option.None() + (Stdlib.Option.Option.Some(1L)) + (Stdlib.Option.Option.Some(2L)) + (fun a b c -> a - b - c) +== Stdlib.Option.Option.None() + +Stdlib.Option.map3 + Stdlib.Option.Option.None() + Stdlib.Option.Option.None() + (Stdlib.Option.Option.Some(2L)) + (fun a b c -> a - b - c) +== Stdlib.Option.Option.None() + +Stdlib.Option.map3 + Stdlib.Option.Option.None() + Stdlib.Option.Option.None() + Stdlib.Option.Option.None() + (fun a b c -> a - b - c) +== Stdlib.Option.Option.None() + + +Stdlib.Option.map4 + (Stdlib.Option.Option.Some(10L)) + (Stdlib.Option.Option.Some(1L)) + (Stdlib.Option.Option.Some(2L)) + (Stdlib.Option.Option.Some(3L)) + (fun a b c d -> a - b - c - d) +== Stdlib.Option.Option.Some(4L) + +Stdlib.Option.map4 + (Stdlib.Option.Option.Some(10L)) + Stdlib.Option.Option.None() + (Stdlib.Option.Option.Some(2L)) + (Stdlib.Option.Option.Some(3L)) + (fun a b c d -> a - b - c - d) +== Stdlib.Option.Option.None() + +Stdlib.Option.map4 + Stdlib.Option.Option.None() + (Stdlib.Option.Option.Some(1L)) + (Stdlib.Option.Option.Some(2L)) + (Stdlib.Option.Option.Some(3L)) + (fun a b c d -> a - b - c - d) +== Stdlib.Option.Option.None() + +Stdlib.Option.map4 + Stdlib.Option.Option.None() + Stdlib.Option.Option.None() + (Stdlib.Option.Option.Some(2L)) + (Stdlib.Option.Option.Some(3L)) + (fun a b c d -> a - b - c - d) +== Stdlib.Option.Option.None() -Stdlib.Option.map4_v0 - (Stdlib.Option.Option.Some 10L) - Stdlib.Option.Option.None - (Stdlib.Option.Option.Some 2L) - (Stdlib.Option.Option.Some 3L) - (fun a b c d -> a - b - c - d) = Stdlib.Option.Option.None +Stdlib.Option.map4 + Stdlib.Option.Option.None() + Stdlib.Option.Option.None() + Stdlib.Option.Option.None() + (Stdlib.Option.Option.Some(3L)) + (fun a b c d -> a - b - c - d) +== Stdlib.Option.Option.None() -Stdlib.Option.map4_v0 - Stdlib.Option.Option.None - (Stdlib.Option.Option.Some 1L) - (Stdlib.Option.Option.Some 2L) - (Stdlib.Option.Option.Some 3L) - (fun a b c d -> a - b - c - d) = Stdlib.Option.Option.None +Stdlib.Option.map4 + Stdlib.Option.Option.None() + Stdlib.Option.Option.None() + Stdlib.Option.Option.None() + Stdlib.Option.Option.None() + (fun a b c d -> a - b - c - d) +== Stdlib.Option.Option.None() -Stdlib.Option.map4_v0 - Stdlib.Option.Option.None - Stdlib.Option.Option.None - (Stdlib.Option.Option.Some 2L) - (Stdlib.Option.Option.Some 3L) - (fun a b c d -> a - b - c - d) = Stdlib.Option.Option.None -Stdlib.Option.map4_v0 - Stdlib.Option.Option.None - Stdlib.Option.Option.None - Stdlib.Option.Option.None - (Stdlib.Option.Option.Some 3L) - (fun a b c d -> a - b - c - d) = Stdlib.Option.Option.None +Stdlib.Option.map5 + (Stdlib.Option.Option.Some(10L)) + (Stdlib.Option.Option.Some(1L)) + (Stdlib.Option.Option.Some(2L)) + (Stdlib.Option.Option.Some(3L)) + (Stdlib.Option.Option.Some(4L)) + (fun a b c d e -> a - b - c - d - e) +== Stdlib.Option.Option.Some(0L) -Stdlib.Option.map4_v0 - Stdlib.Option.Option.None - Stdlib.Option.Option.None - Stdlib.Option.Option.None - Stdlib.Option.Option.None - (fun a b c d -> a - b - c - d) = Stdlib.Option.Option.None +Stdlib.Option.map5 + (Stdlib.Option.Option.Some(10L)) + Stdlib.Option.Option.None() + (Stdlib.Option.Option.Some(2L)) + (Stdlib.Option.Option.Some(3L)) + (Stdlib.Option.Option.Some(4L)) + (fun a b c d e -> a - b - c - d - e) +== Stdlib.Option.Option.None() +Stdlib.Option.map5 + Stdlib.Option.Option.None() + Stdlib.Option.Option.None() + Stdlib.Option.Option.None() + Stdlib.Option.Option.None() + Stdlib.Option.Option.None() + (fun a b c d e -> a - b - c - d - e) +== Stdlib.Option.Option.None() -Stdlib.Option.map5_v0 - (Stdlib.Option.Option.Some 10L) - (Stdlib.Option.Option.Some 1L) - (Stdlib.Option.Option.Some 2L) - (Stdlib.Option.Option.Some 3L) - (Stdlib.Option.Option.Some 4L) - (fun a b c d e -> a - b - c - d - e) = Stdlib.Option.Option.Some 0L -Stdlib.Option.map5_v0 - (Stdlib.Option.Option.Some 10L) - Stdlib.Option.Option.None - (Stdlib.Option.Option.Some 2L) - (Stdlib.Option.Option.Some 3L) - (Stdlib.Option.Option.Some 4L) - (fun a b c d e -> a - b - c - d - e) = Stdlib.Option.Option.None +Stdlib.Option.mapWithDefault (Stdlib.Option.Option.Some(5L)) 6L (fun x -> x + 1L) == 6L -Stdlib.Option.map5_v0 - Stdlib.Option.Option.None - Stdlib.Option.Option.None - Stdlib.Option.Option.None - Stdlib.Option.Option.None - Stdlib.Option.Option.None - (fun a b c d e -> a - b - c - d - e) = Stdlib.Option.Option.None +Stdlib.Option.mapWithDefault Stdlib.Option.Option.None() 6L (fun x -> x + 1L) == 6L +Stdlib.Option.mapWithDefault + (Stdlib.Option.Option.Some(5L)) + Stdlib.Option.Option.None() + (fun x -> x + 1L) +== 6L -Stdlib.Option.mapWithDefault_v0 (Stdlib.Option.Option.Some 5L) 6L (fun x -> x + 1L) = 6L +Stdlib.Option.mapWithDefault + Stdlib.Option.Option.None() + Stdlib.Option.Option.None() + (fun x -> x + 1L) +== Stdlib.Option.Option.None() -Stdlib.Option.mapWithDefault_v0 Stdlib.Option.Option.None 6L (fun x -> x + 1L) = 6L +Stdlib.Option.withDefault (Stdlib.Option.Option.Some(6L)) 5L == 6L -Stdlib.Option.mapWithDefault_v0 - (Stdlib.Option.Option.Some 5L) - Stdlib.Option.Option.None - (fun x -> x + 1L) = 6L +Stdlib.Option.withDefault Stdlib.Option.Option.None() 5L == 5L -Stdlib.Option.mapWithDefault_v0 - Stdlib.Option.Option.None - Stdlib.Option.Option.None - (fun x -> x + 1L) = Stdlib.Option.Option.None +Stdlib.Option.isSome (Stdlib.Option.Option.Some(6L)) == true -Stdlib.Option.withDefault_v0 (Stdlib.Option.Option.Some 6L) 5L = 6L +Stdlib.Option.isSome Stdlib.Option.Option.None() == false -Stdlib.Option.withDefault_v0 Stdlib.Option.Option.None 5L = 5L +Stdlib.Option.isNone (Stdlib.Option.Option.Some(6L)) == false -Stdlib.Option.isSome_v0 (Stdlib.Option.Option.Some 6L) = true +Stdlib.Option.isNone Stdlib.Option.Option.None() == true -Stdlib.Option.isSome_v0 Stdlib.Option.Option.None = false +Stdlib.Option.toResult (Stdlib.Option.Option.Some(6L)) 5L == Stdlib.Result.Result.Ok(6L) -Stdlib.Option.isNone_v0 (Stdlib.Option.Option.Some 6L) = false +Stdlib.Option.toResult Stdlib.Option.Option.None() "error" == Stdlib.Result.Result.Error("error") -Stdlib.Option.isNone_v0 Stdlib.Option.Option.None = true +Stdlib.Option.and (Stdlib.Option.Option.Some(6L)) (Stdlib.Option.Option.Some(5L)) == Stdlib.Option.Option.Some(5L) +Stdlib.Option.and (Stdlib.Option.Option.Some(6L)) Stdlib.Option.Option.None() == Stdlib.Option.Option.None() -Stdlib.Option.toResult_v0 (Stdlib.Option.Option.Some 6L) 5L = Stdlib.Result.Result.Ok - 6L +Stdlib.Option.and Stdlib.Option.Option.None() (Stdlib.Option.Option.Some(5L)) == Stdlib.Option.Option.None() -Stdlib.Option.toResult_v0 Stdlib.Option.Option.None "error" = Stdlib.Result.Result.Error - "error" +Stdlib.Option.and Stdlib.Option.Option.None() Stdlib.Option.Option.None() == Stdlib.Option.Option.None() +Stdlib.Option.or (Stdlib.Option.Option.Some(6L)) (Stdlib.Option.Option.Some(5L)) == Stdlib.Option.Option.Some(6L) -Stdlib.Option.and_v0 (Stdlib.Option.Option.Some 6L) (Stdlib.Option.Option.Some 5L) = Stdlib.Option.Option.Some - 5L +Stdlib.Option.or (Stdlib.Option.Option.Some(6L)) Stdlib.Option.Option.None() == Stdlib.Option.Option.Some(6L) -Stdlib.Option.and_v0 (Stdlib.Option.Option.Some 6L) Stdlib.Option.Option.None = Stdlib.Option.Option.None +Stdlib.Option.or Stdlib.Option.Option.None() (Stdlib.Option.Option.Some(5L)) == Stdlib.Option.Option.Some(5L) -Stdlib.Option.and_v0 Stdlib.Option.Option.None (Stdlib.Option.Option.Some 5L) = Stdlib.Option.Option.None +Stdlib.Option.or Stdlib.Option.Option.None() Stdlib.Option.Option.None() == Stdlib.Option.Option.None() -Stdlib.Option.and_v0 Stdlib.Option.Option.None Stdlib.Option.Option.None = Stdlib.Option.Option.None +Stdlib.Option.toList (Stdlib.Option.Option.Some(6L)) == [ 6L ] +Stdlib.Option.toList Stdlib.Option.Option.None() == [] -Stdlib.Option.or_v0 (Stdlib.Option.Option.Some 6L) (Stdlib.Option.Option.Some 5L) = Stdlib.Option.Option.Some - 6L +Stdlib.Option.join (Stdlib.Option.Option.Some(Stdlib.Option.Option.Some(6L))) == Stdlib.Option.Option.Some(6L) -Stdlib.Option.or_v0 (Stdlib.Option.Option.Some 6L) Stdlib.Option.Option.None = Stdlib.Option.Option.Some - 6L +Stdlib.Option.join (Stdlib.Option.Option.Some(Stdlib.Option.Option.None())) == Stdlib.Option.Option.None() -Stdlib.Option.or_v0 Stdlib.Option.Option.None (Stdlib.Option.Option.Some 5L) = Stdlib.Option.Option.Some - 5L +Stdlib.Option.join Stdlib.Option.Option.None() == Stdlib.Option.Option.None() -Stdlib.Option.or_v0 Stdlib.Option.Option.None Stdlib.Option.Option.None = Stdlib.Option.Option.None +Stdlib.Option.combine + [ Stdlib.Option.Option.Some(6L) + Stdlib.Option.Option.Some(5L) + Stdlib.Option.Option.Some(4L) + Stdlib.Option.Option.Some(3L) ] +== Stdlib.Option.Option.Some([ 6L; 5L; 4L; 3L ]) -Stdlib.Option.toList_v0 (Stdlib.Option.Option.Some 6L) = [ 6L ] +Stdlib.Option.combine + [ Stdlib.Option.Option.Some(6L) + Stdlib.Option.Option.None() + Stdlib.Option.Option.Some(4L) + Stdlib.Option.Option.Some(3L) ] +== Stdlib.Option.Option.None() -Stdlib.Option.toList_v0 Stdlib.Option.Option.None = [] - - -Stdlib.Option.join_v0 (Stdlib.Option.Option.Some(Stdlib.Option.Option.Some 6L)) = Stdlib.Option.Option.Some - 6L - -Stdlib.Option.join_v0 (Stdlib.Option.Option.Some(Stdlib.Option.Option.None)) = Stdlib.Option.Option.None - -Stdlib.Option.join_v0 Stdlib.Option.Option.None = Stdlib.Option.Option.None - - -Stdlib.Option.combine_v0 - [ Stdlib.Option.Option.Some 6L - Stdlib.Option.Option.Some 5L - Stdlib.Option.Option.Some 4L - Stdlib.Option.Option.Some 3L ] = Stdlib.Option.Option.Some [ 6L; 5L; 4L; 3L ] - -Stdlib.Option.combine_v0 - [ Stdlib.Option.Option.Some 6L - Stdlib.Option.Option.None - Stdlib.Option.Option.Some 4L - Stdlib.Option.Option.Some 3L ] = Stdlib.Option.Option.None - -Stdlib.Option.combine_v0 - [ Stdlib.Option.Option.None - Stdlib.Option.Option.None - Stdlib.Option.Option.None - Stdlib.Option.Option.None ] = Stdlib.Option.Option.None +Stdlib.Option.combine + [ Stdlib.Option.Option.None() + Stdlib.Option.Option.None() + Stdlib.Option.Option.None() + Stdlib.Option.Option.None() ] +== Stdlib.Option.Option.None() Stdlib.Option.values - [ Stdlib.Option.Option.Some 6L - Stdlib.Option.Option.Some 5L - Stdlib.Option.Option.Some 4L - Stdlib.Option.Option.Some 3L ] = [ 6L; 5L; 4L; 3L ] + [ Stdlib.Option.Option.Some(6L) + Stdlib.Option.Option.Some(5L) + Stdlib.Option.Option.Some(4L) + Stdlib.Option.Option.Some(3L) ] +== [ 6L; 5L; 4L; 3L ] Stdlib.Option.values - [ Stdlib.Option.Option.Some 6L - Stdlib.Option.Option.None - Stdlib.Option.Option.Some 4L - Stdlib.Option.Option.Some 3L ] = [ 6L; 4L; 3L ] + [ Stdlib.Option.Option.Some(6L) + Stdlib.Option.Option.None() + Stdlib.Option.Option.Some(4L) + Stdlib.Option.Option.Some(3L) ] +== [ 6L; 4L; 3L ] Stdlib.Option.values - [ Stdlib.Option.Option.Some 6L - Stdlib.Option.Option.None - Stdlib.Option.Option.None - Stdlib.Option.Option.None ] = [ 6L ] + [ Stdlib.Option.Option.Some(6L) + Stdlib.Option.Option.None() + Stdlib.Option.Option.None() + Stdlib.Option.Option.None() ] +== [ 6L ] Stdlib.Option.values - [ Stdlib.Option.Option.None - Stdlib.Option.Option.None - Stdlib.Option.Option.None - Stdlib.Option.Option.None ] = [] \ No newline at end of file + [ Stdlib.Option.Option.None() + Stdlib.Option.Option.None() + Stdlib.Option.Option.None() + Stdlib.Option.Option.None() ] +== [] \ No newline at end of file diff --git a/backend/testfiles/execution/stdlib/parser.dark b/backend/testfiles/execution/stdlib/parser.dark index 36d557b38c..417e95fa68 100644 --- a/backend/testfiles/execution/stdlib/parser.dark +++ b/backend/testfiles/execution/stdlib/parser.dark @@ -3,7 +3,7 @@ type Point = PACKAGE.Darklang.LanguageTools.Parser.Point type Range = PACKAGE.Darklang.LanguageTools.Parser.Range type ParsedNode = PACKAGE.Darklang.LanguageTools.Parser.ParsedNode -let range (s: Int64 * Int64) (e: Int64 * Int64) : Range = +let range (s: (Int64 * Int64)) (e: (Int64 * Int64)) : Range = let (startRow, startColumn) = s let (endRow, endColumn) = e @@ -23,76 +23,78 @@ module ParseToSimplifiedTree = (let parsed = Builtin.parserParseToSimplifiedTree "let add (a: Int) (b: Int): Int =\n let sum = a + b\n sum" - - parsed.typ) = "source_file" + parsed.typ) == "source_file" // simplest type alias - ("type ID = Int64" |> Builtin.parserParseToSimplifiedTree) = ParsedNode + ("type ID = Int64" |> Builtin.parserParseToSimplifiedTree) + == ParsedNode { typ = "source_file" - fieldName = Stdlib.Option.Option.None + fieldName = Stdlib.Option.Option.None() text = "type ID = Int64" - range = range (0L, 0L) (0L, 15L) + range = (range (0L, 0L) (0L, 15L)) children = [ ParsedNode - { fieldName = Stdlib.Option.Option.None + { fieldName = Stdlib.Option.Option.None() typ = "type_decl" text = "type ID = Int64" - range = range (0L, 0L) (0L, 15L) + range = (range (0L, 0L) (0L, 15L)) children = [ ParsedNode - { fieldName = Stdlib.Option.Option.Some "keyword_type" + { fieldName = Stdlib.Option.Option.Some("keyword_type") typ = "keyword" text = "type" - range = range (0L, 0L) (0L, 4L) + range = (range (0L, 0L) (0L, 4L)) children = [] } ParsedNode - { fieldName = Stdlib.Option.Option.Some "name" + { fieldName = Stdlib.Option.Option.Some("name") typ = "type_identifier" text = "ID" - range = range (0L, 5L) (0L, 7L) + range = (range (0L, 5L) (0L, 7L)) children = [] } ParsedNode - { fieldName = Stdlib.Option.Option.Some "symbol_equals" + { fieldName = Stdlib.Option.Option.Some("symbol_equals") typ = "symbol" text = "=" - range = range (0L, 8L) (0L, 9L) + range = (range (0L, 8L) (0L, 9L)) children = [] } ParsedNode - { fieldName = Stdlib.Option.Option.Some "typ" + { fieldName = Stdlib.Option.Option.Some("typ") typ = "type_decl_def" text = "Int64" - range = range (0L, 10L) (0L, 15L) + range = (range (0L, 10L) (0L, 15L)) children = [ ParsedNode - { fieldName = Stdlib.Option.Option.None + { fieldName = Stdlib.Option.Option.None() typ = "type_decl_def_alias" text = "Int64" - range = range (0L, 10L) (0L, 15L) + range = (range (0L, 10L) (0L, 15L)) children = [ ParsedNode - { fieldName = Stdlib.Option.Option.None + { fieldName = Stdlib.Option.Option.None() typ = "type_reference" text = "Int64" - range = range (0L, 10L) (0L, 15L) + range = (range (0L, 10L) (0L, 15L)) children = [ ParsedNode - { fieldName = Stdlib.Option.Option.None + { fieldName = Stdlib.Option.Option.None() typ = "builtin_type" text = "Int64" - range = range (0L, 10L) (0L, 15L) + range = (range (0L, 10L) (0L, 15L)) children = [] } ] } ] } ] } ] } ] } - ("" |> Builtin.parserParseToSimplifiedTree) = ParsedNode - { typ = "source_file" - fieldName = Stdlib.Option.Option.None - text = "" - range = range (0L, 0L) (0L, 0L) - children = [] } + ("" |> Builtin.parserParseToSimplifiedTree) + == + ParsedNode + { typ = "source_file" + fieldName = Stdlib.Option.Option.None() + text = "" + range = (range (0L, 0L) (0L, 0L)) + children = [] } // These tests are a huge pain to write and maintain // Let's focus on roundtripping tests, largely, @@ -103,56 +105,28 @@ module ParseNodeToWrittenTypes = ("type MyID = Int64" |> PACKAGE.Darklang.LanguageTools.Parser.parseToSimplifiedTree |> PACKAGE.Darklang.LanguageTools.Parser.parseFromTree - |> Builtin.unwrap) = PACKAGE - .Darklang - .LanguageTools - .WrittenTypes - .ParsedFile - .SourceFile( - PACKAGE.Darklang.LanguageTools.WrittenTypes.SourceFile.SourceFile - { range = range (0L, 0L) (0L, 17L) - declarations = - [ PACKAGE - .Darklang - .LanguageTools - .WrittenTypes - .SourceFile - .SourceFileDeclaration - .Type( - (PACKAGE.Darklang.LanguageTools.WrittenTypes.TypeDeclaration.TypeDeclaration - { range = range (0L, 0L) (0L, 17L) - name = - PACKAGE.Darklang.LanguageTools.WrittenTypes.TypeIdentifier - { range = range (0L, 5L) (0L, 9L) - name = "MyID" } - typeParams = [] - definition = - PACKAGE - .Darklang - .LanguageTools - .WrittenTypes - .TypeDeclaration - .Definition - .Alias( - PACKAGE - .Darklang - .LanguageTools - .WrittenTypes - .TypeReference - .TypeReference - .Builtin( - PACKAGE - .Darklang - .LanguageTools - .WrittenTypes - .TypeReference - .Builtin - .TInt64(range (0L, 12L) (0L, 17L)) - ) - ) - keywordType = range (0L, 0L) (0L, 4L) - symbolEquals = range (0L, 10L) (0L, 11L) }) - ) ] - unparseableStuff = [] - exprsToEval = [] } - ) \ No newline at end of file + |> Builtin.unwrap) + == PACKAGE.Darklang.LanguageTools.WrittenTypes.ParsedFile.SourceFile( + PACKAGE.Darklang.LanguageTools.WrittenTypes.SourceFile.SourceFile + { range = (range (0L, 0L) (0L, 17L)) + declarations = + [ PACKAGE.Darklang.LanguageTools.WrittenTypes.SourceFile.SourceFileDeclaration.Type( + (PACKAGE.Darklang.LanguageTools.WrittenTypes.TypeDeclaration.TypeDeclaration + { range = (range (0L, 0L) (0L, 17L)) + name = + PACKAGE.Darklang.LanguageTools.WrittenTypes.TypeIdentifier + { range = (range (0L, 5L) (0L, 9L)) + name = "MyID" } + typeParams = [] + definition = + PACKAGE.Darklang.LanguageTools.WrittenTypes.TypeDeclaration.Definition.Alias( + PACKAGE.Darklang.LanguageTools.WrittenTypes.TypeReference.TypeReference.Builtin( + PACKAGE.Darklang.LanguageTools.WrittenTypes.TypeReference.Builtin.TInt64(range (0L, 12L) (0L, 17L)) + ) + ) + keywordType = (range (0L, 0L) (0L, 4L)) + symbolEquals = (range (0L, 10L) (0L, 11L)) }) + ) ] + unparseableStuff = [] + exprsToEval = [] } + ) \ No newline at end of file diff --git a/backend/testfiles/execution/stdlib/result.dark b/backend/testfiles/execution/stdlib/result.dark index 5d4de58ddd..c5f76d6a32 100644 --- a/backend/testfiles/execution/stdlib/result.dark +++ b/backend/testfiles/execution/stdlib/result.dark @@ -1,303 +1,336 @@ -Stdlib.Result.andThen (Stdlib.Result.Result.Error "test") (fun x -> - Stdlib.Result.Result.Error "test") = Stdlib.Result.Result.Error "test" +Stdlib.Result.andThen (Stdlib.Result.Result.Error("test")) (fun x -> + Stdlib.Result.Result.Error("test")) +== Stdlib.Result.Result.Error("test") -Stdlib.Result.andThen (Stdlib.Result.Result.Error "test") (fun x -> - Stdlib.Result.Result.Ok 5L) = Stdlib.Result.Result.Error "test" +Stdlib.Result.andThen (Stdlib.Result.Result.Error("test")) (fun x -> + Stdlib.Result.Result.Ok(5L)) +== Stdlib.Result.Result.Error("test") -Stdlib.Result.andThen (Stdlib.Result.Result.Ok 5L) (fun x -> - Stdlib.Result.Result.Error "test") = Stdlib.Result.Result.Error "test" +Stdlib.Result.andThen (Stdlib.Result.Result.Ok(5L)) (fun x -> + Stdlib.Result.Result.Error("test")) +== Stdlib.Result.Result.Error("test") -Stdlib.Result.andThen (Stdlib.Result.Result.Ok 5L) (fun x -> - Stdlib.Result.Result.Ok(1L + x)) = Stdlib.Result.Result.Ok 6L +Stdlib.Result.andThen (Stdlib.Result.Result.Ok(5L)) (fun x -> + Stdlib.Result.Result.Ok(1L + x)) +== Stdlib.Result.Result.Ok(6L) Stdlib.Result.collect - [ Stdlib.Result.Result.Ok 5L - Stdlib.Result.Result.Ok 6L - Stdlib.Result.Result.Ok 7L ] = Stdlib.Result.Result.Ok [ 5L; 6L; 7L ] + [ Stdlib.Result.Result.Ok(5L) + Stdlib.Result.Result.Ok(6L) + Stdlib.Result.Result.Ok(7L) ] +== Stdlib.Result.Result.Ok([ 5L; 6L; 7L ]) Stdlib.Result.collect - [ Stdlib.Result.Result.Ok 5L - Stdlib.Result.Result.Error "test" - Stdlib.Result.Result.Ok 7L ] = Stdlib.Result.Result.Error "test" + [ Stdlib.Result.Result.Ok(5L) + Stdlib.Result.Result.Error("test") + Stdlib.Result.Result.Ok(7L) ] +== Stdlib.Result.Result.Error("test") Stdlib.Result.collect - [ Stdlib.Result.Result.Ok 5L - Stdlib.Result.Result.Error "test" - Stdlib.Result.Result.Error "test2" ] = Stdlib.Result.Result.Error "test" + [ Stdlib.Result.Result.Ok(5L) + Stdlib.Result.Result.Error("test") + Stdlib.Result.Result.Error("test2") ] +== Stdlib.Result.Result.Error("test") Stdlib.Result.collect - [ Stdlib.Result.Result.Error "test"; Stdlib.Result.Result.Error "test2" ] = Stdlib.Result.Result.Error - "test" + [ Stdlib.Result.Result.Error("test"); Stdlib.Result.Result.Error("test2") ] +== Stdlib.Result.Result.Error("test") -Stdlib.Result.collect [] = Stdlib.Result.Result.Ok [] +Stdlib.Result.collect [] == Stdlib.Result.Result.Ok([]) -Stdlib.Result.fromOption (Stdlib.Option.Option.Some 6L) "test" = Stdlib.Result.Result.Ok - 6L +Stdlib.Result.fromOption (Stdlib.Option.Option.Some(6L)) "test" +== Stdlib.Result.Result.Ok(6L) -Stdlib.Result.fromOption Stdlib.Option.Option.None "test" = Stdlib.Result.Result.Error - "test" +Stdlib.Result.fromOption Stdlib.Option.Option.None() "test" +== Stdlib.Result.Result.Error("test") Stdlib.Result.fromOption - (Stdlib.Option.Option.Some(Stdlib.Result.Result.Error "test")) - "test" = Stdlib.Result.Result.Ok(Stdlib.Result.Result.Error "test") - -Stdlib.Result.fromOption Stdlib.Option.Option.None (1L, 2L, 3L) = Stdlib - .Result - .Result - .Error((1L, 2L, 3L)) - -Stdlib.Result.fromOption Stdlib.Option.Option.None Stdlib.Option.Option.None = Stdlib.Result.Result.Error - Stdlib.Option.Option.None - - - -Stdlib.Result.map2_v0 - (Stdlib.Result.Result.Error "error1") - (Stdlib.Result.Result.Error "error2") - (fun a b -> a - b) = Stdlib.Result.Result.Error "error1" - -Stdlib.Result.map2_v0 - (Stdlib.Result.Result.Error "error1") - (Stdlib.Result.Result.Ok 1L) - (fun a b -> a - b) = Stdlib.Result.Result.Error "error1" - -Stdlib.Result.map2_v0 - (Stdlib.Result.Result.Ok 10L) - (Stdlib.Result.Result.Error "error2") - (fun a b -> a - b) = Stdlib.Result.Result.Error "error2" - -Stdlib.Result.map2_v0 - (Stdlib.Result.Result.Ok 10L) - (Stdlib.Result.Result.Ok 1L) - (fun a b -> a - b) = Stdlib.Result.Result.Ok 9L - - - -Stdlib.Result.map3_v0 - (Stdlib.Result.Result.Error "error1") - (Stdlib.Result.Result.Error "error2") - (Stdlib.Result.Result.Error "error3") - (fun a b c -> a - b - c) = Stdlib.Result.Result.Error "error1" - -Stdlib.Result.map3_v0 - (Stdlib.Result.Result.Error "error1") - (Stdlib.Result.Result.Error "error2") - (Stdlib.Result.Result.Ok 1L) - (fun a b c -> a - b - c) = Stdlib.Result.Result.Error "error1" - -Stdlib.Result.map3_v0 - (Stdlib.Result.Result.Ok 10L) - (Stdlib.Result.Result.Error "error2") - (Stdlib.Result.Result.Error "error3") - (fun a b c -> a - b - c) = Stdlib.Result.Result.Error "error2" - -Stdlib.Result.map3_v0 - (Stdlib.Result.Result.Ok 10L) - (Stdlib.Result.Result.Ok 1L) - (Stdlib.Result.Result.Error "error3") - (fun a b c -> a - b - c) = Stdlib.Result.Result.Error "error3" - -Stdlib.Result.map3_v0 - (Stdlib.Result.Result.Ok 10L) - (Stdlib.Result.Result.Ok 1L) - (Stdlib.Result.Result.Ok 1L) - (fun a b c -> a - b - c) = Stdlib.Result.Result.Ok 8L - - -Stdlib.Result.map4_v0 - (Stdlib.Result.Result.Error "error1") - (Stdlib.Result.Result.Error "error2") - (Stdlib.Result.Result.Error "error3") - (Stdlib.Result.Result.Error "error4") - (fun a b c d -> a - b - c - d) = Stdlib.Result.Result.Error "error1" - -Stdlib.Result.map4_v0 - (Stdlib.Result.Result.Error "error1") - (Stdlib.Result.Result.Error "error2") - (Stdlib.Result.Result.Error "error3") - (Stdlib.Result.Result.Ok 1L) - (fun a b c d -> a - b - c - d) = Stdlib.Result.Result.Error "error1" - -Stdlib.Result.map4_v0 - (Stdlib.Result.Result.Ok 10L) - (Stdlib.Result.Result.Ok 1L) - (Stdlib.Result.Result.Ok 1L) - (Stdlib.Result.Result.Error "error4") - (fun a b c d -> a - b - c - d) = Stdlib.Result.Result.Error "error4" - -Stdlib.Result.map4_v0 - (Stdlib.Result.Result.Ok 10L) - (Stdlib.Result.Result.Ok 1L) - (Stdlib.Result.Result.Ok 1L) - (Stdlib.Result.Result.Ok 2L) - (fun a b c d -> a - b - c - d) = Stdlib.Result.Result.Ok 6L - - -Stdlib.Result.map5_v0 - (Stdlib.Result.Result.Error "error1") - (Stdlib.Result.Result.Error "error2") - (Stdlib.Result.Result.Error "error3") - (Stdlib.Result.Result.Error "error4") - (Stdlib.Result.Result.Error "error5") - (fun a b c d e -> a - b - c - d - e) = Stdlib.Result.Result.Error "error1" - -Stdlib.Result.map5_v0 - (Stdlib.Result.Result.Error "error1") - (Stdlib.Result.Result.Error "error2") - (Stdlib.Result.Result.Error "error3") - (Stdlib.Result.Result.Error "error4") - (Stdlib.Result.Result.Ok 1L) - (fun a b c d e -> a - b - c - d - e) = Stdlib.Result.Result.Error "error1" - -Stdlib.Result.map5_v0 - (Stdlib.Result.Result.Ok 10L) - (Stdlib.Result.Result.Ok 1L) - (Stdlib.Result.Result.Ok 1L) - (Stdlib.Result.Result.Ok 2L) - (Stdlib.Result.Result.Error "error5") - (fun a b c d e -> a - b - c - d - e) = Stdlib.Result.Result.Error "error5" - -Stdlib.Result.map5_v0 - (Stdlib.Result.Result.Ok 10L) - (Stdlib.Result.Result.Ok 1L) - (Stdlib.Result.Result.Ok 1L) - (Stdlib.Result.Result.Ok 2L) - (Stdlib.Result.Result.Ok 3L) - (fun a b c d e -> a - b - c - d - e) = Stdlib.Result.Result.Ok 3L - - - -Stdlib.Result.mapWithDefault_v0 (Stdlib.Result.Result.Error "test") 5L (fun x -> - x + 1L) = 5L - -Stdlib.Result.mapWithDefault_v0 (Stdlib.Result.Result.Ok 6L) 5L (fun x -> x + 1L) = 7L - -Stdlib.Result.mapWithDefault_v0 - (Stdlib.Result.Result.Error "test1") - (Stdlib.Result.Result.Error "test2") - (fun x -> x + 1L) = Stdlib.Result.Result.Error "test2" - - - -Stdlib.Result.mapError (Stdlib.Result.Result.Error "test") (fun x -> - Stdlib.String.append x "-appended") = Stdlib.Result.Result.Error "test-appended" - -Stdlib.Result.mapError (Stdlib.Result.Result.Ok 4L) (fun x -> - Stdlib.Int64.divide_v0 x 2L) = Stdlib.Result.Result.Ok 4L - - -Stdlib.Result.map (Stdlib.Result.Result.Error "test") (fun x -> - Stdlib.Int64.divide_v0 x 2L) = Stdlib.Result.Result.Error "test" + (Stdlib.Option.Option.Some(Stdlib.Result.Result.Error("test"))) + "test" +== Stdlib.Result.Result.Ok(Stdlib.Result.Result.Error("test")) + +Stdlib.Result.fromOption Stdlib.Option.Option.None() (1L, 2L, 3L) +== Stdlib.Result.Result.Error((1L, 2L, 3L)) + +Stdlib.Result.fromOption Stdlib.Option.Option.None() Stdlib.Option.Option.None() +== Stdlib.Result.Result.Error(Stdlib.Option.Option.None()) + + + +Stdlib.Result.map2 + (Stdlib.Result.Result.Error("error1")) + (Stdlib.Result.Result.Error("error2")) + (fun a b -> a - b) +== Stdlib.Result.Result.Error("error1") + +Stdlib.Result.map2 + (Stdlib.Result.Result.Error("error1")) + (Stdlib.Result.Result.Ok(1L)) + (fun a b -> a - b) +== Stdlib.Result.Result.Error("error1") + +Stdlib.Result.map2 + (Stdlib.Result.Result.Ok(10L)) + (Stdlib.Result.Result.Error("error2")) + (fun a b -> a - b) +== Stdlib.Result.Result.Error("error2") + +Stdlib.Result.map2 + (Stdlib.Result.Result.Ok(10L)) + (Stdlib.Result.Result.Ok(1L)) + (fun a b -> a - b) +== Stdlib.Result.Result.Ok(9L) + + + +Stdlib.Result.map3 + (Stdlib.Result.Result.Error("error1")) + (Stdlib.Result.Result.Error("error2")) + (Stdlib.Result.Result.Error("error3")) + (fun a b c -> a - b - c) +== Stdlib.Result.Result.Error("error1") + +Stdlib.Result.map3 + (Stdlib.Result.Result.Error("error1")) + (Stdlib.Result.Result.Error("error2")) + (Stdlib.Result.Result.Ok(1L)) + (fun a b c -> a - b - c) +== Stdlib.Result.Result.Error("error1") + +Stdlib.Result.map3 + (Stdlib.Result.Result.Ok(10L)) + (Stdlib.Result.Result.Error("error2")) + (Stdlib.Result.Result.Error("error3")) + (fun a b c -> a - b - c) +== Stdlib.Result.Result.Error("error2") + +Stdlib.Result.map3 + (Stdlib.Result.Result.Ok(10L)) + (Stdlib.Result.Result.Ok(1L)) + (Stdlib.Result.Result.Error("error3")) + (fun a b c -> a - b - c) +== Stdlib.Result.Result.Error("error3") + +Stdlib.Result.map3 + (Stdlib.Result.Result.Ok(10L)) + (Stdlib.Result.Result.Ok(1L)) + (Stdlib.Result.Result.Ok(1L)) + (fun a b c -> a - b - c) +== Stdlib.Result.Result.Ok(8L) + + +Stdlib.Result.map4 + (Stdlib.Result.Result.Error("error1")) + (Stdlib.Result.Result.Error("error2")) + (Stdlib.Result.Result.Error("error3")) + (Stdlib.Result.Result.Error("error4")) + (fun a b c d -> a - b - c - d) +== Stdlib.Result.Result.Error("error1") + +Stdlib.Result.map4 + (Stdlib.Result.Result.Error("error1")) + (Stdlib.Result.Result.Error("error2")) + (Stdlib.Result.Result.Error("error3")) + (Stdlib.Result.Result.Ok(1L)) + (fun a b c d -> a - b - c - d) +== Stdlib.Result.Result.Error("error1") + +Stdlib.Result.map4 + (Stdlib.Result.Result.Ok(10L)) + (Stdlib.Result.Result.Ok(1L)) + (Stdlib.Result.Result.Ok(1L)) + (Stdlib.Result.Result.Error("error4")) + (fun a b c d -> a - b - c - d) +== Stdlib.Result.Result.Error("error4") + +Stdlib.Result.map4 + (Stdlib.Result.Result.Ok(10L)) + (Stdlib.Result.Result.Ok(1L)) + (Stdlib.Result.Result.Ok(1L)) + (Stdlib.Result.Result.Ok(2L)) + (fun a b c d -> a - b - c - d) +== Stdlib.Result.Result.Ok(6L) + + +Stdlib.Result.map5 + (Stdlib.Result.Result.Error("error1")) + (Stdlib.Result.Result.Error("error2")) + (Stdlib.Result.Result.Error("error3")) + (Stdlib.Result.Result.Error("error4")) + (Stdlib.Result.Result.Error("error5")) + (fun a b c d e -> a - b - c - d - e) +== Stdlib.Result.Result.Error("error1") + +Stdlib.Result.map5 + (Stdlib.Result.Result.Error("error1")) + (Stdlib.Result.Result.Error("error2")) + (Stdlib.Result.Result.Error("error3")) + (Stdlib.Result.Result.Error("error4")) + (Stdlib.Result.Result.Ok(1L)) + (fun a b c d e -> a - b - c - d - e) +== Stdlib.Result.Result.Error("error1") + +Stdlib.Result.map5 + (Stdlib.Result.Result.Ok(10L)) + (Stdlib.Result.Result.Ok(1L)) + (Stdlib.Result.Result.Ok(1L)) + (Stdlib.Result.Result.Ok(2L)) + (Stdlib.Result.Result.Error("error5")) + (fun a b c d e -> a - b - c - d - e) +== Stdlib.Result.Result.Error("error5") + +Stdlib.Result.map5 + (Stdlib.Result.Result.Ok(10L)) + (Stdlib.Result.Result.Ok(1L)) + (Stdlib.Result.Result.Ok(1L)) + (Stdlib.Result.Result.Ok(2L)) + (Stdlib.Result.Result.Ok(3L)) + (fun a b c d e -> a - b - c - d - e) +== Stdlib.Result.Result.Ok(3L) + +Stdlib.Result.mapWithDefault (Stdlib.Result.Result.Error("test")) 5L (fun x -> + x + 1L) +== 5L + +Stdlib.Result.mapWithDefault (Stdlib.Result.Result.Ok(6L)) 5L (fun x -> x + 1L) +== 7L -Stdlib.Result.map (Stdlib.Result.Result.Ok 4L) (fun x -> Stdlib.Int64.divide_v0 x 2L) = Stdlib.Result.Result.Ok - 2L +Stdlib.Result.mapWithDefault + (Stdlib.Result.Result.Error("test1")) + (Stdlib.Result.Result.Error("test2")) + (fun x -> x + 1L) +== Stdlib.Result.Result.Error("test2") +Stdlib.Result.mapError (Stdlib.Result.Result.Error("test")) (fun x -> + Stdlib.String.append x "-appended") +== Stdlib.Result.Result.Error("test-appended") + +Stdlib.Result.mapError (Stdlib.Result.Result.Ok(4L)) (fun x -> + Stdlib.Int64.divide x 2L) +== Stdlib.Result.Result.Ok(4L) +Stdlib.Result.map (Stdlib.Result.Result.Error("test")) (fun x -> + Stdlib.Int64.divide x 2L) +== Stdlib.Result.Result.Error("test") -Stdlib.Result.toOption (Stdlib.Result.Result.Ok "test") = Stdlib.Option.Option.Some - "test" +Stdlib.Result.map (Stdlib.Result.Result.Ok(4L)) (fun x -> Stdlib.Int64.divide x 2L) +== Stdlib.Result.Result.Ok(2L) -Stdlib.Result.toOption (Stdlib.Result.Result.Error "test") = Stdlib.Option.Option.None +Stdlib.Result.toOption (Stdlib.Result.Result.Ok("test")) +== Stdlib.Option.Option.Some("test") -Stdlib.Result.withDefault_v0 (Stdlib.Result.Result.Error "test") 5L = 5L +Stdlib.Result.toOption (Stdlib.Result.Result.Error("test")) +== Stdlib.Option.Option.None() -Stdlib.Result.withDefault_v0 (Stdlib.Result.Result.Ok 6L) 5L = 6L +Stdlib.Result.withDefault (Stdlib.Result.Result.Error("test")) 5L == 5L -Stdlib.Result.isOk_v0 (Stdlib.Result.Result.Ok "test") = true +Stdlib.Result.withDefault (Stdlib.Result.Result.Ok(6L)) 5L == 6L -Stdlib.Result.isOk_v0 (Stdlib.Result.Result.Error "test") = false +Stdlib.Result.isOk (Stdlib.Result.Result.Ok("test")) == true +Stdlib.Result.isOk (Stdlib.Result.Result.Error("test")) == false -Stdlib.Result.isError_v0 (Stdlib.Result.Result.Ok "test") = false +Stdlib.Result.isError (Stdlib.Result.Result.Ok("test")) == false -Stdlib.Result.isError_v0 (Stdlib.Result.Result.Error "test") = true +Stdlib.Result.isError (Stdlib.Result.Result.Error("test")) == true +(Stdlib.Result.and + (Stdlib.Result.Result.Ok("test1")) + (Stdlib.Result.Result.Ok("test2")) +) == Stdlib.Result.Result.Ok("test2") -Stdlib.Result.and_v0 - (Stdlib.Result.Result.Ok "test1") - (Stdlib.Result.Result.Ok "test2") = Stdlib.Result.Result.Ok "test2" +(Stdlib.Result.and + (Stdlib.Result.Result.Ok("test1")) + (Stdlib.Result.Result.Error("test2")) +) == Stdlib.Result.Result.Error("test2") -Stdlib.Result.and_v0 - (Stdlib.Result.Result.Ok "test1") - (Stdlib.Result.Result.Error "test2") = Stdlib.Result.Result.Error "test2" +(Stdlib.Result.and + (Stdlib.Result.Result.Error("test1")) + (Stdlib.Result.Result.Ok("test2")) +) == Stdlib.Result.Result.Error("test1") -Stdlib.Result.and_v0 - (Stdlib.Result.Result.Error "test1") - (Stdlib.Result.Result.Ok "test2") = Stdlib.Result.Result.Error "test1" +(Stdlib.Result.and + (Stdlib.Result.Result.Error("test1")) + (Stdlib.Result.Result.Error("test2")) +) == Stdlib.Result.Result.Error("test1") -Stdlib.Result.and_v0 - (Stdlib.Result.Result.Error "test1") - (Stdlib.Result.Result.Error "test2") = Stdlib.Result.Result.Error "test1" +(Stdlib.Result.or + (Stdlib.Result.Result.Ok("test1")) + (Stdlib.Result.Result.Ok("test2")) +) == Stdlib.Result.Result.Ok("test1") -Stdlib.Result.or_v0 - (Stdlib.Result.Result.Ok "test1") - (Stdlib.Result.Result.Ok "test2") = Stdlib.Result.Result.Ok "test1" +(Stdlib.Result.or + (Stdlib.Result.Result.Ok("test1")) + (Stdlib.Result.Result.Error("test2")) +) == Stdlib.Result.Result.Ok("test1") -Stdlib.Result.or_v0 - (Stdlib.Result.Result.Ok "test1") - (Stdlib.Result.Result.Error "test2") = Stdlib.Result.Result.Ok "test1" +(Stdlib.Result.or + (Stdlib.Result.Result.Error("test1")) + (Stdlib.Result.Result.Ok("test2")) +) == Stdlib.Result.Result.Ok("test2") -Stdlib.Result.or_v0 - (Stdlib.Result.Result.Error "test1") - (Stdlib.Result.Result.Ok "test2") = Stdlib.Result.Result.Ok "test2" +(Stdlib.Result.or + (Stdlib.Result.Result.Error("test1")) + (Stdlib.Result.Result.Error("test2")) +) == Stdlib.Result.Result.Error("test2") -Stdlib.Result.or_v0 - (Stdlib.Result.Result.Error "test1") - (Stdlib.Result.Result.Error "test2") = Stdlib.Result.Result.Error "test2" +Stdlib.Result.toList (Stdlib.Result.Result.Ok("test")) == [ "test" ] -Stdlib.Result.toList_v0 (Stdlib.Result.Result.Ok "test") = [ "test" ] +Stdlib.Result.toList (Stdlib.Result.Result.Error("test")) == [] -Stdlib.Result.toList_v0 (Stdlib.Result.Result.Error "test") = [] +Stdlib.Result.join (Stdlib.Result.Result.Ok(Stdlib.Result.Result.Ok("test"))) +== Stdlib.Result.Result.Ok("test") -Stdlib.Result.join_v0 (Stdlib.Result.Result.Ok(Stdlib.Result.Result.Ok "test")) = Stdlib.Result.Result.Ok - "test" +Stdlib.Result.join (Stdlib.Result.Result.Ok(Stdlib.Result.Result.Error("test"))) +== Stdlib.Result.Result.Error("test") -Stdlib.Result.join_v0 (Stdlib.Result.Result.Ok(Stdlib.Result.Result.Error "test")) = Stdlib.Result.Result.Error - "test" - -Stdlib.Result.join_v0 (Stdlib.Result.Result.Error "test") = Stdlib.Result.Result.Error - "test" +Stdlib.Result.join (Stdlib.Result.Result.Error("test")) +== Stdlib.Result.Result.Error("test") -Stdlib.Result.combine_v0 - [ Stdlib.Result.Result.Ok 1L - Stdlib.Result.Result.Ok 2L - Stdlib.Result.Result.Ok 3L ] = Stdlib.Result.Result.Ok [ 1L; 2L; 3L ] +Stdlib.Result.combine + [ Stdlib.Result.Result.Ok(1L) + Stdlib.Result.Result.Ok(2L) + Stdlib.Result.Result.Ok(3L) ] +== Stdlib.Result.Result.Ok([ 1L; 2L; 3L ]) -Stdlib.Result.combine_v0 - [ Stdlib.Result.Result.Ok 1L - Stdlib.Result.Result.Error "test" - Stdlib.Result.Result.Ok 3L ] = Stdlib.Result.Result.Error "test" +Stdlib.Result.combine + [ Stdlib.Result.Result.Ok(1L) + Stdlib.Result.Result.Error("test") + Stdlib.Result.Result.Ok(3L) ] +== Stdlib.Result.Result.Error("test") -Stdlib.Result.combine_v0 - [ Stdlib.Result.Result.Error "test1"; Stdlib.Result.Result.Error "test2" ] = Stdlib.Result.Result.Error - "test1" +Stdlib.Result.combine + [ Stdlib.Result.Result.Error("test1"); Stdlib.Result.Result.Error("test2") ] +== Stdlib.Result.Result.Error("test1") -Stdlib.Result.combine_v0 [] = Stdlib.Result.Result.Ok [] +Stdlib.Result.combine [] == Stdlib.Result.Result.Ok([]) -Stdlib.Result.values_v0 - [ Stdlib.Result.Result.Ok 1L - Stdlib.Result.Result.Ok 2L - Stdlib.Result.Result.Ok 3L ] = Stdlib.Result.Result.Ok [ 1L; 2L; 3L ] +Stdlib.Result.values + [ Stdlib.Result.Result.Ok(1L) + Stdlib.Result.Result.Ok(2L) + Stdlib.Result.Result.Ok(3L) ] +== Stdlib.Result.Result.Ok([ 1L; 2L; 3L ]) -Stdlib.Result.values_v0 - [ Stdlib.Result.Result.Ok 1L - Stdlib.Result.Result.Error "test" - Stdlib.Result.Result.Ok 3L ] = Stdlib.Result.Result.Ok [ 1L; 3L ] +Stdlib.Result.values + [ Stdlib.Result.Result.Ok(1L) + Stdlib.Result.Result.Error("test") + Stdlib.Result.Result.Ok(3L) ] +== Stdlib.Result.Result.Ok([ 1L; 3L ]) -Stdlib.Result.values_v0 - [ Stdlib.Result.Result.Error "test1"; Stdlib.Result.Result.Error "test2" ] = Stdlib.Result.Result.Ok - [] +Stdlib.Result.values + [ Stdlib.Result.Result.Error("test1"); Stdlib.Result.Result.Error("test2") ] +== Stdlib.Result.Result.Ok([]) -Stdlib.Result.values_v0 [] = Stdlib.Result.Result.Ok [] \ No newline at end of file +Stdlib.Result.values [] == Stdlib.Result.Result.Ok([]) \ No newline at end of file diff --git a/backend/testfiles/execution/stdlib/semanticTokenization.dark b/backend/testfiles/execution/stdlib/semanticTokenization.dark index be52b5840f..f960a05ebf 100644 --- a/backend/testfiles/execution/stdlib/semanticTokenization.dark +++ b/backend/testfiles/execution/stdlib/semanticTokenization.dark @@ -1,12 +1,7 @@ // TODO: Add additional tests to cover all cases type TokenType = PACKAGE.Darklang.LanguageTools.SemanticTokens.TokenType -let tokenize - (text: String) - : List<(PACKAGE.Darklang.LanguageTools.SemanticTokens.TokenType * - (Int64 * Int64) * - (Int64 * Int64))> - = +let tokenize (text: String) : List<(TokenType * (Int64 * Int64) * (Int64 * Int64))> = text |> PACKAGE.Darklang.LanguageTools.Parser.parseToSimplifiedTree |> PACKAGE.Darklang.LanguageTools.Parser.parseFromTree @@ -19,586 +14,646 @@ let tokenize module TokenizeTypeReference = - ("type MyUnit = Unit" |> tokenize) = [ (TokenType.Keyword, (0L, 0L), (0L, 4L)) - (TokenType.TypeName, (0L, 5L), (0L, 11L)) - (TokenType.Symbol, (0L, 12L), (0L, 13L)) - (TokenType.TypeName, (0L, 14L), (0L, 18L)) ] - - ("type MyBool = Bool" |> tokenize) = [ (TokenType.Keyword, (0L, 0L), (0L, 4L)) - (TokenType.TypeName, (0L, 5L), (0L, 11L)) - (TokenType.Symbol, (0L, 12L), (0L, 13L)) - (TokenType.TypeName, (0L, 14L), (0L, 18L)) ] - - ("type MyInt8 = Int8" |> tokenize) = [ (TokenType.Keyword, (0L, 0L), (0L, 4L)) - (TokenType.TypeName, (0L, 5L), (0L, 11L)) - (TokenType.Symbol, (0L, 12L), (0L, 13L)) - (TokenType.TypeName, (0L, 14L), (0L, 18L)) ] - - ("type MyUInt8 = UInt8" |> tokenize) = [ (TokenType.Keyword, (0L, 0L), (0L, 4L)) - (TokenType.TypeName, (0L, 5L), (0L, 12L)) - (TokenType.Symbol, (0L, 13L), (0L, 14L)) - (TokenType.TypeName, (0L, 15L), (0L, 20L)) ] - - ("type MyInt16 = Int16" |> tokenize) = [ (TokenType.Keyword, (0L, 0L), (0L, 4L)) - (TokenType.TypeName, (0L, 5L), (0L, 12L)) - (TokenType.Symbol, (0L, 13L), (0L, 14L)) - (TokenType.TypeName, (0L, 15L), (0L, 20L)) ] - - ("type MyUInt16 = UInt16" |> tokenize) = [ (TokenType.Keyword, (0L, 0L), (0L, 4L)) - (TokenType.TypeName, (0L, 5L), (0L, 13L)) - (TokenType.Symbol, (0L, 14L), (0L, 15L)) - (TokenType.TypeName, - (0L, 16L), - (0L, 22L)) ] - - ("type MyInt32 = Int32" |> tokenize) = [ (TokenType.Keyword, (0L, 0L), (0L, 4L)) - (TokenType.TypeName, (0L, 5L), (0L, 12L)) - (TokenType.Symbol, (0L, 13L), (0L, 14L)) - (TokenType.TypeName, (0L, 15L), (0L, 20L)) ] - - ("type MyUInt32 = UInt32" |> tokenize) = [ (TokenType.Keyword, (0L, 0L), (0L, 4L)) - (TokenType.TypeName, (0L, 5L), (0L, 13L)) - (TokenType.Symbol, (0L, 14L), (0L, 15L)) - (TokenType.TypeName, - (0L, 16L), - (0L, 22L)) ] - - ("type MyInt64 = Int64" |> tokenize) = [ (TokenType.Keyword, (0L, 0L), (0L, 4L)) - (TokenType.TypeName, (0L, 5L), (0L, 12L)) - (TokenType.Symbol, (0L, 13L), (0L, 14L)) - (TokenType.TypeName, (0L, 15L), (0L, 20L)) ] - - ("type MyUInt64 = UInt64" |> tokenize) = [ (TokenType.Keyword, (0L, 0L), (0L, 4L)) - (TokenType.TypeName, (0L, 5L), (0L, 13L)) - (TokenType.Symbol, (0L, 14L), (0L, 15L)) - (TokenType.TypeName, - (0L, 16L), - (0L, 22L)) ] - - ("type MyInt128 = Int128" |> tokenize) = [ (TokenType.Keyword, (0L, 0L), (0L, 4L)) - (TokenType.TypeName, (0L, 5L), (0L, 13L)) - (TokenType.Symbol, (0L, 14L), (0L, 15L)) - (TokenType.TypeName, - (0L, 16L), - (0L, 22L)) ] - - ("type MyUInt128 = UInt128" |> tokenize) = [ (TokenType.Keyword, (0L, 0L), (0L, 4L)) - (TokenType.TypeName, + ("type MyUnit = Unit" |> tokenize) == [ (TokenType.Keyword(), (0L, 0L), (0L, 4L)) + (TokenType.TypeName(), (0L, 5L), (0L, 11L)) + (TokenType.Symbol(), (0L, 12L), (0L, 13L)) + (TokenType.TypeName(), (0L, 14L), (0L, 18L)) ] + + ("type MyBool = Bool" |> tokenize) == [ (TokenType.Keyword(), (0L, 0L), (0L, 4L)) + (TokenType.TypeName(), (0L, 5L), (0L, 11L)) + (TokenType.Symbol(), (0L, 12L), (0L, 13L)) + (TokenType.TypeName(), (0L, 14L), (0L, 18L)) ] + + ("type MyInt8 = Int8" |> tokenize) == [ (TokenType.Keyword(), (0L, 0L), (0L, 4L)) + (TokenType.TypeName(), (0L, 5L), (0L, 11L)) + (TokenType.Symbol(), (0L, 12L), (0L, 13L)) + (TokenType.TypeName(), (0L, 14L), (0L, 18L)) ] + + ("type MyUInt8 = UInt8" |> tokenize) == [ (TokenType.Keyword(), (0L, 0L), (0L, 4L)) + (TokenType.TypeName(), (0L, 5L), (0L, 12L)) + (TokenType.Symbol(), (0L, 13L), (0L, 14L)) + (TokenType.TypeName(), + (0L, 15L), + (0L, 20L)) ] + + ("type MyInt16 = Int16" |> tokenize) == [ (TokenType.Keyword(), (0L, 0L), (0L, 4L)) + (TokenType.TypeName(), (0L, 5L), (0L, 12L)) + (TokenType.Symbol(), (0L, 13L), (0L, 14L)) + (TokenType.TypeName(), + (0L, 15L), + (0L, 20L)) ] + + ("type MyUInt16 = UInt16" |> tokenize) == [ (TokenType.Keyword(), (0L, 0L), (0L, 4L)) + (TokenType.TypeName(), (0L, 5L), - (0L, 14L)) - (TokenType.Symbol, - (0L, 15L), - (0L, 16L)) - (TokenType.TypeName, - (0L, 17L), - (0L, 24L)) ] + (0L, 13L)) + (TokenType.Symbol(), + (0L, 14L), + (0L, 15L)) + (TokenType.TypeName(), + (0L, 16L), + (0L, 22L)) ] + + ("type MyInt32 = Int32" |> tokenize) == [ (TokenType.Keyword(), (0L, 0L), (0L, 4L)) + (TokenType.TypeName(), (0L, 5L), (0L, 12L)) + (TokenType.Symbol(), (0L, 13L), (0L, 14L)) + (TokenType.TypeName(), + (0L, 15L), + (0L, 20L)) ] + + ("type MyUInt32 = UInt32" |> tokenize) == [ (TokenType.Keyword(), (0L, 0L), (0L, 4L)) + (TokenType.TypeName(), + (0L, 5L), + (0L, 13L)) + (TokenType.Symbol(), + (0L, 14L), + (0L, 15L)) + (TokenType.TypeName(), + (0L, 16L), + (0L, 22L)) ] + + ("type MyInt64 = Int64" |> tokenize) == [ (TokenType.Keyword(), (0L, 0L), (0L, 4L)) + (TokenType.TypeName(), (0L, 5L), (0L, 12L)) + (TokenType.Symbol(), (0L, 13L), (0L, 14L)) + (TokenType.TypeName(), + (0L, 15L), + (0L, 20L)) ] + + ("type MyUInt64 = UInt64" |> tokenize) == [ (TokenType.Keyword(), (0L, 0L), (0L, 4L)) + (TokenType.TypeName(), + (0L, 5L), + (0L, 13L)) + (TokenType.Symbol(), + (0L, 14L), + (0L, 15L)) + (TokenType.TypeName(), + (0L, 16L), + (0L, 22L)) ] + - ("type MyFloat = Float" |> tokenize) = [ (TokenType.Keyword, (0L, 0L), (0L, 4L)) - (TokenType.TypeName, (0L, 5L), (0L, 12L)) - (TokenType.Symbol, (0L, 13L), (0L, 14L)) - (TokenType.TypeName, (0L, 15L), (0L, 20L)) ] - - ("type MyChar = Char" |> tokenize) = [ (TokenType.Keyword, (0L, 0L), (0L, 4L)) - (TokenType.TypeName, (0L, 5L), (0L, 11L)) - (TokenType.Symbol, (0L, 12L), (0L, 13L)) - (TokenType.TypeName, (0L, 14L), (0L, 18L)) ] - - ("type MyString = String" |> tokenize) = [ (TokenType.Keyword, (0L, 0L), (0L, 4L)) - (TokenType.TypeName, (0L, 5L), (0L, 13L)) - (TokenType.Symbol, (0L, 14L), (0L, 15L)) - (TokenType.TypeName, - (0L, 16L), - (0L, 22L)) ] - - ("type MyUUID = UUID" |> tokenize) = [ (TokenType.Keyword, (0L, 0L), (0L, 4L)) - (TokenType.TypeName, (0L, 5L), (0L, 11L)) - (TokenType.Symbol, (0L, 12L), (0L, 13L)) - (TokenType.TypeName, (0L, 14L), (0L, 18L)) ] - - ("type MyDateTime = DateTime" |> tokenize) = [ (TokenType.Keyword, + + ("type MyInt128 = Int128" |> tokenize) == [ (TokenType.Keyword(), (0L, 0L), (0L, 4L)) + (TokenType.TypeName(), + (0L, 5L), + (0L, 13L)) + (TokenType.Symbol(), + (0L, 14L), + (0L, 15L)) + (TokenType.TypeName(), + (0L, 16L), + (0L, 22L)) ] + + ("type MyUInt128 = UInt128" |> tokenize) == [ (TokenType.Keyword(), (0L, 0L), (0L, 4L)) - (TokenType.TypeName, + (TokenType.TypeName(), (0L, 5L), - (0L, 15L)) - (TokenType.Symbol, - (0L, 16L), - (0L, 17L)) - (TokenType.TypeName, - (0L, 18L), - (0L, 26L)) ] + (0L, 14L)) + (TokenType.Symbol(), + (0L, 15L), + (0L, 16L)) + (TokenType.TypeName(), + (0L, 17L), + (0L, 24L)) ] + + ("type MyFloat = Float" |> tokenize) == [ (TokenType.Keyword(), (0L, 0L), (0L, 4L)) + (TokenType.TypeName(), (0L, 5L), (0L, 12L)) + (TokenType.Symbol(), (0L, 13L), (0L, 14L)) + (TokenType.TypeName(), + (0L, 15L), + (0L, 20L)) ] + + ("type MyChar = Char" |> tokenize) == [ (TokenType.Keyword(), (0L, 0L), (0L, 4L)) + (TokenType.TypeName(), (0L, 5L), (0L, 11L)) + (TokenType.Symbol(), (0L, 12L), (0L, 13L)) + (TokenType.TypeName(), (0L, 14L), (0L, 18L)) ] + + ("type MyString = String" |> tokenize) == [ (TokenType.Keyword(), (0L, 0L), (0L, 4L)) + (TokenType.TypeName(), + (0L, 5L), + (0L, 13L)) + (TokenType.Symbol(), + (0L, 14L), + (0L, 15L)) + (TokenType.TypeName(), + (0L, 16L), + (0L, 22L)) ] + + ("type MyUUID = UUID" |> tokenize) == [ (TokenType.Keyword(), (0L, 0L), (0L, 4L)) + (TokenType.TypeName(), (0L, 5L), (0L, 11L)) + (TokenType.Symbol(), (0L, 12L), (0L, 13L)) + (TokenType.TypeName(), (0L, 14L), (0L, 18L)) ] + + ("type MyDateTime = DateTime" |> tokenize) == [ (TokenType.Keyword(), + (0L, 0L), + (0L, 4L)) + (TokenType.TypeName(), + (0L, 5L), + (0L, 15L)) + (TokenType.Symbol(), + (0L, 16L), + (0L, 17L)) + (TokenType.TypeName(), + (0L, 18L), + (0L, 26L)) ] - ("type MyList = List" |> tokenize) = [ (TokenType.Keyword, + ("type MyList = List" |> tokenize) == [ (TokenType.Keyword(), + (0L, 0L), + (0L, 4L)) + (TokenType.TypeName(), + (0L, 5L), + (0L, 11L)) + (TokenType.Symbol(), + (0L, 12L), + (0L, 13L)) + (TokenType.Keyword(), + (0L, 14L), + (0L, 18L)) + (TokenType.Symbol(), + (0L, 18L), + (0L, 19L)) + (TokenType.TypeName(), + (0L, 19L), + (0L, 25L)) + (TokenType.Symbol(), + (0L, 25L), + (0L, 26L)) ] + + ("type MyDict = Dict" |> tokenize) == [ (TokenType.Keyword(), (0L, 0L), (0L, 4L)) - (TokenType.TypeName, + (TokenType.TypeName(), (0L, 5L), (0L, 11L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 12L), (0L, 13L)) - (TokenType.Keyword, + (TokenType.Keyword(), (0L, 14L), (0L, 18L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 18L), (0L, 19L)) - (TokenType.TypeName, + (TokenType.TypeName(), (0L, 19L), - (0L, 25L)) - (TokenType.Symbol, - (0L, 25L), - (0L, 26L)) ] + (0L, 24L)) + (TokenType.Symbol(), + (0L, 24L), + (0L, 25L)) ] - ("type MyDict = Dict" |> tokenize) = [ (TokenType.Keyword, - (0L, 0L), - (0L, 4L)) - (TokenType.TypeName, - (0L, 5L), - (0L, 11L)) - (TokenType.Symbol, - (0L, 12L), - (0L, 13L)) - (TokenType.Keyword, - (0L, 14L), - (0L, 18L)) - (TokenType.Symbol, - (0L, 18L), - (0L, 19L)) - (TokenType.TypeName, - (0L, 19L), - (0L, 24L)) - (TokenType.Symbol, - (0L, 24L), - (0L, 25L)) ] + ("type MyTuple2 = (String * Int64)" |> tokenize) == [ (TokenType.Keyword(), + (0L, 0L), + (0L, 4L)) + (TokenType.TypeName(), + (0L, 5L), + (0L, 13L)) + (TokenType.Symbol(), + (0L, 14L), + (0L, 15L)) + (TokenType.Symbol(), + (0L, 16L), + (0L, 17L)) + (TokenType.TypeName(), + (0L, 17L), + (0L, 23L)) + (TokenType.Symbol(), + (0L, 24L), + (0L, 25L)) + (TokenType.TypeName(), + (0L, 26L), + (0L, 31L)) + (TokenType.Symbol(), + (0L, 31L), + (0L, 32L)) ] - ("type MyTuple2 = (String * Int64)" |> tokenize) = [ (TokenType.Keyword, - (0L, 0L), - (0L, 4L)) - (TokenType.TypeName, - (0L, 5L), - (0L, 13L)) - (TokenType.Symbol, - (0L, 14L), - (0L, 15L)) - (TokenType.Symbol, - (0L, 16L), - (0L, 17L)) - (TokenType.TypeName, - (0L, 17L), - (0L, 23L)) - (TokenType.Symbol, - (0L, 24L), - (0L, 25L)) - (TokenType.TypeName, - (0L, 26L), - (0L, 31L)) - (TokenType.Symbol, - (0L, 31L), - (0L, 32L)) ] - - ("type MyTuple3 = (String * Int64 * Bool)" |> tokenize) = [ (TokenType.Keyword, - (0L, 0L), - (0L, 4L)) - (TokenType.TypeName, + ("type MyTuple3 = (String * Int64 * Bool)" |> tokenize) == [(TokenType.Keyword(), + (0L, 0L), + (0L, 4L)) + (TokenType.TypeName(), (0L, 5L), (0L, 13L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 14L), (0L, 15L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 16L), (0L, 17L)) - (TokenType.TypeName, + (TokenType.TypeName(), (0L, 17L), (0L, 23L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 24L), (0L, 25L)) - (TokenType.TypeName, + (TokenType.TypeName(), (0L, 26L), (0L, 31L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 32L), (0L, 33L)) - (TokenType.TypeName, + (TokenType.TypeName(), (0L, 34L), (0L, 38L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 38L), (0L, 39L)) ] - ("type MyFn = 'a -> String" |> tokenize) = [ (TokenType.Keyword, (0L, 0L), (0L, 4L)) - (TokenType.TypeName, - (0L, 5L), - (0L, 9L)) - (TokenType.Symbol, - (0L, 10L), - (0L, 11L)) - (TokenType.Symbol, - (0L, 12L), - (0L, 13L)) - (TokenType.TypeName, - (0L, 13L), - (0L, 14L)) - (TokenType.Symbol, - (0L, 15L), - (0L, 17L)) - (TokenType.TypeName, - (0L, 18L), - (0L, 24L)) ] - - ("type MyDB = DB<'a>" |> tokenize) = [ (TokenType.Keyword, (0L, 0L), (0L, 4L)) - (TokenType.TypeName, (0L, 5L), (0L, 9L)) - (TokenType.Symbol, (0L, 10L), (0L, 11L)) - (TokenType.Keyword, (0L, 12L), (0L, 14L)) - (TokenType.Symbol, (0L, 14L), (0L, 15L)) - (TokenType.Symbol, (0L, 15L), (0L, 16L)) - (TokenType.TypeName, (0L, 16L), (0L, 17L)) - (TokenType.Symbol, (0L, 17L), (0L, 18L)) ] - - ("type MyVar = 'a" |> tokenize) = [ (TokenType.Keyword, (0L, 0L), (0L, 4L)) - (TokenType.TypeName, (0L, 5L), (0L, 10L)) - (TokenType.Symbol, (0L, 11L), (0L, 12L)) - (TokenType.Symbol, (0L, 13L), (0L, 14L)) - (TokenType.TypeName, (0L, 14L), (0L, 15L)) ] - - ("type MyFullyQualifiedTypeAlias = Stdlib.Option.Option" |> tokenize) = [ (TokenType.Keyword, - (0L, 0L), - (0L, 4L)) - (TokenType.TypeName, - (0L, 5L), - (0L, 30L)) - (TokenType.Symbol, - (0L, 31L), - (0L, 32L)) - (TokenType.ModuleName, - (0L, 33L), - (0L, 39L)) - (TokenType.ModuleName, - (0L, 40L), - (0L, 46L)) - (TokenType.TypeName, - (0L, 47L), - (0L, 53L)) ] - - -module TokenizeTypeDeclaration = - ("type MyAlias = Int64" |> tokenize) = [ (TokenType.Keyword, (0L, 0L), (0L, 4L)) - (TokenType.TypeName, (0L, 5L), (0L, 12L)) - (TokenType.Symbol, (0L, 13L), (0L, 14L)) - (TokenType.TypeName, (0L, 15L), (0L, 20L)) ] - - ("type MyType<'a> = List<'a>" |> tokenize) = [ (TokenType.Keyword, + ("type MyFn = 'a -> String" |> tokenize) == [ (TokenType.Keyword(), (0L, 0L), (0L, 4L)) - (TokenType.TypeName, + (TokenType.TypeName(), (0L, 5L), + (0L, 9L)) + (TokenType.Symbol(), + (0L, 10L), (0L, 11L)) - (TokenType.TypeParameter, + (TokenType.Symbol(), (0L, 12L), + (0L, 13L)) + (TokenType.TypeName(), + (0L, 13L), (0L, 14L)) - (TokenType.Symbol, - (0L, 16L), + (TokenType.Symbol(), + (0L, 15L), (0L, 17L)) - (TokenType.Keyword, + (TokenType.TypeName(), (0L, 18L), - (0L, 22L)) - (TokenType.Symbol, - (0L, 22L), - (0L, 23L)) - (TokenType.Symbol, - (0L, 23L), - (0L, 24L)) - (TokenType.TypeName, - (0L, 24L), - (0L, 25L)) - (TokenType.Symbol, - (0L, 25L), - (0L, 26L)) ] + (0L, 24L)) ] + + ("type MyDB = DB<'a>" |> tokenize) == [ (TokenType.Keyword(), (0L, 0L), (0L, 4L)) + (TokenType.TypeName(), (0L, 5L), (0L, 9L)) + (TokenType.Symbol(), (0L, 10L), (0L, 11L)) + (TokenType.Keyword(), (0L, 12L), (0L, 14L)) + (TokenType.Symbol(), (0L, 14L), (0L, 15L)) + (TokenType.Symbol(), (0L, 15L), (0L, 16L)) + (TokenType.TypeName(), (0L, 16L), (0L, 17L)) + (TokenType.Symbol(), (0L, 17L), (0L, 18L)) ] + + ("type MyVar = 'a" |> tokenize) == [ (TokenType.Keyword(), (0L, 0L), (0L, 4L)) + (TokenType.TypeName(), (0L, 5L), (0L, 10L)) + (TokenType.Symbol(), (0L, 11L), (0L, 12L)) + (TokenType.Symbol(), (0L, 13L), (0L, 14L)) + (TokenType.TypeName(), (0L, 14L), (0L, 15L)) ] + + ("type MyFullyQualifiedTypeAlias = Stdlib.Option.Option" |> tokenize) == [ (TokenType.Keyword(), + (0L, 0L), + (0L, 4L)) + (TokenType.TypeName(), + (0L, 5L), + (0L, 30L)) + (TokenType.Symbol(), + (0L, 31L), + (0L, 32L)) + (TokenType.ModuleName(), + (0L, 33L), + (0L, 39L)) + (TokenType.ModuleName(), + (0L, 40L), + (0L, 46L)) + (TokenType.TypeName(), + (0L, 47L), + (0L, 53L)) ] - ("type MyRecord = { x: Int64; y: String }" |> tokenize) = [ (TokenType.Keyword, - (0L, 0L), - (0L, 4L)) - (TokenType.TypeName, - (0L, 5L), - (0L, 13L)) - (TokenType.Symbol, - (0L, 14L), - (0L, 15L)) - (TokenType.Property, - (0L, 18L), - (0L, 19L)) - (TokenType.Symbol, - (0L, 19L), - (0L, 20L)) - (TokenType.TypeName, - (0L, 21L), - (0L, 26L)) - (TokenType.Symbol, - (0L, 26L), - (0L, 27L)) - (TokenType.Property, - (0L, 28L), - (0L, 29L)) - (TokenType.Symbol, - (0L, 29L), - (0L, 30L)) - (TokenType.TypeName, - (0L, 31L), - (0L, 37L)) ] - - - ("type MyEnum =\n | A of Int64\n | B of y: String" |> tokenize) = [ (TokenType.Keyword, +module TokenizeTypeDeclaration = + ("type MyAlias = Int64" |> tokenize) == [ (TokenType.Keyword(), (0L, 0L), (0L, 4L)) + (TokenType.TypeName(), (0L, 5L), (0L, 12L)) + (TokenType.Symbol(), (0L, 13L), (0L, 14L)) + (TokenType.TypeName(), + (0L, 15L), + (0L, 20L)) ] + + ("type MyType<'a> = List<'a>" |> tokenize) == [ (TokenType.Keyword(), + (0L, 0L), + (0L, 4L)) + (TokenType.TypeName(), + (0L, 5L), + (0L, 11L)) + (TokenType.TypeParameter(), + (0L, 12L), + (0L, 14L)) + (TokenType.Symbol(), + (0L, 16L), + (0L, 17L)) + (TokenType.Keyword(), + (0L, 18L), + (0L, 22L)) + (TokenType.Symbol(), + (0L, 22L), + (0L, 23L)) + (TokenType.Symbol(), + (0L, 23L), + (0L, 24L)) + (TokenType.TypeName(), + (0L, 24L), + (0L, 25L)) + (TokenType.Symbol(), + (0L, 25L), + (0L, 26L)) ] + + + ("type MyRecord = { x: Int64; y: String }" |> tokenize) == [ (TokenType.Keyword(), + (0L, 0L), + (0L, 4L)) + (TokenType.TypeName(), + (0L, 5L), + (0L, 13L)) + (TokenType.Symbol(), + (0L, 14L), + (0L, 15L)) + (TokenType.Property(), + (0L, 18L), + (0L, 19L)) + (TokenType.Symbol(), + (0L, 19L), + (0L, 20L)) + (TokenType.TypeName(), + (0L, 21L), + (0L, 26L)) + (TokenType.Symbol(), + (0L, 26L), + (0L, 27L)) + (TokenType.Property(), + (0L, 28L), + (0L, 29L)) + (TokenType.Symbol(), + (0L, 29L), + (0L, 30L)) + (TokenType.TypeName(), + (0L, 31L), + (0L, 37L)) ] + + + ("type MyEnum =\n | A of Int64\n | B of y: String" |> tokenize) == [ (TokenType.Keyword(), (0L, 0L), (0L, 4L)) - (TokenType.TypeName, + (TokenType.TypeName(), (0L, 5L), (0L, 11L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 12L), (0L, 13L)) - (TokenType.Symbol, + (TokenType.Symbol(), (1L, 2L), (1L, 3L)) - (TokenType.EnumMember, + (TokenType.EnumMember(), (1L, 4L), (1L, 5L)) - (TokenType.Keyword, + (TokenType.Keyword(), (1L, 6L), (1L, 8L)) - (TokenType.TypeName, + (TokenType.TypeName(), (1L, 9L), (1L, 14L)) - (TokenType.Symbol, + (TokenType.Symbol(), (2L, 2L), (2L, 3L)) - (TokenType.EnumMember, + (TokenType.EnumMember(), (2L, 4L), (2L, 5L)) - (TokenType.Keyword, + (TokenType.Keyword(), (2L, 6L), (2L, 8L)) - (TokenType.Property, + (TokenType.Property(), (2L, 9L), (2L, 10L)) - (TokenType.Symbol, + (TokenType.Symbol(), (2L, 10L), (2L, 11L)) - (TokenType.TypeName, + (TokenType.TypeName(), (2L, 12L), (2L, 18L)) ] module TokenizeFunctionDeclaration = - ("let myFn () : Int64 = 1L" |> tokenize) = [ (TokenType.Keyword, (0L, 0L), (0L, 3L)) - (TokenType.FunctionName, + ("let myFn () : Int64 = 1L" |> tokenize) == [ (TokenType.Keyword(), + (0L, 0L), + (0L, 3L)) + (TokenType.FunctionName(), (0L, 4L), (0L, 8L)) - (TokenType.Symbol, (0L, 9L), (0L, 11L)) - (TokenType.Symbol, + (TokenType.Symbol(), + (0L, 9L), + (0L, 11L)) + (TokenType.Symbol(), (0L, 12L), (0L, 13L)) - (TokenType.TypeName, + (TokenType.TypeName(), (0L, 14L), (0L, 19L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 20L), (0L, 21L)) - (TokenType.Number, + (TokenType.Number(), (0L, 22L), (0L, 23L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 23L), (0L, 24L)) ] - ("let myFn (a: Int64) : Int64 = a" |> tokenize) = [ (TokenType.Keyword, + ("let myFn (a: Int64) : Int64 = a" |> tokenize) == [ (TokenType.Keyword(), (0L, 0L), (0L, 3L)) - (TokenType.FunctionName, + (TokenType.FunctionName(), (0L, 4L), (0L, 8L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 9L), (0L, 10L)) - (TokenType.ParameterName, + (TokenType.ParameterName(), (0L, 10L), (0L, 11L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 11L), (0L, 12L)) - (TokenType.TypeName, + (TokenType.TypeName(), (0L, 13L), (0L, 18L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 18L), (0L, 19L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 20L), (0L, 21L)) - (TokenType.TypeName, + (TokenType.TypeName(), (0L, 22L), (0L, 27L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 28L), (0L, 29L)) - (TokenType.VariableName, + (TokenType.VariableName(), (0L, 30L), (0L, 31L)) ] - ("let add (a: Int64) (b: Int64) : Int64 = (a + b)" |> tokenize) = [ (TokenType.Keyword, + ("let add (a: Int64) (b: Int64) : Int64 = (a + b)" |> tokenize) == [ (TokenType + .Keyword(), (0L, 0L), (0L, 3L)) - (TokenType.FunctionName, + (TokenType + .FunctionName(), (0L, 4L), (0L, 7L)) - (TokenType.Symbol, + (TokenType + .Symbol(), (0L, 8L), (0L, 9L)) - (TokenType.ParameterName, + (TokenType + .ParameterName(), (0L, 9L), (0L, 10L)) - (TokenType.Symbol, + (TokenType + .Symbol(), (0L, 10L), (0L, 11L)) - (TokenType.TypeName, + (TokenType + .TypeName(), (0L, 12L), (0L, 17L)) - (TokenType.Symbol, + (TokenType + .Symbol(), (0L, 17L), (0L, 18L)) - (TokenType.Symbol, + (TokenType + .Symbol(), (0L, 19L), (0L, 20L)) - (TokenType.ParameterName, + (TokenType + .ParameterName(), (0L, 20L), (0L, 21L)) - (TokenType.Symbol, + (TokenType + .Symbol(), (0L, 21L), (0L, 22L)) - (TokenType.TypeName, + (TokenType + .TypeName(), (0L, 23L), (0L, 28L)) - (TokenType.Symbol, + (TokenType + .Symbol(), (0L, 28L), (0L, 29L)) - (TokenType.Symbol, + (TokenType + .Symbol(), (0L, 30L), (0L, 31L)) - (TokenType.TypeName, + (TokenType + .TypeName(), (0L, 32L), (0L, 37L)) - (TokenType.Symbol, + (TokenType + .Symbol(), (0L, 38L), (0L, 39L)) - (TokenType.VariableName, + (TokenType + .VariableName(), (0L, 41L), (0L, 42L)) - (TokenType.Operator, + (TokenType + .Operator(), (0L, 43L), (0L, 44L)) - (TokenType.VariableName, + (TokenType + .VariableName(), (0L, 45L), (0L, 46L)) ] - ("let myFn<'a, 'b> (paramOne: 'a) (paramTwo: 'b): Unit = ()" |> tokenize) = [ (TokenType.Keyword, + ("let myFn<'a, 'b> (paramOne: 'a) (paramTwo: 'b): Unit = ()" |> tokenize) == [ (TokenType.Keyword(), (0L, 0L), (0L, 3L)) - (TokenType.FunctionName, + (TokenType.FunctionName(), (0L, 4L), (0L, 8L)) - (TokenType.TypeParameter, + (TokenType.TypeParameter(), (0L, 9L), (0L, 11L)) - (TokenType.TypeParameter, + (TokenType.TypeParameter(), (0L, 13L), (0L, 15L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 17L), (0L, 18L)) - (TokenType.ParameterName, + (TokenType.ParameterName(), (0L, 18L), (0L, 26L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 26L), (0L, 27L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 28L), (0L, 29L)) - (TokenType.TypeName, + (TokenType.TypeName(), (0L, 29L), (0L, 30L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 30L), (0L, 31L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 32L), (0L, 33L)) - (TokenType.ParameterName, + (TokenType.ParameterName(), (0L, 33L), (0L, 41L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 41L), (0L, 42L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 43L), (0L, 44L)) - (TokenType.TypeName, + (TokenType.TypeName(), (0L, 44L), (0L, 45L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 45L), (0L, 46L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 46L), (0L, 47L)) - (TokenType.TypeName, + (TokenType.TypeName(), (0L, 48L), (0L, 52L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 53L), (0L, 54L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 55L), (0L, @@ -606,1019 +661,847 @@ module TokenizeFunctionDeclaration = module TokenizeConstantDeclaration = - ("const unitConst = ()" |> tokenize) = [ (TokenType.Keyword, (0L, 0L), (0L, 5L)) - (TokenType.VariableName, - (0L, 6L), - (0L, 15L)) - (TokenType.Symbol, (0L, 16L), (0L, 17L)) - (TokenType.Symbol, (0L, 18L), (0L, 20L)) ] - - ("const myIntConst = 1L" |> tokenize) = [ (TokenType.Keyword, (0L, 0L), (0L, 5L)) - (TokenType.VariableName, - (0L, 6L), - (0L, 16L)) - (TokenType.Symbol, (0L, 17L), (0L, 18L)) - (TokenType.Number, (0L, 19L), (0L, 20L)) - (TokenType.Symbol, (0L, 20L), (0L, 21L)) ] - - ("const boolConst = true" |> tokenize) = [ (TokenType.Keyword, (0L, 0L), (0L, 5L)) - (TokenType.VariableName, + ("const unitConst = ()" |> tokenize) == [ (TokenType.Keyword(), (0L, 0L), (0L, 5L)) + (TokenType.VariableName(), (0L, 6L), (0L, 15L)) - (TokenType.Symbol, (0L, 16L), (0L, 17L)) - (TokenType.Keyword, (0L, 18L), (0L, 22L)) ] + (TokenType.Symbol(), (0L, 16L), (0L, 17L)) + (TokenType.Symbol(), (0L, 18L), (0L, 20L)) ] - ("const stringConst = \"hello\"" |> tokenize) = [ (TokenType.Keyword, - (0L, 0L), - (0L, 5L)) - (TokenType.VariableName, - (0L, 6L), - (0L, 17L)) - (TokenType.Symbol, - (0L, 18L), - (0L, 19L)) - (TokenType.Symbol, - (0L, 20L), - (0L, 21L)) - (TokenType.String, - (0L, 21L), - (0L, 26L)) - (TokenType.Symbol, - (0L, 26L), - (0L, 27L)) ] - - ("const charConst = 'a'" |> tokenize) = [ (TokenType.Keyword, (0L, 0L), (0L, 5L)) - (TokenType.VariableName, - (0L, 6L), - (0L, 15L)) - (TokenType.Symbol, (0L, 16L), (0L, 17L)) - (TokenType.Symbol, (0L, 18L), (0L, 19L)) - (TokenType.String, (0L, 19L), (0L, 20L)) - (TokenType.Symbol, (0L, 20L), (0L, 21L)) ] - - ("const floatConst = 1.0" |> tokenize) = [ (TokenType.Keyword, (0L, 0L), (0L, 5L)) - (TokenType.VariableName, + ("const myIntConst = 1L" |> tokenize) == [ (TokenType.Keyword(), (0L, 0L), (0L, 5L)) + (TokenType.VariableName(), (0L, 6L), (0L, 16L)) - (TokenType.Symbol, (0L, 17L), (0L, 18L)) - (TokenType.Number, (0L, 19L), (0L, 22L)) ] + (TokenType.Symbol(), (0L, 17L), (0L, 18L)) + (TokenType.Number(), (0L, 19L), (0L, 20L)) + (TokenType.Symbol(), (0L, 20L), (0L, 21L)) ] + + ("const boolConst = true" |> tokenize) == [ (TokenType.Keyword(), (0L, 0L), (0L, 5L)) + (TokenType.VariableName(), + (0L, 6L), + (0L, 15L)) + (TokenType.Symbol(), + (0L, 16L), + (0L, 17L)) + (TokenType.Keyword(), + (0L, 18L), + (0L, 22L)) ] - ("const listConst = [1L; 2L; 3L]" |> tokenize) = [ (TokenType.Keyword, + ("const stringConst = \"hello\"" |> tokenize) == [ (TokenType.Keyword(), (0L, 0L), (0L, 5L)) - (TokenType.VariableName, + (TokenType.VariableName(), (0L, 6L), - (0L, 15L)) - (TokenType.Symbol, - (0L, 16L), (0L, 17L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 18L), (0L, 19L)) - (TokenType.Number, - (0L, 19L), - (0L, 20L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 20L), (0L, 21L)) - (TokenType.Number, - (0L, 23L), - (0L, 24L)) - (TokenType.Symbol, - (0L, 24L), - (0L, 25L)) - (TokenType.Number, - (0L, 27L), - (0L, 28L)) - (TokenType.Symbol, - (0L, 28L), - (0L, 29L)) - (TokenType.Symbol, - (0L, 29L), - (0L, 30L)) ] - - ("const tupleConst = (1L, 2L, 3L)" |> tokenize) = [ (TokenType.Keyword, - (0L, 0L), - (0L, 5L)) - (TokenType.VariableName, - (0L, 6L), - (0L, 16L)) - (TokenType.Symbol, - (0L, 17L), - (0L, 18L)) - (TokenType.Symbol, - (0L, 19L), - (0L, 20L)) - (TokenType.Number, - (0L, 20L), - (0L, 21L)) - (TokenType.Symbol, - (0L, 21L), - (0L, 22L)) - (TokenType.Symbol, - (0L, 22L), - (0L, 23L)) - (TokenType.Number, - (0L, 24L), - (0L, 25L)) - (TokenType.Symbol, - (0L, 25L), - (0L, 26L)) - (TokenType.Symbol, - (0L, 26L), - (0L, 27L)) - (TokenType.Number, - (0L, 28L), - (0L, 29L)) - (TokenType.Symbol, - (0L, 29L), - (0L, 30L)) - (TokenType.Symbol, - (0L, 30L), - (0L, 31L)) ] + (TokenType.String(), + (0L, 21L), + (0L, 26L)) + (TokenType.Symbol(), + (0L, 26L), + (0L, 27L)) ] + + ("const charConst = 'a'" |> tokenize) == [ (TokenType.Keyword(), (0L, 0L), (0L, 5L)) + (TokenType.VariableName(), (0L, 6L), (0L, 15L)) + (TokenType.Symbol(), (0L, 16L), (0L, 17L)) + (TokenType.Symbol(), (0L, 18L), (0L, 19L)) + (TokenType.String(), (0L, 19L), (0L, 20L)) + (TokenType.Symbol(), (0L, 20L), (0L, 21L)) ] + + ("const floatConst = 1.0" |> tokenize) == [ (TokenType.Keyword(), (0L, 0L), (0L, 5L)) + (TokenType.VariableName(), + (0L, 6L), + (0L, 16L)) + (TokenType.Symbol(), + (0L, 17L), + (0L, 18L)) + (TokenType.Number(), + (0L, 19L), + (0L, 22L)) ] - ("const dictConst = Dict { a = 1L; b = 2L }" |> tokenize) = [ (TokenType.Keyword, - (0L, 0L), - (0L, 5L)) - (TokenType.VariableName, - (0L, 6L), - (0L, 15L)) - (TokenType.Symbol, - (0L, 16L), - (0L, 17L)) - (TokenType.Keyword, - (0L, 18L), - (0L, 22L)) - (TokenType.Symbol, - (0L, 23L), - (0L, 24L)) - (TokenType.Property, - (0L, 25L), - (0L, 26L)) - (TokenType.Number, - (0L, 29L), - (0L, 30L)) - (TokenType.Symbol, - (0L, 30L), - (0L, 31L)) - (TokenType.Property, - (0L, 33L), - (0L, 34L)) - (TokenType.Number, - (0L, 37L), - (0L, 38L)) - (TokenType.Symbol, - (0L, 38L), - (0L, 39L)) - (TokenType.Symbol, - (0L, 40L), - (0L, 41L)) ] - - ("const enumConst = Stdlib.Option.Option.Some(1L)" |> tokenize) = [ (TokenType.Keyword, - (0L, 0L), - (0L, 5L)) - (TokenType.VariableName, - (0L, 6L), - (0L, 15L)) - (TokenType.Symbol, - (0L, 16L), - (0L, 17L)) - (TokenType.TypeName, - (0L, 18L), - (0L, 38L)) - (TokenType.Symbol, - (0L, 38L), - (0L, 39L)) - (TokenType.EnumMember, - (0L, 39L), - (0L, 43L)) - (TokenType.Number, - (0L, 44L), - (0L, 45L)) - (TokenType.Symbol, - (0L, 45L), - (0L, 46L)) ] + ("const listConst = [1L; 2L; 3L]" |> tokenize) == [ (TokenType.Keyword(), + (0L, 0L), + (0L, 5L)) + (TokenType.VariableName(), + (0L, 6L), + (0L, 15L)) + (TokenType.Symbol(), + (0L, 16L), + (0L, 17L)) + (TokenType.Symbol(), + (0L, 18L), + (0L, 19L)) + (TokenType.Number(), + (0L, 19L), + (0L, 20L)) + (TokenType.Symbol(), + (0L, 20L), + (0L, 21L)) + (TokenType.Number(), + (0L, 23L), + (0L, 24L)) + (TokenType.Symbol(), + (0L, 24L), + (0L, 25L)) + (TokenType.Number(), + (0L, 27L), + (0L, 28L)) + (TokenType.Symbol(), + (0L, 28L), + (0L, 29L)) + (TokenType.Symbol(), + (0L, 29L), + (0L, 30L)) ] - ("const enumConst = MyEnum.A(1L, 2L)" |> tokenize) = [ (TokenType.Keyword, + ("const tupleConst = (1L, 2L, 3L)" |> tokenize) == [ (TokenType.Keyword(), + (0L, 0L), + (0L, 5L)) + (TokenType.VariableName(), + (0L, 6L), + (0L, 16L)) + (TokenType.Symbol(), + (0L, 17L), + (0L, 18L)) + (TokenType.Symbol(), + (0L, 19L), + (0L, 20L)) + (TokenType.Number(), + (0L, 20L), + (0L, 21L)) + (TokenType.Symbol(), + (0L, 21L), + (0L, 22L)) + (TokenType.Symbol(), + (0L, 22L), + (0L, 23L)) + (TokenType.Number(), + (0L, 24L), + (0L, 25L)) + (TokenType.Symbol(), + (0L, 25L), + (0L, 26L)) + (TokenType.Symbol(), + (0L, 26L), + (0L, 27L)) + (TokenType.Number(), + (0L, 28L), + (0L, 29L)) + (TokenType.Symbol(), + (0L, 29L), + (0L, 30L)) + (TokenType.Symbol(), + (0L, 30L), + (0L, 31L)) ] + + ("const dictConst = Dict { a = 1L; b = 2L }" |> tokenize) == [ (TokenType.Keyword(), + (0L, 0L), + (0L, 5L)) + (TokenType.VariableName(), + (0L, 6L), + (0L, 15L)) + (TokenType.Symbol(), + (0L, 16L), + (0L, 17L)) + (TokenType.Keyword(), + (0L, 18L), + (0L, 22L)) + (TokenType.Symbol(), + (0L, 23L), + (0L, 24L)) + (TokenType.Property(), + (0L, 25L), + (0L, 26L)) + (TokenType.Number(), + (0L, 29L), + (0L, 30L)) + (TokenType.Symbol(), + (0L, 30L), + (0L, 31L)) + (TokenType.Property(), + (0L, 33L), + (0L, 34L)) + (TokenType.Number(), + (0L, 37L), + (0L, 38L)) + (TokenType.Symbol(), + (0L, 38L), + (0L, 39L)) + (TokenType.Symbol(), + (0L, 40L), + (0L, 41L)) ] + + ("const enumConst = Stdlib.Option.Option.Some(1L)" |> tokenize) == [ (TokenType.Keyword(), + (0L, 0L), + (0L, 5L)) + (TokenType.VariableName(), + (0L, 6L), + (0L, 15L)) + (TokenType.Symbol(), + (0L, 16L), + (0L, 17L)) + (TokenType.TypeName(), + (0L, 18L), + (0L, 38L)) + (TokenType.Symbol(), + (0L, 38L), + (0L, 39L)) + (TokenType.EnumMember(), + (0L, 39L), + (0L, 43L)) + (TokenType.Number(), + (0L, 44L), + (0L, 45L)) + (TokenType.Symbol(), + (0L, 45L), + (0L, 46L)) ] + + ("const enumConst = MyEnum.A(1L, 2L)" |> tokenize) == [(TokenType.Keyword(), (0L, 0L), (0L, 5L)) - (TokenType.VariableName, + (TokenType.VariableName(), (0L, 6L), (0L, 15L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 16L), (0L, 17L)) - (TokenType.TypeName, + (TokenType.TypeName(), (0L, 18L), (0L, 24L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 24L), (0L, 25L)) - (TokenType.EnumMember, + (TokenType.EnumMember(), (0L, 25L), (0L, 26L)) - (TokenType.Number, + (TokenType.Number(), (0L, 27L), (0L, 28L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 28L), (0L, 29L)) - (TokenType.Number, + (TokenType.Number(), (0L, 31L), (0L, 32L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 32L), (0L, 33L)) ] module TokenizeExpression = - ("()" |> tokenize) = [ (TokenType.Symbol, (0L, 0L), (0L, 2L)) ] - ("true" |> tokenize) = [ (TokenType.Keyword, (0L, 0L), (0L, 4L)) ] + ("()" |> tokenize) == [ (TokenType.Symbol(), (0L, 0L), (0L, 2L)) ] + ("true" |> tokenize) == [ (TokenType.Keyword(), (0L, 0L), (0L, 4L)) ] - ("1y" |> tokenize) = [ (TokenType.Number, (0L, 0L), (0L, 1L)) - (TokenType.Symbol, (0L, 1L), (0L, 2L)) ] + ("1y" |> tokenize) == [ (TokenType.Number(), (0L, 0L), (0L, 1L)) + (TokenType.Symbol(), (0L, 1L), (0L, 2L)) ] - ("1uy" |> tokenize) = [ (TokenType.Number, (0L, 0L), (0L, 1L)) - (TokenType.Symbol, (0L, 1L), (0L, 3L)) ] + ("1uy" |> tokenize) == [ (TokenType.Number(), (0L, 0L), (0L, 1L)) + (TokenType.Symbol(), (0L, 1L), (0L, 3L)) ] - ("1s" |> tokenize) = [ (TokenType.Number, (0L, 0L), (0L, 1L)) - (TokenType.Symbol, (0L, 1L), (0L, 2L)) ] + ("1s" |> tokenize) == [ (TokenType.Number(), (0L, 0L), (0L, 1L)) + (TokenType.Symbol(), (0L, 1L), (0L, 2L)) ] - ("1us" |> tokenize) = [ (TokenType.Number, (0L, 0L), (0L, 1L)) - (TokenType.Symbol, (0L, 1L), (0L, 3L)) ] + ("1us" |> tokenize) == [ (TokenType.Number(), (0L, 0L), (0L, 1L)) + (TokenType.Symbol(), (0L, 1L), (0L, 3L)) ] - ("1l" |> tokenize) = [ (TokenType.Number, (0L, 0L), (0L, 1L)) - (TokenType.Symbol, (0L, 1L), (0L, 2L)) ] + ("1l" |> tokenize) == [ (TokenType.Number(), (0L, 0L), (0L, 1L)) + (TokenType.Symbol(), (0L, 1L), (0L, 2L)) ] - ("1ul" |> tokenize) = [ (TokenType.Number, (0L, 0L), (0L, 1L)) - (TokenType.Symbol, (0L, 1L), (0L, 3L)) ] + ("1ul" |> tokenize) == [ (TokenType.Number(), (0L, 0L), (0L, 1L)) + (TokenType.Symbol(), (0L, 1L), (0L, 3L)) ] - ("1L" |> tokenize) = [ (TokenType.Number, (0L, 0L), (0L, 1L)) - (TokenType.Symbol, (0L, 1L), (0L, 2L)) ] + ("1L" |> tokenize) == [ (TokenType.Number(), (0L, 0L), (0L, 1L)) + (TokenType.Symbol(), (0L, 1L), (0L, 2L)) ] - ("1UL" |> tokenize) = [ (TokenType.Number, (0L, 0L), (0L, 1L)) - (TokenType.Symbol, (0L, 1L), (0L, 3L)) ] + ("1UL" |> tokenize) == [ (TokenType.Number(), (0L, 0L), (0L, 1L)) + (TokenType.Symbol(), (0L, 1L), (0L, 3L)) ] - ("1Q" |> tokenize) = [ (TokenType.Number, (0L, 0L), (0L, 1L)) - (TokenType.Symbol, (0L, 1L), (0L, 2L)) ] + ("1Q" |> tokenize) == [ (TokenType.Number(), (0L, 0L), (0L, 1L)) + (TokenType.Symbol(), (0L, 1L), (0L, 2L)) ] - ("1Z" |> tokenize) = [ (TokenType.Number, (0L, 0L), (0L, 1L)) - (TokenType.Symbol, (0L, 1L), (0L, 2L)) ] + ("1Z" |> tokenize) == [ (TokenType.Number(), (0L, 0L), (0L, 1L)) + (TokenType.Symbol(), (0L, 1L), (0L, 2L)) ] - ("1.0" |> tokenize) = [ (TokenType.Number, (0L, 0L), (0L, 3L)) ] + ("1.0" |> tokenize) == [ (TokenType.Number(), (0L, 0L), (0L, 3L)) ] - ("\"hello\"" |> tokenize) = [ (TokenType.Symbol, (0L, 0L), (0L, 1L)) - (TokenType.String, (0L, 1L), (0L, 6L)) - (TokenType.Symbol, (0L, 6L), (0L, 7L)) ] + ("\"hello\"" |> tokenize) == [ (TokenType.Symbol(), (0L, 0L), (0L, 1L)) + (TokenType.String(), (0L, 1L), (0L, 6L)) + (TokenType.Symbol(), (0L, 6L), (0L, 7L)) ] - ("$\"hello {name}\"" |> tokenize) = [ (TokenType.Symbol, (0L, 0L), (0L, 1L)) - (TokenType.Symbol, (0L, 1L), (0L, 2L)) - (TokenType.String, (0L, 2L), (0L, 8L)) - (TokenType.Symbol, (0L, 8L), (0L, 9L)) - (TokenType.VariableName, (0L, 9L), (0L, 13L)) - (TokenType.Symbol, (0L, 13L), (0L, 14L)) - (TokenType.Symbol, (0L, 14L), (0L, 15L)) ] + ("$\"hello {name}\"" |> tokenize) == [ (TokenType.Symbol(), (0L, 0L), (0L, 1L)) + (TokenType.Symbol(), (0L, 1L), (0L, 2L)) + (TokenType.String(), (0L, 2L), (0L, 8L)) + (TokenType.Symbol(), (0L, 8L), (0L, 9L)) + (TokenType.VariableName(), + (0L, 9L), + (0L, 13L)) + (TokenType.Symbol(), (0L, 13L), (0L, 14L)) + (TokenType.Symbol(), (0L, 14L), (0L, 15L)) ] - ("$\"Name: {name}, Age: {age}\"" |> tokenize) = [ (TokenType.Symbol, + ("$\"Name: {name}, Age: {age}\"" |> tokenize) == [(TokenType.Symbol(), (0L, 0L), (0L, 1L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 1L), (0L, 2L)) - (TokenType.String, + (TokenType.String(), (0L, 2L), (0L, 8L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 8L), (0L, 9L)) - (TokenType.VariableName, + (TokenType.VariableName(), (0L, 9L), (0L, 13L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 13L), (0L, 14L)) - (TokenType.String, + (TokenType.String(), (0L, 14L), (0L, 21L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 21L), (0L, 22L)) - (TokenType.VariableName, + (TokenType.VariableName(), (0L, 22L), (0L, 25L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 25L), (0L, 26L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 26L), (0L, 27L)) ] - ("[true; false; true]" |> tokenize) = [ (TokenType.Symbol, (0L, 0L), (0L, 1L)) - (TokenType.Keyword, (0L, 1L), (0L, 5L)) - (TokenType.Keyword, (0L, 7L), (0L, 12L)) - (TokenType.Keyword, (0L, 14L), (0L, 18L)) - (TokenType.Symbol, (0L, 18L), (0L, 19L)) ] + ("[true; false; true]" |> tokenize) == [(TokenType.Symbol(), (0L, 0L), (0L, 1L)) + (TokenType.Keyword(), (0L, 1L), (0L, 5L)) + (TokenType.Keyword(), (0L, 7L), (0L, 12L)) + (TokenType.Keyword(), (0L, 14L), (0L, 18L)) + (TokenType.Symbol(), (0L, 18L), (0L, 19L)) ] - ("Dict { a = 1L; b = 2L }" |> tokenize) = [ (TokenType.Keyword, (0L, 0L), (0L, 4L)) - (TokenType.Symbol, (0L, 5L), (0L, 6L)) - (TokenType.Property, (0L, 7L), (0L, 8L)) - (TokenType.Number, (0L, 11L), (0L, 12L)) - (TokenType.Symbol, (0L, 12L), (0L, 13L)) - (TokenType.Property, + ("Dict { a = 1L; b = 2L }" |> tokenize) == [(TokenType.Keyword(), + (0L, 0L), + (0L, 4L)) + (TokenType.Symbol(), (0L, 5L), (0L, 6L)) + (TokenType.Property(), + (0L, 7L), + (0L, 8L)) + (TokenType.Number(), + (0L, 11L), + (0L, 12L)) + (TokenType.Symbol(), + (0L, 12L), + (0L, 13L)) + (TokenType.Property(), (0L, 15L), (0L, 16L)) - (TokenType.Number, (0L, 19L), (0L, 20L)) - (TokenType.Symbol, (0L, 20L), (0L, 21L)) - (TokenType.Symbol, (0L, 22L), (0L, 23L)) ] + (TokenType.Number(), + (0L, 19L), + (0L, 20L)) + (TokenType.Symbol(), + (0L, 20L), + (0L, 21L)) + (TokenType.Symbol(), + (0L, 22L), + (0L, 23L)) ] - ("(true, false, true)" |> tokenize) = [ (TokenType.Symbol, (0L, 0L), (0L, 1L)) - (TokenType.Keyword, (0L, 1L), (0L, 5L)) - (TokenType.Symbol, (0L, 5L), (0L, 6L)) - (TokenType.Keyword, (0L, 7L), (0L, 12L)) - (TokenType.Symbol, (0L, 12L), (0L, 13L)) - (TokenType.Keyword, (0L, 14L), (0L, 18L)) - (TokenType.Symbol, (0L, 18L), (0L, 19L)) ] + ("(true, false, true)" |> tokenize) == [(TokenType.Symbol(), (0L, 0L), (0L, 1L)) + (TokenType.Keyword(), (0L, 1L), (0L, 5L)) + (TokenType.Symbol(), (0L, 5L), (0L, 6L)) + (TokenType.Keyword(), (0L, 7L), (0L, 12L)) + (TokenType.Symbol(), (0L, 12L), (0L, 13L)) + (TokenType.Keyword(), (0L, 14L), (0L, 18L)) + (TokenType.Symbol(), (0L, 18L), (0L, 19L)) ] - ("MyRecord {fieldOne = 1L; fieldTwo = 2L} " |> tokenize) = [ (TokenType.TypeName, + ("MyRecord {fieldOne = 1L; fieldTwo = 2L} " |> tokenize) == [(TokenType.TypeName(), (0L, 0L), (0L, 8L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 9L), (0L, 10L)) - (TokenType.Property, + (TokenType.Property(), (0L, 10L), (0L, 18L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 19L), (0L, 20L)) - (TokenType.Number, + (TokenType.Number(), (0L, 21L), (0L, 22L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 22L), (0L, 23L)) - (TokenType.Property, + (TokenType.Property(), (0L, 25L), (0L, 33L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 34L), (0L, 35L)) - (TokenType.Number, + (TokenType.Number(), (0L, 36L), (0L, 37L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 37L), (0L, 38L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 38L), (0L, 39L)) ] - ("{ RecordForUpdate { x = true; y = false } with y = true }" |> tokenize) = [ (TokenType.TypeName, - (0L, - 2L), - (0L, - 17L)) - (TokenType.Symbol, - (0L, - 18L), - (0L, - 19L)) - (TokenType.Property, - (0L, - 20L), - (0L, - 21L)) - (TokenType.Symbol, - (0L, - 22L), - (0L, - 23L)) - (TokenType.Keyword, - (0L, - 24L), - (0L, - 28L)) - (TokenType.Property, - (0L, - 30L), - (0L, - 31L)) - (TokenType.Symbol, - (0L, - 32L), - (0L, - 33L)) - (TokenType.Keyword, - (0L, - 34L), - (0L, - 39L)) - (TokenType.Symbol, - (0L, - 40L), - (0L, - 41L)) - (TokenType.Keyword, - (0L, - 42L), - (0L, - 46L)) - (TokenType.Property, - (0L, - 47L), - (0L, - 48L)) - (TokenType.Symbol, - (0L, - 49L), - (0L, - 50L)) - (TokenType.Keyword, - (0L, - 51L), - (0L, - 55L)) ] - - ("MyEnum.A(1L)" |> tokenize) = [ (TokenType.TypeName, (0L, 0L), (0L, 6L)) - (TokenType.Symbol, (0L, 6L), (0L, 7L)) - (TokenType.EnumMember, (0L, 7L), (0L, 8L)) - (TokenType.Number, (0L, 9L), (0L, 10L)) - (TokenType.Symbol, (0L, 10L), (0L, 11L)) ] - - - - ("let x = true\n x" |> tokenize) = [ (TokenType.Keyword, (0L, 0L), (0L, 3L)) - (TokenType.VariableName, (0L, 4L), (0L, 5L)) - (TokenType.Symbol, (0L, 6L), (0L, 7L)) - (TokenType.Keyword, (0L, 8L), (0L, 12L)) - (TokenType.VariableName, (1L, 2L), (1L, 3L)) ] - - ("myVar" |> tokenize) = [ (TokenType.VariableName, (0L, 0L), (0L, 5L)) ] - - ("myRecordVar.field" |> tokenize) = [ (TokenType.VariableName, (0L, 0L), (0L, 11L)) - (TokenType.Symbol, (0L, 11L), (0L, 12L)) - (TokenType.Property, (0L, 12L), (0L, 17L)) ] - - ("1L + 2L" |> tokenize) = [ (TokenType.Number, (0L, 0L), (0L, 1L)) - (TokenType.Symbol, (0L, 1L), (0L, 2L)) - (TokenType.Operator, (0L, 3L), (0L, 4L)) - (TokenType.Number, (0L, 5L), (0L, 6L)) - (TokenType.Symbol, (0L, 6L), (0L, 7L)) ] - - - ("fun x -> x" |> tokenize) = [ (TokenType.Keyword, (0L, 0L), (0L, 3L)) - (TokenType.VariableName, (0L, 4L), (0L, 5L)) - (TokenType.Symbol, (0L, 6L), (0L, 8L)) - (TokenType.VariableName, (0L, 9L), (0L, 10L)) ] - - - ("Stdlib.Bool.and true false" |> tokenize) = [ (TokenType.ModuleName, + ("{ RecordForUpdate { x = true; y = false } with y = true }" |> tokenize) == [(TokenType.TypeName(), + (0L,2L), + (0L,17L)) + (TokenType.Symbol(), + (0L,18L), + (0L,19L)) + (TokenType.Property(), + (0L,20L), + (0L,21L)) + (TokenType.Symbol(), + (0L,22L), + (0L,23L)) + (TokenType.Keyword(), + (0L,24L), + (0L,28L)) + (TokenType.Property(), + (0L,30L), + (0L,31L)) + (TokenType.Symbol(), + (0L,32L), + (0L,33L)) + (TokenType.Keyword(), + (0L,34L), + (0L,39L)) + (TokenType.Symbol(), + (0L,40L), + (0L,41L)) + (TokenType.Keyword(), + (0L,42L), + (0L,46L)) + (TokenType.Property(), + (0L,47L), + (0L,48L)) + (TokenType.Symbol(), + (0L,49L), + (0L,50L)) + (TokenType.Keyword(), + (0L,51L), + (0L,55L)) ] + + ("MyEnum.A(1L)" |> tokenize) == [(TokenType.TypeName(), (0L, 0L), (0L, 6L)) + (TokenType.Symbol(), (0L, 6L), (0L, 7L)) + (TokenType.EnumMember(), (0L, 7L), (0L, 8L)) + (TokenType.Number(), (0L, 9L), (0L, 10L)) + (TokenType.Symbol(), (0L, 10L), (0L, 11L)) ] + + + + ("let x = true\n x" |> tokenize) == [(TokenType.Keyword(), (0L, 0L), (0L, 3L)) + (TokenType.VariableName(), (0L, 4L), (0L, 5L)) + (TokenType.Symbol(), (0L, 6L), (0L, 7L)) + (TokenType.Keyword(), (0L, 8L), (0L, 12L)) + (TokenType.VariableName(), (1L, 2L), (1L, 3L)) ] + + ("myVar" |> tokenize) == [ (TokenType.VariableName(), (0L, 0L), (0L, 5L)) ] + + ("myRecordVar.field" |> tokenize) == [(TokenType.VariableName(), + (0L, 0L), + (0L, 11L)) + (TokenType.Symbol(), (0L, 11L), (0L, 12L)) + (TokenType.Property(), (0L, 12L), (0L, 17L)) ] + + ("1L + 2L" |> tokenize) == [(TokenType.Number(), (0L, 0L), (0L, 1L)) + (TokenType.Symbol(), (0L, 1L), (0L, 2L)) + (TokenType.Operator(), (0L, 3L), (0L, 4L)) + (TokenType.Number(), (0L, 5L), (0L, 6L)) + (TokenType.Symbol(), (0L, 6L), (0L, 7L)) ] + + + ("fun x -> x" |> tokenize) == [(TokenType.Keyword(), (0L, 0L), (0L, 3L)) + (TokenType.VariableName(), (0L, 4L), (0L, 5L)) + (TokenType.Symbol(), (0L, 6L), (0L, 8L)) + (TokenType.VariableName(), (0L, 9L), (0L, 10L)) ] + + + ("Stdlib.Bool.and true false" |> tokenize) == [(TokenType.ModuleName(), (0L, 0L), (0L, 6L)) - (TokenType.ModuleName, + (TokenType.ModuleName(), (0L, 7L), (0L, 11L)) - (TokenType.FunctionName, + (TokenType.FunctionName(), (0L, 12L), (0L, 15L)) - (TokenType.Keyword, + (TokenType.Keyword(), (0L, 16L), (0L, 20L)) - (TokenType.Keyword, + (TokenType.Keyword(), (0L, 21L), (0L, 26L)) ] // CLEANUP: fix this, the range is correct, but the order isn't for typeArgs - ("Builtin.jsonParse \"true\"" |> tokenize) = [ (TokenType.ModuleName, - (0L, 0L), - (0L, 7L)) - (TokenType.TypeName, - (0L, 18L), - (0L, 22L)) - (TokenType.FunctionName, - (0L, 8L), - (0L, 17L)) - (TokenType.Symbol, - (0L, 24L), - (0L, 25L)) - (TokenType.String, - (0L, 25L), - (0L, 29L)) - (TokenType.Symbol, - (0L, 29L), - (0L, 30L)) ] + ("Builtin.jsonParse \"true\"" |> tokenize) == [ (TokenType.ModuleName(), + (0L, 0L), + (0L, 7L)) + (TokenType.TypeName(), + (0L, 18L), + (0L, 22L)) + (TokenType.FunctionName(), + (0L, 8L), + (0L, 17L)) + (TokenType.Symbol(), + (0L, 24L), + (0L, 25L)) + (TokenType.String(), + (0L, 25L), + (0L, 29L)) + (TokenType.Symbol(), + (0L, 29L), + (0L, 30L)) ] - ("if true then true else false" |> tokenize) = [ (TokenType.Keyword, - (0L, 0L), - (0L, 2L)) - (TokenType.Keyword, - (0L, 3L), - (0L, 7L)) - (TokenType.Keyword, - (0L, 8L), - (0L, 12L)) - (TokenType.Keyword, - (0L, 13L), - (0L, 17L)) - (TokenType.Keyword, - (0L, 18L), - (0L, 22L)) - (TokenType.Keyword, - (0L, 23L), - (0L, 28L)) ] + ("if true then true else false" |> tokenize) == [ (TokenType.Keyword(), + (0L, 0L), + (0L, 2L)) + (TokenType.Keyword(), + (0L, 3L), + (0L, 7L)) + (TokenType.Keyword(), + (0L, 8L), + (0L, 12L)) + (TokenType.Keyword(), + (0L, 13L), + (0L, 17L)) + (TokenType.Keyword(), + (0L, 18L), + (0L, 22L)) + (TokenType.Keyword(), + (0L, 23L), + (0L, 28L)) ] - ("match true with\n| true -> true" |> tokenize) = [ (TokenType.Keyword, + ("match true with\n| true -> true" |> tokenize) == [(TokenType.Keyword(), (0L, 0L), (0L, 5L)) - (TokenType.Keyword, + (TokenType.Keyword(), (0L, 6L), (0L, 10L)) - (TokenType.Keyword, + (TokenType.Keyword(), (0L, 11L), (0L, 15L)) - (TokenType.Symbol, + (TokenType.Symbol(), (1L, 0L), (1L, 1L)) - (TokenType.Keyword, + (TokenType.Keyword(), (1L, 2L), (1L, 6L)) - (TokenType.Symbol, + (TokenType.Symbol(), (1L, 7L), (1L, 9L)) - (TokenType.Keyword, + (TokenType.Keyword(), (1L, 10L), (1L, 14L)) ] - ("Stdlib.List.empty" |> tokenize) = [ (TokenType.ModuleName, (0L, 0L), (0L, 6L)) - (TokenType.ModuleName, (0L, 7L), (0L, 11L)) - (TokenType.VariableName, (0L, 12L), (0L, 17L)) ] + ("Stdlib.List.empty" |> tokenize) == [(TokenType.ModuleName(), (0L, 0L), (0L, 6L)) + (TokenType.ModuleName(), (0L, 7L), (0L, 11L)) + (TokenType.VariableName(), + (0L, 12L), + (0L, 17L)) ] module TokenizePipeExpression = - ("1L |> (+) 2L" |> tokenize) = [ (TokenType.Number, (0L, 0L), (0L, 1L)) - (TokenType.Symbol, (0L, 1L), (0L, 2L)) - (TokenType.Operator, (0L, 3L), (0L, 5L)) - (TokenType.Operator, (0L, 7L), (0L, 8L)) - (TokenType.Number, (0L, 10L), (0L, 11L)) - (TokenType.Symbol, (0L, 11L), (0L, 12L)) ] - - ("1L |> (fun x -> x + 1L)" |> tokenize) = [ (TokenType.Number, (0L, 0L), (0L, 1L)) - (TokenType.Symbol, (0L, 1L), (0L, 2L)) - (TokenType.Operator, (0L, 3L), (0L, 5L)) - (TokenType.Keyword, (0L, 7L), (0L, 10L)) - (TokenType.VariableName, + ("1L |> (+) 2L" |> tokenize) == [(TokenType.Number(), (0L, 0L), (0L, 1L)) + (TokenType.Symbol(), (0L, 1L), (0L, 2L)) + (TokenType.Operator(), (0L, 3L), (0L, 5L)) + (TokenType.Operator(), (0L, 7L), (0L, 8L)) + (TokenType.Number(), (0L, 10L), (0L, 11L)) + (TokenType.Symbol(), (0L, 11L), (0L, 12L)) ] + + ("1L |> (fun x -> x + 1L)" |> tokenize) == [(TokenType.Number(), (0L, 0L), (0L, 1L)) + (TokenType.Symbol(), (0L, 1L), (0L, 2L)) + (TokenType.Operator(), + (0L, 3L), + (0L, 5L)) + (TokenType.Keyword(), + (0L, 7L), + (0L, 10L)) + (TokenType.VariableName(), (0L, 11L), (0L, 12L)) - (TokenType.Symbol, (0L, 13L), (0L, 15L)) - (TokenType.VariableName, + (TokenType.Symbol(), + (0L, 13L), + (0L, 15L)) + (TokenType.VariableName(), (0L, 16L), (0L, 17L)) - (TokenType.Operator, + (TokenType.Operator(), (0L, 18L), (0L, 19L)) - (TokenType.Number, (0L, 20L), (0L, 21L)) - (TokenType.Symbol, (0L, 21L), (0L, 22L)) ] - - ("1L |> MyEnum.A()" |> tokenize) = [ (TokenType.Number, (0L, 0L), (0L, 1L)) - (TokenType.Symbol, (0L, 1L), (0L, 2L)) - (TokenType.Operator, (0L, 3L), (0L, 5L)) - (TokenType.TypeName, (0L, 6L), (0L, 12L)) - (TokenType.Symbol, (0L, 12L), (0L, 13L)) - (TokenType.EnumMember, (0L, 13L), (0L, 14L)) ] - - ("1L |> Stdlib.Result.Result.Ok()" |> tokenize) = [ (TokenType.Number, + (TokenType.Number(), + (0L, 20L), + (0L, 21L)) + (TokenType.Symbol(), + (0L, 21L), + (0L, 22L)) ] + + ("1L |> MyEnum.A()" |> tokenize) == [(TokenType.Number(), (0L, 0L), (0L, 1L)) + (TokenType.Symbol(), (0L, 1L), (0L, 2L)) + (TokenType.Operator(), (0L, 3L), (0L, 5L)) + (TokenType.TypeName(), (0L, 6L), (0L, 12L)) + (TokenType.Symbol(), (0L, 12L), (0L, 13L)) + (TokenType.EnumMember(), (0L, 13L), (0L, 14L)) ] + + ("1L |> Stdlib.Result.Result.Ok()" |> tokenize) == [(TokenType.Number(), (0L, 0L), (0L, 1L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 1L), (0L, 2L)) - (TokenType.Operator, + (TokenType.Operator(), (0L, 3L), (0L, 5L)) - (TokenType.TypeName, + (TokenType.TypeName(), (0L, 6L), (0L, 26L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 26L), (0L, 27L)) - (TokenType.EnumMember, + (TokenType.EnumMember(), (0L, 27L), (0L, 29L)) ] - ("1L |> Stdlib.Int64.add 2L" |> tokenize) = [ (TokenType.Number, (0L, 0L), (0L, 1L)) - (TokenType.Symbol, (0L, 1L), (0L, 2L)) - (TokenType.Operator, + ("1L |> Stdlib.Int64.add 2L" |> tokenize) == [(TokenType.Number(), + (0L, 0L), + (0L, 1L)) + (TokenType.Symbol(), + (0L, 1L), + (0L, 2L)) + (TokenType.Operator(), (0L, 3L), (0L, 5L)) - (TokenType.FunctionName, + (TokenType.FunctionName(), (0L, 6L), (0L, 22L)) - (TokenType.Number, + (TokenType.Number(), (0L, 23L), (0L, 24L)) - (TokenType.Symbol, + (TokenType.Symbol(), (0L, 24L), (0L, 25L)) ] - ("1L |> x" |> tokenize) = [ (TokenType.Number, (0L, 0L), (0L, 1L)) - (TokenType.Symbol, (0L, 1L), (0L, 2L)) - (TokenType.Operator, (0L, 3L), (0L, 5L)) - (TokenType.FunctionName, (0L, 6L), (0L, 7L)) ] + ("1L |> x" |> tokenize) == [(TokenType.Number(), (0L, 0L), (0L, 1L)) + (TokenType.Symbol(), (0L, 1L), (0L, 2L)) + (TokenType.Operator(), (0L, 3L), (0L, 5L)) + (TokenType.FunctionName(), (0L, 6L), (0L, 7L)) ] module TokenizeMatchExpression = - ("match () with\n| () -> true" |> tokenize) = [ (TokenType.Keyword, - (0L, 0L), - (0L, 5L)) - (TokenType.Symbol, - (0L, 6L), - (0L, 8L)) - (TokenType.Keyword, - (0L, 9L), - (0L, 13L)) - (TokenType.Symbol, - (1L, 0L), - (1L, 1L)) - (TokenType.Symbol, - (1L, 2L), - (1L, 4L)) - (TokenType.Symbol, - (1L, 5L), - (1L, 7L)) - (TokenType.Keyword, - (1L, 8L), - (1L, 12L)) ] - - ("match x with\n| x -> 1L" |> tokenize) = [ (TokenType.Keyword, (0L, 0L), (0L, 5L)) - (TokenType.VariableName, - (0L, 6L), - (0L, 7L)) - (TokenType.Keyword, (0L, 8L), (0L, 12L)) - (TokenType.Symbol, (1L, 0L), (1L, 1L)) - (TokenType.VariableName, - (1L, 2L), - (1L, 3L)) - (TokenType.Symbol, (1L, 4L), (1L, 6L)) - (TokenType.Number, (1L, 7L), (1L, 8L)) - (TokenType.Symbol, (1L, 8L), (1L, 9L)) ] - - ("match 1L with\n| 1L -> 1L" |> tokenize) = [ (TokenType.Keyword, - (0L, 0L), - (0L, 5L)) - (TokenType.Number, (0L, 6L), (0L, 7L)) - (TokenType.Symbol, (0L, 7L), (0L, 8L)) - (TokenType.Keyword, - (0L, 9L), - (0L, 13L)) - (TokenType.Symbol, (1L, 0L), (1L, 1L)) - (TokenType.Number, (1L, 2L), (1L, 3L)) - (TokenType.Symbol, (1L, 3L), (1L, 4L)) - (TokenType.Symbol, (1L, 5L), (1L, 7L)) - (TokenType.Number, (1L, 8L), (1L, 9L)) - (TokenType.Symbol, - (1L, 9L), - (1L, 10L)) ] - - ("match 1.0 with\n| 1.0 -> 1.0" |> tokenize) = [ (TokenType.Keyword, - (0L, 0L), - (0L, 5L)) - (TokenType.Number, - (0L, 6L), - (0L, 9L)) - (TokenType.Keyword, - (0L, 10L), - (0L, 14L)) - (TokenType.Symbol, - (1L, 0L), - (1L, 1L)) - (TokenType.Number, - (1L, 2L), - (1L, 5L)) - (TokenType.Symbol, - (1L, 6L), - (1L, 8L)) - (TokenType.Number, - (1L, 9L), - (1L, 12L)) ] - - ("match true with\n| true -> true\n| false -> false" |> tokenize) = [ (TokenType.Keyword, - (0L, 0L), - (0L, 5L)) - (TokenType.Keyword, - (0L, 6L), - (0L, 10L)) - (TokenType.Keyword, - (0L, 11L), - (0L, 15L)) - (TokenType.Symbol, - (1L, 0L), - (1L, 1L)) - (TokenType.Keyword, - (1L, 2L), - (1L, 6L)) - (TokenType.Symbol, - (1L, 7L), - (1L, 9L)) - (TokenType.Keyword, - (1L, 10L), - (1L, 14L)) - (TokenType.Symbol, - (2L, 0L), - (2L, 1L)) - (TokenType.Keyword, - (2L, 2L), - (2L, 7L)) - (TokenType.Symbol, - (2L, 8L), - (2L, 10L)) - (TokenType.Keyword, - (2L, 11L), - (2L, 16L)) ] - - ("match \"str\" with\n| \"str\" -> true" |> tokenize) = [ (TokenType.Keyword, - (0L, 0L), - (0L, 5L)) - (TokenType.Symbol, - (0L, 6L), - (0L, 7L)) - (TokenType.String, - (0L, 7L), - (0L, 10L)) - (TokenType.Symbol, - (0L, 10L), - (0L, 11L)) - (TokenType.Keyword, - (0L, 12L), - (0L, 16L)) - (TokenType.Symbol, - (1L, 0L), - (1L, 1L)) - (TokenType.Symbol, - (1L, 2L), - (1L, 3L)) - (TokenType.String, - (1L, 3L), - (1L, 6L)) - (TokenType.Symbol, - (1L, 6L), - (1L, 7L)) - (TokenType.Symbol, - (1L, 8L), - (1L, 10L)) - (TokenType.Keyword, - (1L, 11L), - (1L, 15L)) ] - - ("match 'a' with\n| 'a' -> true" |> tokenize) = [ (TokenType.Keyword, - (0L, 0L), - (0L, 5L)) - (TokenType.Symbol, - (0L, 6L), - (0L, 7L)) - (TokenType.String, - (0L, 7L), - (0L, 8L)) - (TokenType.Symbol, - (0L, 8L), - (0L, 9L)) - (TokenType.Keyword, - (0L, 10L), - (0L, 14L)) - (TokenType.Symbol, - (1L, 0L), - (1L, 1L)) - (TokenType.Symbol, - (1L, 2L), - (1L, 3L)) - (TokenType.String, - (1L, 3L), - (1L, 4L)) - (TokenType.Symbol, - (1L, 4L), - (1L, 5L)) - (TokenType.Symbol, - (1L, 6L), - (1L, 8L)) - (TokenType.Keyword, - (1L, 9L), - (1L, 13L)) ] - - ("match [true; false] with\n| [true; false] -> true" |> tokenize) = [ (TokenType.Keyword, - (0L, 0L), - (0L, 5L)) - (TokenType.Symbol, - (0L, 6L), - (0L, 7L)) - (TokenType.Keyword, - (0L, 7L), - (0L, 11L)) - (TokenType.Keyword, - (0L, 13L), - (0L, 18L)) - (TokenType.Symbol, - (0L, 18L), - (0L, 19L)) - (TokenType.Keyword, - (0L, 20L), - (0L, 24L)) - (TokenType.Symbol, - (1L, 0L), - (1L, 1L)) - (TokenType.Symbol, - (1L, 2L), - (1L, 3L)) - (TokenType.Keyword, - (1L, 3L), - (1L, 7L)) - (TokenType.Keyword, - (1L, 9L), - (1L, 14L)) - (TokenType.Symbol, - (1L, 14L), - (1L, 15L)) - (TokenType.Symbol, - (1L, 16L), - (1L, 18L)) - (TokenType.Keyword, - (1L, 19L), - (1L, 23L)) ] - - ("match [1L; 2L] with\n| head :: tail -> true" |> tokenize) = [ (TokenType.Keyword, - (0L, 0L), - (0L, 5L)) - (TokenType.Symbol, - (0L, 6L), - (0L, 7L)) - (TokenType.Number, - (0L, 7L), - (0L, 8L)) - (TokenType.Symbol, - (0L, 8L), - (0L, 9L)) - (TokenType.Number, - (0L, 11L), - (0L, 12L)) - (TokenType.Symbol, - (0L, 12L), - (0L, 13L)) - (TokenType.Symbol, - (0L, 13L), - (0L, 14L)) - (TokenType.Keyword, - (0L, 15L), - (0L, 19L)) - (TokenType.Symbol, - (1L, 0L), - (1L, 1L)) - (TokenType.VariableName, - (1L, 2L), - (1L, 6L)) - (TokenType.Symbol, - (1L, 7L), - (1L, 9L)) - (TokenType.VariableName, - (1L, 10L), - (1L, 14L)) - (TokenType.Symbol, - (1L, 15L), - (1L, 17L)) - (TokenType.Keyword, - (1L, 18L), - (1L, 22L)) ] - - ("match (true, false) with\n| (true, false) -> true" |> tokenize) = [ (TokenType.Keyword, - (0L, 0L), - (0L, 5L)) - (TokenType.Symbol, - (0L, 6L), - (0L, 7L)) - (TokenType.Keyword, - (0L, 7L), - (0L, 11L)) - (TokenType.Symbol, - (0L, 11L), - (0L, 12L)) - (TokenType.Keyword, - (0L, 13L), - (0L, 18L)) - (TokenType.Symbol, - (0L, 18L), - (0L, 19L)) - (TokenType.Keyword, - (0L, 20L), - (0L, 24L)) - (TokenType.Symbol, - (1L, 0L), - (1L, 1L)) - (TokenType.Symbol, - (1L, 2L), - (1L, 3L)) - (TokenType.Keyword, - (1L, 3L), - (1L, 7L)) - (TokenType.Symbol, - (1L, 7L), - (1L, 8L)) - (TokenType.Keyword, - (1L, 9L), - (1L, 14L)) - (TokenType.Symbol, - (1L, 14L), - (1L, 15L)) - (TokenType.Symbol, - (1L, 16L), - (1L, 18L)) - (TokenType.Keyword, - (1L, 19L), - (1L, 23L)) ] + ("match () with\n| () -> true" |> tokenize) + == [ (TokenType.Keyword(), (0L, 0L), (0L, 5L)) + (TokenType.Symbol(), (0L, 6L), (0L, 8L)) + (TokenType.Keyword(), (0L, 9L), (0L, 13L)) + (TokenType.Symbol(), (1L, 0L), (1L, 1L)) + (TokenType.Symbol(), (1L, 2L), (1L, 4L)) + (TokenType.Symbol(), (1L, 5L), (1L, 7L)) + (TokenType.Keyword(), (1L, 8L), (1L, 12L)) ] + + ("match x with\n| x -> 1L" |> tokenize) + == [ (TokenType.Keyword(), (0L, 0L), (0L, 5L)) + (TokenType.VariableName(), (0L, 6L), (0L, 7L)) + (TokenType.Keyword(), (0L, 8L), (0L, 12L)) + (TokenType.Symbol(), (1L, 0L), (1L, 1L)) + (TokenType.VariableName(), (1L, 2L), (1L, 3L)) + (TokenType.Symbol(), (1L, 4L), (1L, 6L)) + (TokenType.Number(), (1L, 7L), (1L, 8L)) + (TokenType.Symbol(), (1L, 8L), (1L, 9L)) ] + + ("match 1L with\n| 1L -> 1L" |> tokenize) + == [ (TokenType.Keyword(), (0L, 0L), (0L, 5L)) + (TokenType.Number(), (0L, 6L), (0L, 7L)) + (TokenType.Symbol(), (0L, 7L), (0L, 8L)) + (TokenType.Keyword(), (0L, 9L), (0L, 13L)) + (TokenType.Symbol(), (1L, 0L), (1L, 1L)) + (TokenType.Number(), (1L, 2L), (1L, 3L)) + (TokenType.Symbol(), (1L, 3L), (1L, 4L)) + (TokenType.Symbol(), (1L, 5L), (1L, 7L)) + (TokenType.Number(), (1L, 8L), (1L, 9L)) + (TokenType.Symbol(), (1L, 9L), (1L, 10L)) ] + + ("match 1.0 with\n| 1.0 -> 1.0" |> tokenize) + == [ (TokenType.Keyword(), (0L, 0L), (0L, 5L)) + (TokenType.Number(), (0L, 6L), (0L, 9L)) + (TokenType.Keyword(), (0L, 10L), (0L, 14L)) + (TokenType.Symbol(), (1L, 0L), (1L, 1L)) + (TokenType.Number(), (1L, 2L), (1L, 5L)) + (TokenType.Symbol(), (1L, 6L), (1L, 8L)) + (TokenType.Number(), (1L, 9L), (1L, 12L)) ] + + ("match true with\n| true -> true\n| false -> false" |> tokenize) + == [ (TokenType.Keyword(), (0L, 0L), (0L, 5L)) + (TokenType.Keyword(), (0L, 6L), (0L, 10L)) + (TokenType.Keyword(), (0L, 11L), (0L, 15L)) + (TokenType.Symbol(), (1L, 0L), (1L, 1L)) + (TokenType.Keyword(), (1L, 2L), (1L, 6L)) + (TokenType.Symbol(), (1L, 7L), (1L, 9L)) + (TokenType.Keyword(), (1L, 10L), (1L, 14L)) + (TokenType.Symbol(), (2L, 0L), (2L, 1L)) + (TokenType.Keyword(), (2L, 2L), (2L, 7L)) + (TokenType.Symbol(), (2L, 8L), (2L, 10L)) + (TokenType.Keyword(), (2L, 11L), (2L, 16L)) ] + + ("match \"str\" with\n| \"str\" -> true" |> tokenize) + == [ (TokenType.Keyword(), (0L, 0L), (0L, 5L)) + (TokenType.Symbol(), (0L, 6L), (0L, 7L)) + (TokenType.String(), (0L, 7L), (0L, 10L)) + (TokenType.Symbol(), (0L, 10L), (0L, 11L)) + (TokenType.Keyword(), (0L, 12L), (0L, 16L)) + (TokenType.Symbol(), (1L, 0L), (1L, 1L)) + (TokenType.Symbol(), (1L, 2L), (1L, 3L)) + (TokenType.String(), (1L, 3L), (1L, 6L)) + (TokenType.Symbol(), (1L, 6L), (1L, 7L)) + (TokenType.Symbol(), (1L, 8L), (1L, 10L)) + (TokenType.Keyword(), (1L, 11L), (1L, 15L)) ] + + ("match 'a' with\n| 'a' -> true" |> tokenize) + == [ (TokenType.Keyword(), (0L, 0L), (0L, 5L)) + (TokenType.Symbol(), (0L, 6L), (0L, 7L)) + (TokenType.String(), (0L, 7L), (0L, 8L)) + (TokenType.Symbol(), (0L, 8L), (0L, 9L)) + (TokenType.Keyword(), (0L, 10L), (0L, 14L)) + (TokenType.Symbol(), (1L, 0L), (1L, 1L)) + (TokenType.Symbol(), (1L, 2L), (1L, 3L)) + (TokenType.String(), (1L, 3L), (1L, 4L)) + (TokenType.Symbol(), (1L, 4L), (1L, 5L)) + (TokenType.Symbol(), (1L, 6L), (1L, 8L)) + (TokenType.Keyword(), (1L, 9L), (1L, 13L)) ] + + ("match [true; false] with\n| [true; false] -> true" |> tokenize) + == [ (TokenType.Keyword(), (0L, 0L), (0L, 5L)) + (TokenType.Symbol(), (0L, 6L), (0L, 7L)) + (TokenType.Keyword(), (0L, 7L), (0L, 11L)) + (TokenType.Keyword(), (0L, 13L), (0L, 18L)) + (TokenType.Symbol(), (0L, 18L), (0L, 19L)) + (TokenType.Keyword(), (0L, 20L), (0L, 24L)) + (TokenType.Symbol(), (1L, 0L), (1L, 1L)) + (TokenType.Symbol(), (1L, 2L), (1L, 3L)) + (TokenType.Keyword(), (1L, 3L), (1L, 7L)) + (TokenType.Keyword(), (1L, 9L), (1L, 14L)) + (TokenType.Symbol(), (1L, 14L), (1L, 15L)) + (TokenType.Symbol(), (1L, 16L), (1L, 18L)) + (TokenType.Keyword(), (1L, 19L), (1L, 23L)) ] + + ("match [1L; 2L] with\n| head :: tail -> true" |> tokenize) + == [ (TokenType.Keyword(), (0L, 0L), (0L, 5L)) + (TokenType.Symbol(), (0L, 6L), (0L, 7L)) + (TokenType.Number(), (0L, 7L), (0L, 8L)) + (TokenType.Symbol(), (0L, 8L), (0L, 9L)) + (TokenType.Number(), (0L, 11L), (0L, 12L)) + (TokenType.Symbol(), (0L, 12L), (0L, 13L)) + (TokenType.Symbol(), (0L, 13L), (0L, 14L)) + (TokenType.Keyword(), (0L, 15L), (0L, 19L)) + (TokenType.Symbol(), (1L, 0L), (1L, 1L)) + (TokenType.VariableName(), (1L, 2L), (1L, 6L)) + (TokenType.Symbol(), (1L, 7L), (1L, 9L)) + (TokenType.VariableName(), (1L, 10L), (1L, 14L)) + (TokenType.Symbol(), (1L, 15L), (1L, 17L)) + (TokenType.Keyword(), (1L, 18L), (1L, 22L)) ] + + ("match (true, false) with\n| (true, false) -> true" |> tokenize) + == [ (TokenType.Keyword(), (0L, 0L), (0L, 5L)) + (TokenType.Symbol(), (0L, 6L), (0L, 7L)) + (TokenType.Keyword(), (0L, 7L), (0L, 11L)) + (TokenType.Symbol(), (0L, 11L), (0L, 12L)) + (TokenType.Keyword(), (0L, 13L), (0L, 18L)) + (TokenType.Symbol(), (0L, 18L), (0L, 19L)) + (TokenType.Keyword(), (0L, 20L), (0L, 24L)) + (TokenType.Symbol(), (1L, 0L), (1L, 1L)) + (TokenType.Symbol(), (1L, 2L), (1L, 3L)) + (TokenType.Keyword(), (1L, 3L), (1L, 7L)) + (TokenType.Symbol(), (1L, 7L), (1L, 8L)) + (TokenType.Keyword(), (1L, 9L), (1L, 14L)) + (TokenType.Symbol(), (1L, 14L), (1L, 15L)) + (TokenType.Symbol(), (1L, 16L), (1L, 18L)) + (TokenType.Keyword(), (1L, 19L), (1L, 23L)) ] ("match Stdlib.Result.Result.Ok(5L) with\n| Ok(5L) -> true\n| Error(e) -> false" - |> tokenize) = [ (TokenType.Keyword, (0L, 0L), (0L, 5L)) - (TokenType.TypeName, (0L, 6L), (0L, 26L)) - (TokenType.Symbol, (0L, 26L), (0L, 27L)) - (TokenType.EnumMember, (0L, 27L), (0L, 29L)) - (TokenType.Number, (0L, 30L), (0L, 31L)) - (TokenType.Symbol, (0L, 31L), (0L, 32L)) - (TokenType.Keyword, (0L, 34L), (0L, 38L)) - (TokenType.Symbol, (1L, 0L), (1L, 1L)) - (TokenType.EnumMember, (1L, 2L), (1L, 4L)) - (TokenType.Number, (1L, 5L), (1L, 6L)) - (TokenType.Symbol, (1L, 6L), (1L, 7L)) - (TokenType.Symbol, (1L, 9L), (1L, 11L)) - (TokenType.Keyword, (1L, 12L), (1L, 16L)) - (TokenType.Symbol, (2L, 0L), (2L, 1L)) - (TokenType.EnumMember, (2L, 2L), (2L, 7L)) - (TokenType.VariableName, (2L, 8L), (2L, 9L)) - (TokenType.Symbol, (2L, 11L), (2L, 13L)) - (TokenType.Keyword, (2L, 14L), (2L, 19L)) ] + |> tokenize) == [ (TokenType.Keyword(), (0L, 0L), (0L, 5L)) + (TokenType.TypeName(), (0L, 6L), (0L, 26L)) + (TokenType.Symbol(), (0L, 26L), (0L, 27L)) + (TokenType.EnumMember(), (0L, 27L), (0L, 29L)) + (TokenType.Number(), (0L, 30L), (0L, 31L)) + (TokenType.Symbol(), (0L, 31L), (0L, 32L)) + (TokenType.Keyword(), (0L, 34L), (0L, 38L)) + (TokenType.Symbol(), (1L, 0L), (1L, 1L)) + (TokenType.EnumMember(), (1L, 2L), (1L, 4L)) + (TokenType.Number(), (1L, 5L), (1L, 6L)) + (TokenType.Symbol(), (1L, 6L), (1L, 7L)) + (TokenType.Symbol(), (1L, 9L), (1L, 11L)) + (TokenType.Keyword(), (1L, 12L), (1L, 16L)) + (TokenType.Symbol(), (2L, 0L), (2L, 1L)) + (TokenType.EnumMember(), (2L, 2L), (2L, 7L)) + (TokenType.VariableName(), (2L, 8L), (2L, 9L)) + (TokenType.Symbol(), (2L, 11L), (2L, 13L)) + (TokenType.Keyword(), (2L, 14L), (2L, 19L)) ] module TokenizeModuleDeclaration = - ("module MyModule =\n type ID = Int64" |> tokenize) = [ (TokenType.Keyword, - (0L, 0L), - (0L, 6L)) - (TokenType.ModuleName, - (0L, 7L), - (0L, 15L)) - (TokenType.Keyword, - (1L, 2L), - (1L, 6L)) - (TokenType.TypeName, - (1L, 7L), - (1L, 9L)) - (TokenType.Symbol, - (1L, 10L), - (1L, 11L)) - (TokenType.TypeName, - (1L, 12L), - (1L, 17L)) ] + ("module MyModule =\n type ID = Int64" |> tokenize) + == [ (TokenType.Keyword(), (0L, 0L), (0L, 6L)) + (TokenType.ModuleName(), (0L, 7L), (0L, 15L)) + (TokenType.Keyword(), (1L, 2L), (1L, 6L)) + (TokenType.TypeName(), (1L, 7L), (1L, 9L)) + (TokenType.Symbol(), (1L, 10L), (1L, 11L)) + (TokenType.TypeName(), (1L, 12L), (1L, 17L)) ] ("""module MyModule = type ID = Int64 let myFn (i: Int64): Int64 = 1L const x = 100L 1L""" - |> tokenize) = [ (TokenType.Keyword, (0L, 0L), (0L, 6L)) - (TokenType.ModuleName, (0L, 7L), (0L, 15L)) - (TokenType.Keyword, (1L, 2L), (1L, 6L)) - (TokenType.TypeName, (1L, 7L), (1L, 9L)) - (TokenType.Symbol, (1L, 10L), (1L, 11L)) - (TokenType.TypeName, (1L, 12L), (1L, 17L)) - (TokenType.Keyword, (2L, 2L), (2L, 5L)) - (TokenType.FunctionName, (2L, 6L), (2L, 10L)) - (TokenType.Symbol, (2L, 11L), (2L, 12L)) - (TokenType.ParameterName, (2L, 12L), (2L, 13L)) - (TokenType.Symbol, (2L, 13L), (2L, 14L)) - (TokenType.TypeName, (2L, 15L), (2L, 20L)) - (TokenType.Symbol, (2L, 20L), (2L, 21L)) - (TokenType.Symbol, (2L, 21L), (2L, 22L)) - (TokenType.TypeName, (2L, 23L), (2L, 28L)) - (TokenType.Symbol, (2L, 29L), (2L, 30L)) - (TokenType.Number, (2L, 31L), (2L, 32L)) - (TokenType.Symbol, (2L, 32L), (2L, 33L)) - (TokenType.Keyword, (3L, 2L), (3L, 7L)) - (TokenType.VariableName, (3L, 8L), (3L, 9L)) - (TokenType.Symbol, (3L, 10L), (3L, 11L)) - (TokenType.Number, (3L, 12L), (3L, 15L)) - (TokenType.Symbol, (3L, 15L), (3L, 16L)) - (TokenType.Number, (4L, 2L), (4L, 3L)) - (TokenType.Symbol, (4L, 3L), (4L, 4L)) ] + |> tokenize) + == [ (TokenType.Keyword(), (0L, 0L), (0L, 6L)) + (TokenType.ModuleName(), (0L, 7L), (0L, 15L)) + (TokenType.Keyword(), (1L, 2L), (1L, 6L)) + (TokenType.TypeName(), (1L, 7L), (1L, 9L)) + (TokenType.Symbol(), (1L, 10L), (1L, 11L)) + (TokenType.TypeName(), (1L, 12L), (1L, 17L)) + (TokenType.Keyword(), (2L, 2L), (2L, 5L)) + (TokenType.FunctionName()(), (2L, 6L), (2L, 10L)) + (TokenType.Symbol(), (2L, 11L), (2L, 12L)) + (TokenType.ParameterName(), (2L, 12L), (2L, 13L)) + (TokenType.Symbol(), (2L, 13L), (2L, 14L)) + (TokenType.TypeName(), (2L, 15L), (2L, 20L)) + (TokenType.Symbol(), (2L, 20L), (2L, 21L)) + (TokenType.Symbol(), (2L, 21L), (2L, 22L)) + (TokenType.TypeName(), (2L, 23L), (2L, 28L)) + (TokenType.Symbol(), (2L, 29L), (2L, 30L)) + (TokenType.Number(), (2L, 31L), (2L, 32L)) + (TokenType.Symbol(), (2L, 32L), (2L, 33L)) + (TokenType.Keyword(), (3L, 2L), (3L, 7L)) + (TokenType.VariableName(), (3L, 8L), (3L, 9L)) + (TokenType.Symbol(), (3L, 10L), (3L, 11L)) + (TokenType.Number(), (3L, 12L), (3L, 15L)) + (TokenType.Symbol(), (3L, 15L), (3L, 16L)) + (TokenType.Number(), (4L, 2L), (4L, 3L)) + (TokenType.Symbol(), (4L, 3L), (4L, 4L)) ] ("""module MyModule1 = module MyModule2 = module MyModule3 = 1L""" - |> tokenize) = [ (TokenType.Keyword, (0L, 0L), (0L, 6L)) - (TokenType.ModuleName, (0L, 7L), (0L, 16L)) - (TokenType.Keyword, (1L, 2L), (1L, 8L)) - (TokenType.ModuleName, (1L, 9L), (1L, 18L)) - (TokenType.Keyword, (2L, 4L), (2L, 10L)) - (TokenType.ModuleName, (2L, 11L), (2L, 20L)) - (TokenType.Number, (3L, 6L), (3L, 7L)) - (TokenType.Symbol, (3L, 7L), (3L, 8L)) ] \ No newline at end of file + |> tokenize) + == [ (TokenType.Keyword(), (0L, 0L), (0L, 6L)) + (TokenType.ModuleName(), (0L, 7L), (0L, 16L)) + (TokenType.Keyword(), (1L, 2L), (1L, 8L)) + (TokenType.ModuleName(), (1L, 9L), (1L, 18L)) + (TokenType.Keyword(), (2L, 4L), (2L, 10L)) + (TokenType.ModuleName(), (2L, 11L), (2L, 20L)) + (TokenType.Number(), (3L, 6L), (3L, 7L)) + (TokenType.Symbol(), (3L, 7L), (3L, 8L)) ] + diff --git a/backend/testfiles/execution/stdlib/string.dark b/backend/testfiles/execution/stdlib/string.dark index 3bccda1d31..aae7507f5f 100644 --- a/backend/testfiles/execution/stdlib/string.dark +++ b/backend/testfiles/execution/stdlib/string.dark @@ -1,168 +1,201 @@ let c (arg: String) : Char = - (Builtin.testToChar_v0 arg) |> Builtin.unwrap + (Builtin.testToChar arg) |> Builtin.unwrap module Equality = - "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" = "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" - "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" = "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" - "Είναι προικισμένοι με λογική" = "Είναι προικισμένοι με λογική" - "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" = "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" + "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" == "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" + "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" == "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" + "Είναι προικισμένοι με λογική" == "Είναι προικισμένοι με λογική" + "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" == "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" module Append = - "" ++ "" = "" - "a" ++ "̂" = "â" - "hello" ++ " world" = "hello world" - "ᄀ" ++ "ᅡᆨ" = "각" - "" ++ "a" = "a" - "a" ++ "" = "a" - "a" ++ "̂" = "â" - - Stdlib.String.append "a" "̂" = "â" - Stdlib.String.append "" "" = "" - Stdlib.String.append "hello" " world" = "hello world" - Stdlib.String.append "hello" "world" = "helloworld" // Stdlib.String.append works for ASCII range - Stdlib.String.append "ᄀ" "ᅡᆨ" = "각" - Stdlib.String.append "żółw" "😄" = "żółw😄" // Stdlib.String.append works on non-ascii strings - Stdlib.String.append "🧑🏼‍💻" "🧑🏻‍🍼" = "🧑🏼‍💻🧑🏻‍🍼" - Stdlib.String.append "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" "👱👱🏻👱🏼👱🏽👱🏾👱🏿" = "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽👱👱🏻👱🏼👱🏽👱🏾👱🏿" - Stdlib.String.append "🧟‍♂️🧟‍♀️" "🧟‍♂️" = "🧟‍♂️🧟‍♀️🧟‍♂️" - Stdlib.String.append "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" "👨‍❤️‍💋‍👨" = "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇👨‍❤️‍💋‍👨" + "" ++ "" == "" + // "a" ++ "̂" == "â" + "hello" ++ " world" == "hello world" + "ᄀ" ++ "ᅡᆨ" == "각" + "" ++ "a" == "a" + "a" ++ "" == "a" + + // Stdlib.String.append "a" "̂" == "â" + Stdlib.String.append "" "" == "" + Stdlib.String.append "hello" " world" == "hello world" + Stdlib.String.append "hello" "world" == "helloworld" // Stdlib.String.append works for ASCII range + Stdlib.String.append "ᄀ" "ᅡᆨ" == "각" + Stdlib.String.append "żółw" "😄" == "żółw😄" // Stdlib.String.append works on non-ascii strings + Stdlib.String.append "🧑🏼‍💻" "🧑🏻‍🍼" == "🧑🏼‍💻🧑🏻‍🍼" + + Stdlib.String.append "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" "👱👱🏻👱🏼👱🏽👱🏾👱🏿" + == "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽👱👱🏻👱🏼👱🏽👱🏾👱🏿" + + Stdlib.String.append "🧟‍♂️🧟‍♀️" "🧟‍♂️" == "🧟‍♂️🧟‍♀️🧟‍♂️" + + Stdlib.String.append "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" "👨‍❤️‍💋‍👨" + == "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇👨‍❤️‍💋‍👨" module Join = - (Stdlib.String.join_v0 [ "a"; "b"; "c"; "d" ] "|") = "a|b|c|d" + (Stdlib.String.join [ "a"; "b"; "c"; "d" ] "|") == "a|b|c|d" - (Stdlib.String.join_v0 [ "a"; "̂" ] "") |> Stdlib.String.base64UrlEncode_v0 = "w6I" + // (Stdlib.String.join [ "a"; "̂" ] "") |> Stdlib.String.base64UrlEncode == "w6I" - Stdlib.String.join_v0 [ "hello"; " world" ] "" = "hello world" - Stdlib.String.join_v0 [ "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽"; "🧟‍♀️" ] "" = "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽🧟‍♀️" + Stdlib.String.join [ "hello"; " world" ] "" == "hello world" + Stdlib.String.join [ "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽"; "🧟‍♀️" ] "" == "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽🧟‍♀️" - Stdlib.String.join_v0 [ "👱👱🏻👱🏼👱🏽👱🏾👱🏿"; "👨‍❤️‍💋‍👨"; "﷽﷽﷽" ] "" = "👱👱🏻👱🏼👱🏽👱🏾👱🏿👨‍❤️‍💋‍👨﷽﷽﷽" + Stdlib.String.join [ "👱👱🏻👱🏼👱🏽👱🏾👱🏿"; "👨‍❤️‍💋‍👨"; "﷽﷽﷽" ] "" + == "👱👱🏻👱🏼👱🏽👱🏾👱🏿👨‍❤️‍💋‍👨﷽﷽﷽" - Stdlib.String.join_v0 [ "🧟‍♀️🧟‍♂️"; "🧟‍♀️🧑🏽‍🦰" ] "" = "🧟‍♀️🧟‍♂️🧟‍♀️🧑🏽‍🦰" + Stdlib.String.join [ "🧟‍♀️🧟‍♂️"; "🧟‍♀️🧑🏽‍🦰" ] "" + == "🧟‍♀️🧟‍♂️🧟‍♀️🧑🏽‍🦰" - Stdlib.String.join_v0 [ "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️"; "‍⚧️‍️🇵🇷" ] "" = "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" + "🏳️⚧️‍️" == "🏳️‍⚧️" - Stdlib.String.join_v0 [ "🧟‍♀️🧟‍♂️‍"; "🧟‍♀️🧑🏽‍🦰‍‍" ] "" = "🧟‍♀️🧟‍♂️‍🧟‍♀️🧑🏽‍🦰‍‍" - Stdlib.String.join_v0 [ "🧑🏽‍🦰‍"; "🧑🏼‍💻‍‍" ] "" = "🧑🏽‍🦰‍🧑🏼‍💻‍‍" + // Stdlib.String.join [ "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️"; "‍⚧️‍️🇵🇷" ] "" == "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" + + Stdlib.String.join [ "🧟‍♀️🧟‍♂️‍"; "🧟‍♀️🧑🏽‍🦰‍‍" ] "" + == "🧟‍♀️🧟‍♂️‍🧟‍♀️🧑🏽‍🦰‍‍" + + Stdlib.String.join [ "🧑🏽‍🦰‍"; "🧑🏼‍💻‍‍" ] "" == "🧑🏽‍🦰‍🧑🏼‍💻‍‍" module ToBytes = - Stdlib.List.length (Stdlib.String.toBytes_v0 "🧑🏽‍🦰🧑🏼‍💻🧑🏻‍🍼✋✋🏻✋🏿") = 62L + Stdlib.List.length (Stdlib.String.toBytes "🧑🏽‍🦰🧑🏼‍💻🧑🏻‍🍼✋✋🏻✋🏿") == 62L - Stdlib.List.length (Stdlib.String.toBytes_v0 "😄APPLE🍏") = 13L + Stdlib.List.length (Stdlib.String.toBytes "😄APPLE🍏") == 13L - Stdlib.List.length (Stdlib.String.toBytes_v0 "Είναι προικισμένοι με λογική") = 53L + Stdlib.List.length (Stdlib.String.toBytes "Είναι προικισμένοι με λογική") == 53L - Stdlib.List.length (Stdlib.String.toBytes_v0 "") = 0L + Stdlib.List.length (Stdlib.String.toBytes "") == 0L - Stdlib.List.length (Stdlib.String.toBytes_v0 "🧑🏽‍🦰🧑🏼‍💻🧑🏻‍🍼✋✋🏻✋🏿") = 62L + Stdlib.List.length (Stdlib.String.toBytes "🧑🏽‍🦰🧑🏼‍💻🧑🏻‍🍼✋✋🏻✋🏿") == 62L - Stdlib.List.length (Stdlib.String.toBytes_v0 "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽") = 48L + Stdlib.List.length (Stdlib.String.toBytes "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽") == 48L - Stdlib.List.length (Stdlib.String.toBytes_v0 "👱👱🏻👱🏼👱🏽👱🏾👱🏿") = 44L + Stdlib.List.length (Stdlib.String.toBytes "👱👱🏻👱🏼👱🏽👱🏾👱🏿") == 44L - Stdlib.List.length (Stdlib.String.toBytes_v0 "🧟‍♀️🧟‍♂️") = 26L + Stdlib.List.length (Stdlib.String.toBytes "🧟‍♀️🧟‍♂️") == 26L - Stdlib.List.length (Stdlib.String.toBytes_v0 "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷") = 82L + Stdlib.List.length (Stdlib.String.toBytes "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷") + == 82L - Stdlib.List.length (Stdlib.String.toBytes_v0 "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇") = 49L + Stdlib.List.length (Stdlib.String.toBytes "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇") == 49L - Stdlib.List.length (Stdlib.String.toBytes_v0 "") = 0L + Stdlib.List.length (Stdlib.String.toBytes "") == 0L module FromBytesWithReplacement = - Stdlib.String.fromBytesWithReplacement_v0 ( - (Stdlib.Base64.decode_v0 "w6I") |> Builtin.unwrap - ) = "â" + Stdlib.String.fromBytesWithReplacement ( + (Stdlib.Base64.decode "w6I") |> Builtin.unwrap + ) + == "â" - Stdlib.String.fromBytesWithReplacement_v0 ( - (Stdlib.Base64.decode_v0 "aGVsbG8g8J+YgA==") |> Builtin.unwrap - ) = "hello 😀" + Stdlib.String.fromBytesWithReplacement ( + (Stdlib.Base64.decode "aGVsbG8g8J+YgA==") |> Builtin.unwrap + ) + == "hello 😀" - Stdlib.String.fromBytesWithReplacement_v0 ( - (Stdlib.Base64.decode_v0 "ww==") |> Builtin.unwrap - ) = "�" + Stdlib.String.fromBytesWithReplacement ( + (Stdlib.Base64.decode "ww==") |> Builtin.unwrap + ) + == "�" - Stdlib.String.fromBytesWithReplacement_v0 ( - (Stdlib.Base64.decode_v0 "7aCA") |> Builtin.unwrap - ) = "���" + Stdlib.String.fromBytesWithReplacement ( + (Stdlib.Base64.decode "7aCA") |> Builtin.unwrap + ) + == "���" - Stdlib.String.fromBytesWithReplacement_v0 ( - (Stdlib.Base64.decode_v0 "aMM=") |> Builtin.unwrap - ) = "h�" + Stdlib.String.fromBytesWithReplacement ( + (Stdlib.Base64.decode "aMM=") |> Builtin.unwrap + ) + == "h�" module FromBytes = - Stdlib.String.fromBytes_v0 ((Stdlib.Base64.decode_v0 "w6I") |> Builtin.unwrap) = Stdlib.Option.Option.Some - "â" + Stdlib.String.fromBytes ((Stdlib.Base64.decode "w6I") |> Builtin.unwrap) + == Stdlib.Option.Option.Some("â") - Stdlib.String.fromBytes_v0 ( - (Stdlib.Base64.decode_v0 "aGVsbG8g8J+YgA==") |> Builtin.unwrap - ) = Stdlib.Option.Option.Some "hello 😀" + Stdlib.String.fromBytes ( + (Stdlib.Base64.decode "aGVsbG8g8J+YgA==") |> Builtin.unwrap + ) + == Stdlib.Option.Option.Some("hello 😀") - Stdlib.String.fromBytes_v0 ((Stdlib.Base64.decode_v0 "ww==") |> Builtin.unwrap) = Stdlib.Option.Option.None + Stdlib.String.fromBytes ((Stdlib.Base64.decode "ww==") |> Builtin.unwrap) + == Stdlib.Option.Option.None() - Stdlib.String.fromBytes_v0 ((Stdlib.Base64.decode_v0 "7aCA") |> Builtin.unwrap) = Stdlib.Option.Option.None + Stdlib.String.fromBytes ((Stdlib.Base64.decode "7aCA") |> Builtin.unwrap) + == Stdlib.Option.Option.None() - Stdlib.String.fromBytes_v0 ((Stdlib.Base64.decode_v0 "aMM=") |> Builtin.unwrap) = Stdlib.Option.Option.None + Stdlib.String.fromBytes ((Stdlib.Base64.decode "aMM=") |> Builtin.unwrap) + == Stdlib.Option.Option.None() module StartsWith = - Stdlib.String.startsWith_v0 "a string" "a s" = true - Stdlib.String.startsWith_v0 "a string" " s" = false - Stdlib.String.startsWith_v0 "żółw" "żó" = true - Stdlib.String.startsWith_v0 "żółw" "r22" = false - Stdlib.String.startsWith_v0 "👩🏻‍🚀🍇" "🍇" = false - Stdlib.String.startsWith_v0 "123456" "123" = true - Stdlib.String.startsWith_v0 "" "" = true - Stdlib.String.startsWith_v0 "E" "\u0014\u0004" = false + Stdlib.String.startsWith "a string" "a s" == true + Stdlib.String.startsWith "a string" " s" == false + Stdlib.String.startsWith "żółw" "żó" == true + Stdlib.String.startsWith "żółw" "r22" == false + Stdlib.String.startsWith "👩🏻‍🚀🍇" "🍇" == false + Stdlib.String.startsWith "123456" "123" == true + Stdlib.String.startsWith "" "" == true + Stdlib.String.startsWith "E" "\u0014\u0004" == false - Stdlib.String.startsWith_v0 "🧑🏽‍🦰🧑🏼‍💻🧑🏻‍🍼✋✋🏻✋🏿" "🧑🏾‍🦰" = false + Stdlib.String.startsWith "🧑🏽‍🦰🧑🏼‍💻🧑🏻‍🍼✋✋🏻✋🏿" "🧑🏾‍🦰" == false - Stdlib.String.startsWith_v0 "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚" = true + Stdlib.String.startsWith "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚" + == true - Stdlib.String.startsWith_v0 "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" "﷽﷽﷽﷽" = true - Stdlib.String.startsWith_v0 "👱👱🏻👱🏼👱🏽👱🏾👱🏿" "👱🏿" = false - Stdlib.String.startsWith_v0 "🧟‍♀️🧟‍♂️" "🧟‍♂️" = false + Stdlib.String.startsWith "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" "﷽﷽﷽﷽" == true + Stdlib.String.startsWith "👱👱🏻👱🏼👱🏽👱🏾👱🏿" "👱🏿" == false + Stdlib.String.startsWith "🧟‍♀️🧟‍♂️" "🧟‍♂️" == false - Stdlib.String.startsWith_v0 + Stdlib.String.startsWith "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" - "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️" = true + "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️" + == true + + Stdlib.String.startsWith "a string" "" == true + - Stdlib.String.startsWith_v0 "a string" "" = true module EndsWith = - Stdlib.String.endsWith_v0 "a string" "in" = false - Stdlib.String.endsWith_v0 "a string" "ing" = true - Stdlib.String.endsWith_v0 "a string" "" = true - Stdlib.String.endsWith_v0 "żółw" "żó" = false - Stdlib.String.endsWith_v0 "żółw" "łw" = true - Stdlib.String.endsWith_v0 "👩🏻‍🚀🍇" "🍇" = true - Stdlib.String.endsWith_v0 "123456" "56" = true - Stdlib.String.endsWith_v0 "" "" = true - Stdlib.String.endsWith_v0 "E" "\u0014\u0004" = false - Stdlib.String.endsWith_v0 "🧑🏽‍🦰🧑🏼‍💻🧑🏻‍🍼✋✋🏻✋🏿" "✋✋🏿✋🏿" = false + Stdlib.String.endsWith "a string" "in" == false + Stdlib.String.endsWith "a string" "ing" == true + Stdlib.String.endsWith "a string" "" == true + Stdlib.String.endsWith "żółw" "żó" == false + Stdlib.String.endsWith "żółw" "łw" == true + Stdlib.String.endsWith "👩🏻‍🚀🍇" "🍇" == true + Stdlib.String.endsWith "123456" "56" == true + Stdlib.String.endsWith "" "" == true + Stdlib.String.endsWith "E" "\u0014\u0004" == false + Stdlib.String.endsWith "🧑🏽‍🦰🧑🏼‍💻🧑🏻‍🍼✋✋🏻✋🏿" "✋✋🏿✋🏿" == false - Stdlib.String.endsWith_v0 "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" "ǧ̗͚̚o̙̔ͮ̇͐̇" = true + Stdlib.String.endsWith "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" "ǧ̗͚̚o̙̔ͮ̇͐̇" == true - Stdlib.String.endsWith_v0 "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" "12xsd" = false - Stdlib.String.endsWith_v0 "👱👱🏻👱🏼👱🏽👱🏾👱🏿" "﷽" = false - Stdlib.String.endsWith_v0 "🧟‍♀️🧟‍♂️" "🧟‍♀️" = false + Stdlib.String.endsWith "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" "12xsd" == false + Stdlib.String.endsWith "👱👱🏻👱🏼👱🏽👱🏾👱🏿" "﷽" == false + Stdlib.String.endsWith "🧟‍♀️🧟‍♂️" "🧟‍♀️" == false - Stdlib.String.endsWith_v0 "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" "🏳️‍⚧️‍️🇵🇷" = true + Stdlib.String.endsWith "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" "🏳️‍⚧️‍️🇵🇷" + == true module Map = - Stdlib.String.map "a string" (fun x -> x) = "a string" - Stdlib.String.map "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" (fun x -> x) = "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" - Stdlib.String.map "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" (fun x -> x) = "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" - Stdlib.String.map "👱👱🏻👱🏼👱🏽👱🏾👱🏿" (fun x -> x) = "👱👱🏻👱🏼👱🏽👱🏾👱🏿" - Stdlib.String.map "🧟‍♀️🧟‍♂️" (fun x -> x) = "🧟‍♀️🧟‍♂️" + Stdlib.String.map "a string" (fun x -> x) == "a string" + + Stdlib.String.map "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" (fun x -> x) + == "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" + + Stdlib.String.map "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" (fun x -> x) == "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" + + Stdlib.String.map "👱👱🏻👱🏼👱🏽👱🏾👱🏿" (fun x -> x) + == "👱👱🏻👱🏼👱🏽👱🏾👱🏿" - Stdlib.String.map "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" (fun x -> x) = "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" + Stdlib.String.map "🧟‍♀️🧟‍♂️" (fun x -> x) == "🧟‍♀️🧟‍♂️" - Stdlib.String.map "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" (fun x -> 'c') = "cccc" + Stdlib.String.map "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" (fun x -> x) + == "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" - Stdlib.String.map "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" (fun x -> 5L) = Builtin.testDerrorMessage + Stdlib.String.map "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" (fun x -> 'c') == "cccc" + + Stdlib.String.map "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" (fun x -> 5L) + == Builtin.testDerrorMessage """Function return value should be a Char. However, an Int64 (5) was returned instead. Expected: Char @@ -171,463 +204,520 @@ Actual: an Int64: 5""" // Check that map executes the right number of times (let v = Stdlib.String.map "a string" (fun x -> - let _ = Builtin.testIncrementSideEffectCounter_v0 false in 'c') + let _ = Builtin.testIncrementSideEffectCounter false + 'c') + + (v, Builtin.testSideEffectCount ())) + == ("cccccccc", 8L) - (v, Builtin.testSideEffectCount_v0 ())) = ("cccccccc", 8L) module FromChar = - Stdlib.String.fromChar 'a' = "a" - Stdlib.String.fromChar (c "1") = "1" - Stdlib.String.fromChar (c "👩‍👩‍👧‍👦") = "👩‍👩‍👧‍👦" - Stdlib.String.fromChar (c "🏳️‍⚧️‍️") = "🏳️‍⚧️‍️" - Stdlib.String.fromChar (c "👱🏾") = "👱🏾" - Stdlib.String.fromChar (c "Z̤͔ͧ̑̓") = "Z̤͔ͧ̑̓" + Stdlib.String.fromChar 'a' == "a" + Stdlib.String.fromChar (c "1") == "1" + Stdlib.String.fromChar (c "👩‍👩‍👧‍👦") == "👩‍👩‍👧‍👦" + Stdlib.String.fromChar (c "🏳️‍⚧️‍️") == "🏳️‍⚧️‍️" + Stdlib.String.fromChar (c "👱🏾") == "👱🏾" + Stdlib.String.fromChar (c "Z̤͔ͧ̑̓") == "Z̤͔ͧ̑̓" module Base64Decode = - Stdlib.String.base64Decode_v0 "random string" = Stdlib.Result.Result.Error - "Not a valid base64 string" + Stdlib.String.base64Decode "random string" + == Stdlib.Result.Result.Error("Not a valid base64 string") - Stdlib.String.base64Decode_v0 "illegal chars&@:" = Stdlib.Result.Result.Error - "Not a valid base64 string" + Stdlib.String.base64Decode "illegal chars&@:" + == Stdlib.Result.Result.Error("Not a valid base64 string") - Stdlib.String.base64Decode_v0 "Kw" = Stdlib.Result.Result.Ok "+" + Stdlib.String.base64Decode "Kw" == Stdlib.Result.Result.Ok("+") - Stdlib.String.base64Decode_v0 "yLo" = Stdlib.Result.Result.Ok "Ⱥ" + Stdlib.String.base64Decode "yLo" == Stdlib.Result.Result.Ok("Ⱥ") - Stdlib.String.base64Decode_v0 "xbzDs8WCdw" = Stdlib.Result.Result.Ok "żółw" + Stdlib.String.base64Decode "xbzDs8WCdw" == Stdlib.Result.Result.Ok("żółw") - Stdlib.String.base64Decode_v0 "LyotKygmQDk4NTIx" = Stdlib.Result.Result.Ok - "/*-+(&@98521" + Stdlib.String.base64Decode "LyotKygmQDk4NTIx" + == Stdlib.Result.Result.Ok("/*-+(&@98521") - Stdlib.String.base64Decode_v0 "" = Stdlib.Result.Result.Ok "" // empty case + Stdlib.String.base64Decode "" == Stdlib.Result.Result.Ok("") // empty case // Test cases from the spec with padding added - Stdlib.String.base64Decode_v0 "Zg" = Stdlib.Result.Result.Ok "f" + Stdlib.String.base64Decode "Zg" == Stdlib.Result.Result.Ok("f") - Stdlib.String.base64Decode_v0 "Zg==" = Stdlib.Result.Result.Ok "f" + Stdlib.String.base64Decode "Zg==" == Stdlib.Result.Result.Ok("f") - Stdlib.String.base64Decode_v0 "Zm8" = Stdlib.Result.Result.Ok "fo" + Stdlib.String.base64Decode "Zm8" == Stdlib.Result.Result.Ok("fo") - Stdlib.String.base64Decode_v0 "Zm8=" = Stdlib.Result.Result.Ok "fo" + Stdlib.String.base64Decode "Zm8=" == Stdlib.Result.Result.Ok("fo") - Stdlib.String.base64Decode_v0 "Zm9v" = Stdlib.Result.Result.Ok "foo" + Stdlib.String.base64Decode "Zm9v" == Stdlib.Result.Result.Ok("foo") - Stdlib.String.base64Decode_v0 "Zm9vYg" = Stdlib.Result.Result.Ok "foob" + Stdlib.String.base64Decode "Zm9vYg" == Stdlib.Result.Result.Ok("foob") - Stdlib.String.base64Decode_v0 "Zm9vYg==" = Stdlib.Result.Result.Ok "foob" + Stdlib.String.base64Decode "Zm9vYg==" == Stdlib.Result.Result.Ok("foob") - Stdlib.String.base64Decode_v0 "Zm9vYmE" = Stdlib.Result.Result.Ok "fooba" + Stdlib.String.base64Decode "Zm9vYmE" == Stdlib.Result.Result.Ok("fooba") - Stdlib.String.base64Decode_v0 "Zm9vYmE=" = Stdlib.Result.Result.Ok "fooba" + Stdlib.String.base64Decode "Zm9vYmE=" == Stdlib.Result.Result.Ok("fooba") - Stdlib.String.base64Decode_v0 "Zm9vYmFy" = Stdlib.Result.Result.Ok "foobar" + Stdlib.String.base64Decode "Zm9vYmFy" == Stdlib.Result.Result.Ok("foobar") // "Impossible cases" from apache // https://commons.apache.org/proper/commons-codec/xref-test/org/apache/commons/codec/binary/Base64Test.html - Stdlib.String.base64Decode_v0 "ZE==" = Stdlib.Result.Result.Ok "d" + Stdlib.String.base64Decode "ZE==" == Stdlib.Result.Result.Ok("d") - Stdlib.String.base64Decode_v0 "ZmC=" = Stdlib.Result.Result.Ok "f`" + Stdlib.String.base64Decode "ZmC=" == Stdlib.Result.Result.Ok("f`") - Stdlib.String.base64Decode_v0 "Zm9vYE==" = Stdlib.Result.Result.Ok "foo`" + Stdlib.String.base64Decode "Zm9vYE==" == Stdlib.Result.Result.Ok("foo`") - Stdlib.String.base64Decode_v0 "Zm9vYmC=" = Stdlib.Result.Result.Ok "foob`" + Stdlib.String.base64Decode "Zm9vYmC=" == Stdlib.Result.Result.Ok("foob`") - Stdlib.String.base64Decode_v0 - "ZnJvbT0wNi8wNy8yMDEzIHF1ZXJ5PSLOms6xzrvPjs-CIM6_z4HOr8-DzrHPhM61Ig" = Stdlib.Result.Result.Ok - "from=06/07/2013 query=\"Καλώς ορίσατε\"" + Stdlib.String.base64Decode + "ZnJvbT0wNi8wNy8yMDEzIHF1ZXJ5PSLOms6xzrvPjs-CIM6_z4HOr8-DzrHPhM61Ig" + == Stdlib.Result.Result.Ok("from=06/07/2013 query=\"Καλώς ορίσατε\"") - Stdlib.String.base64Decode_v0 - "8J-RsfCfkbHwn4-78J-RsfCfj7zwn5Gx8J-PvfCfkbHwn4--8J-RsfCfj78" = Stdlib.Result.Result.Ok - "👱👱🏻👱🏼👱🏽👱🏾👱🏿" + Stdlib.String.base64Decode + "8J-RsfCfkbHwn4-78J-RsfCfj7zwn5Gx8J-PvfCfkbHwn4--8J-RsfCfj78" + == Stdlib.Result.Result.Ok("👱👱🏻👱🏼👱🏽👱🏾👱🏿") - Stdlib.String.base64Decode_v0 "-p" = Stdlib.Result.Result.Error - "Invalid UTF-8 string" + Stdlib.String.base64Decode "-p" + == Stdlib.Result.Result.Error("Invalid UTF-8 string") - Stdlib.String.base64Decode_v0 "lI" = Stdlib.Result.Result.Error - "Invalid UTF-8 string" + Stdlib.String.base64Decode "lI" + == Stdlib.Result.Result.Error("Invalid UTF-8 string") - Stdlib.String.base64Decode_v0 "5Sk" = Stdlib.Result.Result.Error - "Invalid UTF-8 string" + Stdlib.String.base64Decode "5Sk" + == Stdlib.Result.Result.Error("Invalid UTF-8 string") module Base64UrlEncode = - Stdlib.String.base64UrlEncode_v0 "+" = "Kw" - Stdlib.String.base64UrlEncode_v0 "Ⱥ" = "yLo" - Stdlib.String.base64UrlEncode_v0 "żółw" = "xbzDs8WCdw" - Stdlib.String.base64UrlEncode_v0 "/*-+(&@98521" = "LyotKygmQDk4NTIx" - Stdlib.String.base64UrlEncode_v0 "" = "" - Stdlib.String.base64UrlEncode_v0 "f" = "Zg" - Stdlib.String.base64UrlEncode_v0 "fo" = "Zm8" - Stdlib.String.base64UrlEncode_v0 "foo" = "Zm9v" - Stdlib.String.base64UrlEncode_v0 "foob" = "Zm9vYg" - Stdlib.String.base64UrlEncode_v0 "fooba" = "Zm9vYmE" - Stdlib.String.base64UrlEncode_v0 "foobar" = "Zm9vYmFy" - Stdlib.String.base64UrlEncode_v0 "Hello World" = "SGVsbG8gV29ybGQ" + Stdlib.String.base64UrlEncode "+" == "Kw" + Stdlib.String.base64UrlEncode "Ⱥ" == "yLo" + Stdlib.String.base64UrlEncode "żółw" == "xbzDs8WCdw" + Stdlib.String.base64UrlEncode "/*-+(&@98521" == "LyotKygmQDk4NTIx" + Stdlib.String.base64UrlEncode "" == "" + Stdlib.String.base64UrlEncode "f" == "Zg" + Stdlib.String.base64UrlEncode "fo" == "Zm8" + Stdlib.String.base64UrlEncode "foo" == "Zm9v" + Stdlib.String.base64UrlEncode "foob" == "Zm9vYg" + Stdlib.String.base64UrlEncode "fooba" == "Zm9vYmE" + Stdlib.String.base64UrlEncode "foobar" == "Zm9vYmFy" + Stdlib.String.base64UrlEncode "Hello World" == "SGVsbG8gV29ybGQ" + + Stdlib.String.base64UrlEncode "from=06/07/2013 query=\"Καλώς ορίσατε\"" + == "ZnJvbT0wNi8wNy8yMDEzIHF1ZXJ5PSLOms6xzrvPjs-CIM6_z4HOr8-DzrHPhM61Ig" + + Stdlib.String.base64UrlEncode "👱👱🏻👱🏼👱🏽👱🏾👱🏿" + == "8J-RsfCfkbHwn4-78J-RsfCfj7zwn5Gx8J-PvfCfkbHwn4--8J-RsfCfj78" - Stdlib.String.base64UrlEncode_v0 "from=06/07/2013 query=\"Καλώς ορίσατε\"" = "ZnJvbT0wNi8wNy8yMDEzIHF1ZXJ5PSLOms6xzrvPjs-CIM6_z4HOr8-DzrHPhM61Ig" - Stdlib.String.base64UrlEncode_v0 "👱👱🏻👱🏼👱🏽👱🏾👱🏿" = "8J-RsfCfkbHwn4-78J-RsfCfj7zwn5Gx8J-PvfCfkbHwn4--8J-RsfCfj78" +module Base64Encode = + Stdlib.String.base64Encode "+" == "Kw==" + Stdlib.String.base64Encode "Ⱥ" == "yLo=" + Stdlib.String.base64Encode "żółw" == "xbzDs8WCdw==" + Stdlib.String.base64Encode "/*-+(&@98521" == "LyotKygmQDk4NTIx" + Stdlib.String.base64Encode "" == "" + Stdlib.String.base64Encode "f" == "Zg==" + Stdlib.String.base64Encode "fo" == "Zm8=" + Stdlib.String.base64Encode "foo" == "Zm9v" + Stdlib.String.base64Encode "foob" == "Zm9vYg==" + Stdlib.String.base64Encode "fooba" == "Zm9vYmE=" + Stdlib.String.base64Encode "foobar" == "Zm9vYmFy" + Stdlib.String.base64Encode "Hello World" == "SGVsbG8gV29ybGQ=" + + Stdlib.String.base64Encode "from=06/07/2013 query=\"Καλώς ορίσατε\"" + == "ZnJvbT0wNi8wNy8yMDEzIHF1ZXJ5PSLOms6xzrvPjs+CIM6/z4HOr8+DzrHPhM61Ig==" + + Stdlib.String.base64Encode "👱👱🏻👱🏼👱🏽👱🏾👱🏿" + == "8J+RsfCfkbHwn4+78J+RsfCfj7zwn5Gx8J+PvfCfkbHwn4++8J+RsfCfj78=" -module Base64Encode = - Stdlib.String.base64Encode_v0 "+" = "Kw==" - Stdlib.String.base64Encode_v0 "Ⱥ" = "yLo=" - Stdlib.String.base64Encode_v0 "żółw" = "xbzDs8WCdw==" - Stdlib.String.base64Encode_v0 "/*-+(&@98521" = "LyotKygmQDk4NTIx" - Stdlib.String.base64Encode_v0 "" = "" - Stdlib.String.base64Encode_v0 "f" = "Zg==" - Stdlib.String.base64Encode_v0 "fo" = "Zm8=" - Stdlib.String.base64Encode_v0 "foo" = "Zm9v" - Stdlib.String.base64Encode_v0 "foob" = "Zm9vYg==" - Stdlib.String.base64Encode_v0 "fooba" = "Zm9vYmE=" - Stdlib.String.base64Encode_v0 "foobar" = "Zm9vYmFy" - Stdlib.String.base64Encode_v0 "Hello World" = "SGVsbG8gV29ybGQ=" +module Digest = + Stdlib.String.digest "" + == "OLBgp1GsljhM2TJ-sbHjaiH9txEUvgdDTAzHv2P24donTt6_529l-9Ua0vFImLlb" - Stdlib.String.base64Encode_v0 "from=06/07/2013 query=\"Καλώς ορίσατε\"" = "ZnJvbT0wNi8wNy8yMDEzIHF1ZXJ5PSLOms6xzrvPjs+CIM6/z4HOr8+DzrHPhM61Ig==" + Stdlib.String.digest "😄" + == "Z2Y7YuyYHR9miKrg6mLtxSTaHRpGZuaenmGQl3QFY58pwhPCK2bIYxJQ728ChJwA" - Stdlib.String.base64Encode_v0 "👱👱🏻👱🏼👱🏽👱🏾👱🏿" = "8J+RsfCfkbHwn4+78J+RsfCfj7zwn5Gx8J+PvfCfkbHwn4++8J+RsfCfj78=" + Stdlib.String.digest "ελπίδα" + == "j4uJEeBe6g8QrzbuxoI2roUgapGQiExE8CWEQqZao61eZVN1iSZ8cV39IM1nGqsa" + Stdlib.String.digest "/*-+(&@98521" + == "wSGXFkLMpPufNoF2mUBAjT4YlUEb9cl0Iliy4qohwt1XFpg51PRJVTWndn5PewSr" -module Digest = - Stdlib.String.digest_v0 "" = "OLBgp1GsljhM2TJ-sbHjaiH9txEUvgdDTAzHv2P24donTt6_529l-9Ua0vFImLlb" - Stdlib.String.digest_v0 "😄" = "Z2Y7YuyYHR9miKrg6mLtxSTaHRpGZuaenmGQl3QFY58pwhPCK2bIYxJQ728ChJwA" - Stdlib.String.digest_v0 "ελπίδα" = "j4uJEeBe6g8QrzbuxoI2roUgapGQiExE8CWEQqZao61eZVN1iSZ8cV39IM1nGqsa" - Stdlib.String.digest_v0 "/*-+(&@98521" = "wSGXFkLMpPufNoF2mUBAjT4YlUEb9cl0Iliy4qohwt1XFpg51PRJVTWndn5PewSr" - Stdlib.String.digest_v0 "👩🏻‍🚀🍇" = "hVrNUSbFOfYXwZe6zQRUFFfGPe90qr-aROG2n-hMk8kAC-xodOyHOqecLWb9HIKJ" - Stdlib.String.digest_v0 "🧑🏽‍🦰🧑🏼‍💻🧑🏻‍🍼✋✋🏻✋🏿" = "7Fo0ImavUzoUM_9kdjucgh6pYAHk5VovpTOUObvxacS31QoCTkcE4rpcQbJJpshE" - Stdlib.String.digest_v0 "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" = "U2v72uGbUR_UIiD5qF6L21pKzYi4B6OB76HGtbpM0o-2_4YB3ytPjJ7w9png3L9k" - Stdlib.String.digest_v0 "👱👱🏻👱🏼👱🏽👱🏾👱🏿" = "c1Wm67axXlBaejcJZxct80MvexdTtyyrTK9J9-_4RqgP1pf4Bk9SoMZpsnXpvLIx" - Stdlib.String.digest_v0 "🧟‍♀️🧟‍♂️" = "FBnrDureCzgPeGP9qOuW1BIiF2Wz5WejO5XtJWa81qCxcD6cZ4A_WAB0ZJzhOErc" - Stdlib.String.digest_v0 "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" = "3QFqrhTPpxeje6XUNObFt2eJZZ1t0pAcX42AFdFVv42hco0bTOopQK3py4KMBT0m" + Stdlib.String.digest "👩🏻‍🚀🍇" + == "hVrNUSbFOfYXwZe6zQRUFFfGPe90qr-aROG2n-hMk8kAC-xodOyHOqecLWb9HIKJ" + + Stdlib.String.digest "🧑🏽‍🦰🧑🏼‍💻🧑🏻‍🍼✋✋🏻✋🏿" + == "7Fo0ImavUzoUM_9kdjucgh6pYAHk5VovpTOUObvxacS31QoCTkcE4rpcQbJJpshE" + + Stdlib.String.digest "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" + == "U2v72uGbUR_UIiD5qF6L21pKzYi4B6OB76HGtbpM0o-2_4YB3ytPjJ7w9png3L9k" + + Stdlib.String.digest "👱👱🏻👱🏼👱🏽👱🏾👱🏿" + == "c1Wm67axXlBaejcJZxct80MvexdTtyyrTK9J9-_4RqgP1pf4Bk9SoMZpsnXpvLIx" + + Stdlib.String.digest "🧟‍♀️🧟‍♂️" + == "FBnrDureCzgPeGP9qOuW1BIiF2Wz5WejO5XtJWa81qCxcD6cZ4A_WAB0ZJzhOErc" + + Stdlib.String.digest "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" + == "3QFqrhTPpxeje6XUNObFt2eJZZ1t0pAcX42AFdFVv42hco0bTOopQK3py4KMBT0m" module Random = - (Stdlib.String.random 5L) == (Stdlib.String.random 5L) = false + (Stdlib.String.random 5L) == (Stdlib.String.random 5L) == false - Stdlib.String.random -1L = Stdlib.Result.Result.Error - "Expected `length` to be positive, but it was `-1`" + Stdlib.String.random -1L + == Stdlib.Result.Result.Error("Expected `length` to be positive, but it was `-1`") - Stdlib.String.length ((Stdlib.String.random 10L) |> Builtin.unwrap) = 10L + Stdlib.String.length ((Stdlib.String.random 10L) |> Builtin.unwrap) == 10L - Stdlib.String.length ((Stdlib.String.random 5L) |> Builtin.unwrap) = 5L + Stdlib.String.length ((Stdlib.String.random 5L) |> Builtin.unwrap) == 5L - Stdlib.String.length ((Stdlib.String.random 0L) |> Builtin.unwrap) = 0L + Stdlib.String.length ((Stdlib.String.random 0L) |> Builtin.unwrap) == 0L module HtmlEscape = - Stdlib.String.htmlEscape_v0 "test<>&\"" = "test<>&"" // HTML escaping works reasonably + Stdlib.String.htmlEscape "test<>&\"" == "test<>&"" // HTML escaping works reasonably + + Stdlib.String.htmlEscape + "

          This is f#

          " + == "<html><head></head><body><h1>This is f#</h1></body></html>" // HTML escaping works reasonably + + // show this change to stachu + Stdlib.String.htmlEscape + "" + == "<html><head><!-- head definitions go here --></head><body><!-- the content goes here --></body></html>" - Stdlib.String.htmlEscape_v0 - "

          This is f#

          " = "<html><head></head><body><h1>This is f#</h1></body></html>" // HTML escaping works reasonably + Stdlib.String.htmlEscape "" == "" + Stdlib.String.htmlEscape "😄" == "😄" - Stdlib.String.htmlEscape_v0 - "" = "<html><head><!-- head definitions go here --></head><body><!-- the content goes here --></body></html>" + Stdlib.String.htmlEscape "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" + == "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" - Stdlib.String.htmlEscape_v0 "" = "" - Stdlib.String.htmlEscape_v0 "😄" = "😄" - Stdlib.String.htmlEscape_v0 "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" = "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" + Stdlib.String.htmlEscape "

          ﷽﷽﷽﷽﷽

          " + == "<html><head></head><body><h1>﷽﷽﷽﷽﷽</h1></body></html>" - Stdlib.String.htmlEscape_v0 "

          ﷽﷽﷽﷽﷽

          " = "<html><head></head><body><h1>﷽﷽﷽﷽﷽</h1></body></html>" + Stdlib.String.htmlEscape "🧟‍♀️🧟‍♂️" + == "<head>🧟‍♀️🧟‍♂️</head>" - Stdlib.String.htmlEscape_v0 "🧟‍♀️🧟‍♂️" = "<head>🧟‍♀️🧟‍♂️</head>" - Stdlib.String.htmlEscape_v0 "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" = "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" + Stdlib.String.htmlEscape "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" + == "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" module IsEmpty = - Stdlib.String.isEmpty_v0 "" = true - Stdlib.String.isEmpty_v0 "a" = false - Stdlib.String.isEmpty_v0 "🧑🏼‍💻🧑🏻‍🍼" = false - Stdlib.String.isEmpty_v0 "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" = false - Stdlib.String.isEmpty_v0 "﷽﷽﷽﷽﷽" = false - Stdlib.String.isEmpty_v0 "👱👱🏻👱🏼👱🏽👱🏾👱🏿" = false - Stdlib.String.isEmpty_v0 "🧟‍♀️🧟‍♂️" = false - Stdlib.String.isEmpty_v0 "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" = false + Stdlib.String.isEmpty "" == true + Stdlib.String.isEmpty "a" == false + Stdlib.String.isEmpty "🧑🏼‍💻🧑🏻‍🍼" == false + Stdlib.String.isEmpty "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" == false + Stdlib.String.isEmpty "﷽﷽﷽﷽﷽" == false + Stdlib.String.isEmpty "👱👱🏻👱🏼👱🏽👱🏾👱🏿" == false + Stdlib.String.isEmpty "🧟‍♀️🧟‍♂️" == false + Stdlib.String.isEmpty "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" == false module NewLine = - Stdlib.String.newline = "\n" + Stdlib.String.newline == "\n" module Length = - Stdlib.String.length "😄" = 1L - Stdlib.String.length "" = 0L - Stdlib.String.length "abcdef" = 6L - Stdlib.String.length "🧑🏽‍🦰🧑🏼‍💻🧑🏻‍🍼✋✋🏻✋🏿" = 6L - Stdlib.String.length "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" = 5L - Stdlib.String.length "﷽﷽﷽﷽﷽" = 5L - Stdlib.String.length "👱👱🏻👱🏼👱🏽👱🏾👱🏿" = 6L - Stdlib.String.length "🧟‍♀️🧟‍♂️" = 2L - Stdlib.String.length "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" = 4L + Stdlib.String.length "😄" == 1L + Stdlib.String.length "" == 0L + Stdlib.String.length "abcdef" == 6L + Stdlib.String.length "🧑🏽‍🦰🧑🏼‍💻🧑🏻‍🍼✋✋🏻✋🏿" == 6L + Stdlib.String.length "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" == 5L + Stdlib.String.length "﷽﷽﷽﷽﷽" == 5L + Stdlib.String.length "👱👱🏻👱🏼👱🏽👱🏾👱🏿" == 6L + Stdlib.String.length "🧟‍♀️🧟‍♂️" == 2L + Stdlib.String.length "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" == 4L module Prepend = - Stdlib.String.prepend_v0 "hello" "world" = "worldhello" // Stdlib.String.prepend works for ASCII range - Stdlib.String.prepend_v0 "hello" "" = "hello" - Stdlib.String.prepend_v0 "" "hello" = "hello" - Stdlib.String.prepend_v0 "żółw" "😄" = "😄żółw" // Stdlib.String.prepend works on non-ascii strings - Stdlib.String.prepend_v0 "123" "456" = "456123" - Stdlib.String.prepend_v0 "óñÜá" "abc" = "abcóñÜá" - Stdlib.String.prepend_v0 "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" "Z̤͔ͧ̑̓" = "Z̤͔ͧ̑̓Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" - Stdlib.String.prepend_v0 "﷽﷽﷽﷽﷽" "👨‍❤️‍💋‍👨" = "👨‍❤️‍💋‍👨﷽﷽﷽﷽﷽" - Stdlib.String.prepend_v0 "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" "﷽﷽" = "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" - Stdlib.String.prepend_v0 "👱👱🏻👱🏼👱🏽👱🏾👱🏿" "✋🏻" = "✋🏻👱👱🏻👱🏼👱🏽👱🏾👱🏿" - Stdlib.String.prepend_v0 "🧟‍♀️🧟‍♂️" "🧟‍♂️" = "🧟‍♂️🧟‍♀️🧟‍♂️" + Stdlib.String.prepend "hello" "world" == "worldhello" // Stdlib.String.prepend works for ASCII range + Stdlib.String.prepend "hello" "" == "hello" + Stdlib.String.prepend "" "hello" == "hello" + Stdlib.String.prepend "żółw" "😄" == "😄żółw" // Stdlib.String.prepend works on non-ascii strings + Stdlib.String.prepend "123" "456" == "456123" + Stdlib.String.prepend "óñÜá" "abc" == "abcóñÜá" + + Stdlib.String.prepend "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" "Z̤͔ͧ̑̓" + == "Z̤͔ͧ̑̓Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" + + Stdlib.String.prepend "﷽﷽﷽﷽﷽" "👨‍❤️‍💋‍👨" == "👨‍❤️‍💋‍👨﷽﷽﷽﷽﷽" + Stdlib.String.prepend "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" "﷽﷽" == "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" + + Stdlib.String.prepend "👱👱🏻👱🏼👱🏽👱🏾👱🏿" "✋🏻" + == "✋🏻👱👱🏻👱🏼👱🏽👱🏾👱🏿" - Stdlib.String.prepend_v0 "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" "👨‍❤️‍💋‍👨" = "👨‍❤️‍💋‍👨👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" + Stdlib.String.prepend "🧟‍♀️🧟‍♂️" "🧟‍♂️" == "🧟‍♂️🧟‍♀️🧟‍♂️" - Stdlib.String.prepend_v0 "żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" "🧟‍♂️" = "🧟‍♂️żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" + Stdlib.String.prepend "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" "👨‍❤️‍💋‍👨" + == "👨‍❤️‍💋‍👨👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" + + Stdlib.String.prepend "żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" "🧟‍♂️" + == "🧟‍♂️żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" module ReplaceAll = - Stdlib.String.replaceAll_v0 "abcABCcbaCBA" "b" "x" = "axcABCcxaCBA" - Stdlib.String.replaceAll_v0 "abcABCcbaCBA" "" "x" = "xaxbxcxAxBxCxcxbxaxCxBxAx" - Stdlib.String.replaceAll_v0 "" "" "&" = "&" - Stdlib.String.replaceAll_v0 "abcABCcbaCBA" "b" "" = "acABCcaCBA" + Stdlib.String.replaceAll "abcABCcbaCBA" "b" "x" == "axcABCcxaCBA" + Stdlib.String.replaceAll "abcABCcbaCBA" "" "x" == "xaxbxcxAxBxCxcxbxaxCxBxAx" + Stdlib.String.replaceAll "" "" "&" == "&" + Stdlib.String.replaceAll "abcABCcbaCBA" "b" "" == "acABCcaCBA" + + Stdlib.String.replaceAll "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" "ä͖̭̈̇" "$" + == "Z̤͔ͧ̑̓$lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" - Stdlib.String.replaceAll_v0 "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" "ä͖̭̈̇" "$" = "Z̤͔ͧ̑̓$lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" + Stdlib.String.replaceAll "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" "﷽﷽" "$" == "$$$$$$$$" - Stdlib.String.replaceAll_v0 "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" "﷽﷽" "$" = "$$$$$$$$" - Stdlib.String.replaceAll_v0 "👱👱🏻👱🏼👱🏽👱🏾👱🏿" "👱🏽" "✋🏻" = "👱👱🏻👱🏼✋🏻👱🏾👱🏿" - Stdlib.String.replaceAll_v0 "🧟‍♀️🧟‍♂️" "🧟‍♂️" "🧑🏽‍🦰" = "🧟‍♀️🧑🏽‍🦰" + Stdlib.String.replaceAll "👱👱🏻👱🏼👱🏽👱🏾👱🏿" "👱🏽" "✋🏻" + == "👱👱🏻👱🏼✋🏻👱🏾👱🏿" - Stdlib.String.replaceAll_v0 + Stdlib.String.replaceAll "🧟‍♀️🧟‍♂️" "🧟‍♂️" "🧑🏽‍🦰" == "🧟‍♀️🧑🏽‍🦰" + + Stdlib.String.replaceAll "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" "👨‍❤️‍💋‍👨" - "👨‍❤️‍💋‍👨" = "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" + "👨‍❤️‍💋‍👨" + == "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" - Stdlib.String.replaceAll_v0 "żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" "🧑🏻‍🍼" "🧟‍♂️" = "żółw🧑🏽‍🦰🧟‍♂️✋✋🏻✋🏿" + Stdlib.String.replaceAll "żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" "🧑🏻‍🍼" "🧟‍♂️" + == "żółw🧑🏽‍🦰🧟‍♂️✋✋🏻✋🏿" module Slugify = Builtin.stringSlugify - " M@y 'super' Really- exce+llent *Uber_ ama\"zing* ~very 5x5 ~ \"clever\" thing: coffee😭!" = "my-super-really-excellent-uber-amazing-very-5x5-clever-thing-coffee" + " M@y 'super' Really- exce+llent *Uber_ ama\"zing* ~very 5x5 ~ \"clever\" thing: coffee😭!" + == "my-super-really-excellent-uber-amazing-very-5x5-clever-thing-coffee" Builtin.stringSlugify - " m@y 'super' really- excellent *uber_ amazing* ~very ~ \"clever\" thing: coffee😭!" = "my-super-really-excellent-uber-amazing-very-clever-thing-coffee" - - Builtin.stringSlugify "" = "" - Builtin.stringSlugify "ABCD-45646sassa" = "abcd-45646sassa" - Builtin.stringSlugify "ddsd516ds125sd12sd12Ü" = "ddsd516ds125sd12sd12" - Builtin.stringSlugify "q=\u0002$\u001a<+MC" = "qmc" - Builtin.stringSlugify "🎁🎄Ǣʚ231" = "231" - Builtin.stringSlugify "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" = "" - Builtin.stringSlugify "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" = "zlo" - Builtin.stringSlugify "👱👱🏻👱🏼👱🏽👱🏾👱🏿" = "" - Builtin.stringSlugify "🧟‍♀️🧟‍♂️" = "" - Builtin.stringSlugify "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" = "" + " m@y 'super' really- excellent *uber_ amazing* ~very ~ \"clever\" thing: coffee😭!" + == "my-super-really-excellent-uber-amazing-very-clever-thing-coffee" + + Builtin.stringSlugify "" == "" + Builtin.stringSlugify "ABCD-45646sassa" == "abcd-45646sassa" + Builtin.stringSlugify "ddsd516ds125sd12sd12Ü" == "ddsd516ds125sd12sd12" + Builtin.stringSlugify "q=\u0002$\u001a<+MC" == "qmc" + Builtin.stringSlugify "🎁🎄Ǣʚ231" == "231" + Builtin.stringSlugify "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" == "" + Builtin.stringSlugify "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" == "zlo" + Builtin.stringSlugify "👱👱🏻👱🏼👱🏽👱🏾👱🏿" == "" + Builtin.stringSlugify "🧟‍♀️🧟‍♂️" == "" + Builtin.stringSlugify "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" == "" Builtin.stringSlugify - "b\x01c\x02d\x03e\x04f\x05g\x06h\x07i\x08j\x09k\x0Al\x0Bm\x0Cn\x0Do\x0Ep\x0Fq" = "bcdefghij-k-lm-n-opq" + "b\x01c\x02d\x03e\x04f\x05g\x06h\x07i\x08j\x09k\x0Al\x0Bm\x0Cn\x0Do\x0Ep\x0Fq" + == "bcdefghij-k-lm-n-opq" Builtin.stringSlugify - "a\x10b\x11c\x12d\x13e\x14f\x15g\x16h\x17i\x18j\x19k\x1Al\x1Bm\x1Cn\x1Do\x1Ep\x1Fq" = "abcdefghijklmnopq" + "a\x10b\x11c\x12d\x13e\x14f\x15g\x16h\x17i\x18j\x19k\x1Al\x1Bm\x1Cn\x1Do\x1Ep\x1Fq" + == "abcdefghijklmnopq" - Builtin.stringSlugify "!\"#$%&'()*+,-./" = "-" - Builtin.stringSlugify ":;<=>?@" = "" - Builtin.stringSlugify "[\\]^_`" = "-" - Builtin.stringSlugify "{|}~\x7F" = "" + Builtin.stringSlugify "!\"#$%&'()*+,-./" == "-" + Builtin.stringSlugify ":;<=>?@" == "" + Builtin.stringSlugify "[\\]^_`" == "-" + Builtin.stringSlugify "{|}~\x7F" == "" module FromList = - Stdlib.String.fromList [] = "" - Stdlib.String.fromList [ c "a" ] = "a" + Stdlib.String.fromList [] == "" + Stdlib.String.fromList [ c "a" ] == "a" - Stdlib.String.fromList [ c "👩‍👩‍👧‍👦"; c "🏳️‍⚧️‍️"; c "👱🏾"; c "Z̤͔ͧ̑̓" ] = "👩‍👩‍👧‍👦🏳️‍⚧️‍️👱🏾Z̤͔ͧ̑̓" + Stdlib.String.fromList [ c "👩‍👩‍👧‍👦"; c "🏳️‍⚧️‍️"; c "👱🏾"; c "Z̤͔ͧ̑̓" ] + == "👩‍👩‍👧‍👦🏳️‍⚧️‍️👱🏾Z̤͔ͧ̑̓" - Stdlib.String.fromList [ "a" ] = Builtin.testDerrorMessage - "PACKAGE.Darklang.Stdlib.String.fromList's 1st argument (`lst`) should be a List. However, a List ([ \"a\"]) was passed instead. + Stdlib.String.fromList [ "a" ] + == Builtin.testDerrorMessage + """PACKAGE.Darklang.Stdlib.String.fromList's 1st argument (`lst`) should be a List. However, a List ([ \"a\"]) was passed instead. Expected: (lst: List) -Actual: a List: [\n \"a\"\n]" +Actual: a List: [\n \"a\"\n]""" module ToList = - Stdlib.String.toList "" = [] - Stdlib.String.toList "ab" = [ 'a'; 'b' ] - Stdlib.String.toList "👨‍👩‍👧‍👦" = [ c "👨‍👩‍👧‍👦" ] - - Stdlib.String.toList "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" = [ (c "Z̤͔ͧ̑̓") - (c "ä͖̭̈̇") - (c "lͮ̒ͫ") - (c "ǧ̗͚̚") - (c "o̙̔ͮ̇͐̇") ] - - - Stdlib.String.toList "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" = [ (c "﷽") - (c "﷽") - (c "﷽") - (c "﷽") - (c "﷽") - (c "﷽") - (c "﷽") - (c "﷽") - (c "﷽") - (c "﷽") - (c "﷽") - (c "﷽") - (c "﷽") - (c "﷽") - (c "﷽") - (c "﷽") ] - - Stdlib.String.toList "🧟‍♀️🧟‍♂️" = [ c "🧟‍♀️"; c "🧟‍♂️" ] - - Stdlib.String.toList "👱👱🏻👱🏼👱🏽👱🏾👱🏿" = [ (c "👱") - (c "👱🏻") - (c "👱🏼") - (c "👱🏽") - (c "👱🏾") - (c "👱🏿") ] - - - Stdlib.String.toList "żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" = [ (c "ż") - (c "ó") - (c "ł") - (c "w") - (c "🧑🏽‍🦰") - (c "🧑🏻‍🍼") - (c "✋") - (c "✋🏻") - (c "✋🏿") ] - - ("ab1" |> Stdlib.String.toList |> Stdlib.String.fromList) = "ab1" - - ("@Ǣá1" |> Stdlib.String.toList |> Stdlib.String.fromList) = "@Ǣá1" + Stdlib.String.toList "" == [] + Stdlib.String.toList "ab" == [ 'a'; 'b' ] + Stdlib.String.toList "👨‍👩‍👧‍👦" == [ c "👨‍👩‍👧‍👦" ] + + Stdlib.String.toList "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" + == [ (c "Z̤͔ͧ̑̓") (c "ä͖̭̈̇") (c "lͮ̒ͫ") (c "ǧ̗͚̚") (c "o̙̔ͮ̇͐̇") ] + + + Stdlib.String.toList "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" + == [ (c "﷽") + (c "﷽") + (c "﷽") + (c "﷽") + (c "﷽") + (c "﷽") + (c "﷽") + (c "﷽") + (c "﷽") + (c "﷽") + (c "﷽") + (c "﷽") + (c "﷽") + (c "﷽") + (c "﷽") + (c "﷽") ] + + Stdlib.String.toList "🧟‍♀️🧟‍♂️" == [ c "🧟‍♀️"; c "🧟‍♂️" ] + + Stdlib.String.toList "👱👱🏻👱🏼👱🏽👱🏾👱🏿" + == [ (c "👱") (c "👱🏻") (c "👱🏼") (c "👱🏽") (c "👱🏾") (c "👱🏿") ] + + + Stdlib.String.toList "żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" + == [ (c "ż") + (c "ó") + (c "ł") + (c "w") + (c "🧑🏽‍🦰") + (c "🧑🏻‍🍼") + (c "✋") + (c "✋🏻") + (c "✋🏿") ] + + ("ab1" |> Stdlib.String.toList |> Stdlib.String.fromList) == "ab1" + + ("@Ǣá1" |> Stdlib.String.toList |> Stdlib.String.fromList) == "@Ǣá1" ("👩‍👩‍👧‍👦🏳️‍⚧️‍️👱🏾Z̤͔ͧ̑̓" |> Stdlib.String.toList - |> Stdlib.String.fromList) = "👩‍👩‍👧‍👦🏳️‍⚧️‍️👱🏾Z̤͔ͧ̑̓" + |> Stdlib.String.fromList) + == "👩‍👩‍👧‍👦🏳️‍⚧️‍️👱🏾Z̤͔ͧ̑̓" module Split = - Stdlib.String.split "hello world" "notfound" = [ "hello world" ] - Stdlib.String.split "hello😄world" "😄" = [ "hello"; "world" ] - Stdlib.String.split "hello&&&&world" "&&&&" = [ "hello"; "world" ] - Stdlib.String.split "hello34564world34564sun" "😄" = [ "hello34564world34564sun" ] + Stdlib.String.split "hello world" "notfound" == [ "hello world" ] + Stdlib.String.split "hello😄world" "😄" == [ "hello"; "world" ] + Stdlib.String.split "hello&&&&world" "&&&&" == [ "hello"; "world" ] - Stdlib.String.split "hello34564world34564sun" "34564" = [ "hello"; "world"; "sun" ] + Stdlib.String.split "hello34564world34564sun" "😄" + == [ "hello34564world34564sun" ] - Stdlib.String.split "" "34564" = [ "" ] - Stdlib.String.split "34564" "" = [ "3"; "4"; "5"; "6"; "4" ] + Stdlib.String.split "hello34564world34564sun" "34564" + == [ "hello"; "world"; "sun" ] - Stdlib.String.split "🧑🏽‍🦰🧑🏼‍💻🧑🏻‍🍼✋✋🏻✋🏿" "🧑🏻‍🍼" = [ "🧑🏽‍🦰🧑🏼‍💻" - "✋✋🏻✋🏿" ] + Stdlib.String.split "" "34564" == [ "" ] + Stdlib.String.split "34564" "" == [ "3"; "4"; "5"; "6"; "4" ] - // Stdlib.String.split "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" = [ "" - // "" ] + Stdlib.String.split "🧑🏽‍🦰🧑🏼‍💻🧑🏻‍🍼✋✋🏻✋🏿" "🧑🏻‍🍼" + == [ "🧑🏽‍🦰🧑🏼‍💻" "✋✋🏻✋🏿" ] - Stdlib.String.split "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" "﷽﷽﷽﷽" = [ ""; ""; ""; ""; "" ] + Stdlib.String.split "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" + == [ "" "" ] - Stdlib.String.split "👱👱🏻👱🏼👱🏽👱🏾👱🏿" "👱🏼👱🏽" = [ "👱👱🏻"; "👱🏾👱🏿" ] + Stdlib.String.split "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" "﷽﷽﷽﷽" == [ ""; ""; ""; ""; "" ] - Stdlib.String.split "🧟‍♀️🧟‍♂️" "👱🏽" = [ "🧟‍♀️🧟‍♂️" ] + Stdlib.String.split "👱👱🏻👱🏼👱🏽👱🏾👱🏿" "👱🏼👱🏽" + == [ "👱👱🏻"; "👱🏾👱🏿" ] - // Stdlib.String.split "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" "👩‍👩‍👧‍👦" = [ "👨‍❤️‍💋‍👨" - // "🏳️‍⚧️‍️🇵🇷" ] + Stdlib.String.split "🧟‍♀️🧟‍♂️" "👱🏽" == [ "🧟‍♀️🧟‍♂️" ] - // Stdlib.String.split "żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" "🧑🏽‍🦰" = [ "żółw" - // "🧑🏻‍🍼✋✋🏻✋🏿" ] + Stdlib.String.split "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" "👩‍👩‍👧‍👦" + == [ "👨‍❤️‍💋‍👨" "🏳️‍⚧️‍️🇵🇷" ] - // Stdlib.String.split "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫ" = [ "" - // "ǧ̗͚̚o̙̔ͮ̇͐̇" ] + Stdlib.String.split "żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" "🧑🏽‍🦰" + == [ "żółw" "🧑🏻‍🍼✋✋🏻✋🏿" ] - Stdlib.String.split "666666" "6" = [ ""; ""; ""; ""; ""; ""; "" ] - Stdlib.String.split "55555" "5" = [ ""; ""; ""; ""; ""; "" ] - Stdlib.String.split "4444" "4" = [ ""; ""; ""; ""; "" ] - Stdlib.String.split "333" "3" = [ ""; ""; ""; "" ] - Stdlib.String.split "22" "2" = [ ""; ""; "" ] - Stdlib.String.split "1" "1" = [ ""; "" ] - Stdlib.String.split "" "" = [] + Stdlib.String.split "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫ" + == [ "" "ǧ̗͚̚o̙̔ͮ̇͐̇" ] - Stdlib.String.split "666666x" "6" = [ ""; ""; ""; ""; ""; ""; "x" ] + Stdlib.String.split "666666" "6" == [ ""; ""; ""; ""; ""; ""; "" ] + Stdlib.String.split "55555" "5" == [ ""; ""; ""; ""; ""; "" ] + Stdlib.String.split "4444" "4" == [ ""; ""; ""; ""; "" ] + Stdlib.String.split "333" "3" == [ ""; ""; ""; "" ] + Stdlib.String.split "22" "2" == [ ""; ""; "" ] + Stdlib.String.split "1" "1" == [ ""; "" ] + Stdlib.String.split "" "" == [] - Stdlib.String.split "55555x" "5" = [ ""; ""; ""; ""; ""; "x" ] - Stdlib.String.split "4444x" "4" = [ ""; ""; ""; ""; "x" ] - Stdlib.String.split "333x" "3" = [ ""; ""; ""; "x" ] - Stdlib.String.split "22x" "2" = [ ""; ""; "x" ] - Stdlib.String.split "1x" "1" = [ ""; "x" ] + Stdlib.String.split "666666x" "6" == [ ""; ""; ""; ""; ""; ""; "x" ] - Stdlib.String.split "x666666" "6" = [ "x"; ""; ""; ""; ""; ""; "" ] + Stdlib.String.split "55555x" "5" == [ ""; ""; ""; ""; ""; "x" ] + Stdlib.String.split "4444x" "4" == [ ""; ""; ""; ""; "x" ] + Stdlib.String.split "333x" "3" == [ ""; ""; ""; "x" ] + Stdlib.String.split "22x" "2" == [ ""; ""; "x" ] + Stdlib.String.split "1x" "1" == [ ""; "x" ] - Stdlib.String.split "x55555" "5" = [ "x"; ""; ""; ""; ""; "" ] - Stdlib.String.split "x4444" "4" = [ "x"; ""; ""; ""; "" ] - Stdlib.String.split "x333" "3" = [ "x"; ""; ""; "" ] - Stdlib.String.split "x22" "2" = [ "x"; ""; "" ] - Stdlib.String.split "x1" "1" = [ "x"; "" ] + Stdlib.String.split "x666666" "6" == [ "x"; ""; ""; ""; ""; ""; "" ] - Stdlib.String.split "x666666y" "6" = [ "x"; ""; ""; ""; ""; ""; "y" ] + Stdlib.String.split "x55555" "5" == [ "x"; ""; ""; ""; ""; "" ] + Stdlib.String.split "x4444" "4" == [ "x"; ""; ""; ""; "" ] + Stdlib.String.split "x333" "3" == [ "x"; ""; ""; "" ] + Stdlib.String.split "x22" "2" == [ "x"; ""; "" ] + Stdlib.String.split "x1" "1" == [ "x"; "" ] - Stdlib.String.split "x55555y" "5" = [ "x"; ""; ""; ""; ""; "y" ] - Stdlib.String.split "x4444y" "4" = [ "x"; ""; ""; ""; "y" ] - Stdlib.String.split "x333y" "3" = [ "x"; ""; ""; "y" ] - Stdlib.String.split "x22y" "2" = [ "x"; ""; "y" ] - Stdlib.String.split "x1y" "1" = [ "x"; "y" ] + Stdlib.String.split "x666666y" "6" == [ "x"; ""; ""; ""; ""; ""; "y" ] - Stdlib.String.split "6a6aa6aaa6aaaa" "a" = [ "6" - "6" - "" - "6" - "" - "" - "6" - "" - "" - "" - "" ] + Stdlib.String.split "x55555y" "5" == [ "x"; ""; ""; ""; ""; "y" ] + Stdlib.String.split "x4444y" "4" == [ "x"; ""; ""; ""; "y" ] + Stdlib.String.split "x333y" "3" == [ "x"; ""; ""; "y" ] + Stdlib.String.split "x22y" "2" == [ "x"; ""; "y" ] + Stdlib.String.split "x1y" "1" == [ "x"; "y" ] - // Stdlib.String.split "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" "" = [ "👨‍❤️‍💋‍👨" - // "👩‍👩‍👧‍👦" - // "🏳️‍⚧️‍️" - // "🇵🇷" ] + Stdlib.String.split "6a6aa6aaa6aaaa" "a" + == [ "6"; "6"; ""; "6"; ""; ""; "6"; ""; ""; ""; "" ] - Stdlib.String.split "👨‍👩‍👧‍👦" "👩" = [ "👨‍👩‍👧‍👦" ] + Stdlib.String.split "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" "" + == [ "👨‍❤️‍💋‍👨" "👩‍👩‍👧‍👦" "🏳️‍⚧️‍️" "🇵🇷" ] + + Stdlib.String.split "👨‍👩‍👧‍👦" "👩" == [ "👨‍👩‍👧‍👦" ] module ToLowercase = - Stdlib.String.toLowercase "HELLO😄WORLD" = "hello😄world" - Stdlib.String.toLowercase "" = "" - Stdlib.String.toLowercase "ABCDEF" = "abcdef" // Stdlib.String.toLowercase_v0 works for ASCII range - Stdlib.String.toLowercase "AB323CDEF" = "ab323cdef" - Stdlib.String.toLowercase "SÁNCHEZ" = "sánchez" // not lowercase a - Stdlib.String.toLowercase "sánchez" = "sánchez" - Stdlib.String.toLowercase "ŻÓŁW" = "żółw" // Stdlib.String.toLowercase works on non-ascii strings - Stdlib.String.toLowercase "😄ORANGE" = "😄orange" - Stdlib.String.toLowercase "🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" = "🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" - Stdlib.String.toLowercase "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" = "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" - Stdlib.String.toLowercase "👱👱🏻👱🏼👱🏽👱🏾👱🏿" = "👱👱🏻👱🏼👱🏽👱🏾👱🏿" - Stdlib.String.toLowercase "🧟‍♀️🧟‍♂️" = "🧟‍♀️🧟‍♂️" - Stdlib.String.toLowercase "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" = "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" - Stdlib.String.toLowercase "ŻÓŁW🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" = "żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" - Stdlib.String.toLowercase "Ჾ" = "ჾ" - Stdlib.String.toLowercase "Z̤͔ͧ̑̓Ä͖̭̈̇Lͮ̒ͫǦ̗͚̚O̙̔ͮ̇͐̇" = "z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" + Stdlib.String.toLowercase "HELLO😄WORLD" == "hello😄world" + Stdlib.String.toLowercase "" == "" + Stdlib.String.toLowercase "ABCDEF" == "abcdef" // Stdlib.String.toLowercase works for ASCII range + Stdlib.String.toLowercase "AB323CDEF" == "ab323cdef" + Stdlib.String.toLowercase "SÁNCHEZ" == "sánchez" // not lowercase a + Stdlib.String.toLowercase "sánchez" == "sánchez" + Stdlib.String.toLowercase "ŻÓŁW" == "żółw" // Stdlib.String.toLowercase works on non-ascii strings + Stdlib.String.toLowercase "😄ORANGE" == "😄orange" + Stdlib.String.toLowercase "🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" == "🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" + Stdlib.String.toLowercase "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" == "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" + Stdlib.String.toLowercase "👱👱🏻👱🏼👱🏽👱🏾👱🏿" == "👱👱🏻👱🏼👱🏽👱🏾👱🏿" + Stdlib.String.toLowercase "🧟‍♀️🧟‍♂️" == "🧟‍♀️🧟‍♂️" + + Stdlib.String.toLowercase "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" + == "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" + + Stdlib.String.toLowercase "ŻÓŁW🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" + == "żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" + + Stdlib.String.toLowercase "Ჾ" == "ჾ" + + Stdlib.String.toLowercase "Z̤͔ͧ̑̓Ä͖̭̈̇Lͮ̒ͫǦ̗͚̚O̙̔ͮ̇͐̇" + == "z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" Stdlib.String.toLowercase - "H̬̤̗̤͝e͜ ̜̥̝̻͍̟́w̕h̖̯͓o̝͙̖͎̱̮ ҉̺̙̞̟͈W̷̼̭a̺̪͍į͈͕̭͙̯̜t̶̼̮s̘͙͖̕ ̠̫̠B̻͍͙͉̳ͅe̵h̵̬͇̫͙i̹͓̳̳̮͎̫̕n͟d̴̪̜̖ ̰͉̩͇͙̲͞ͅT͖̼͓̪͢h͏͓̮̻e̬̝̟ͅ ̤̹̝W͙̞̝͔͇͝ͅa͏͓͔̹̼̣l̴͔̰̤̟͔ḽ̫.͕" = "h̬̤̗̤͝e͜ ̜̥̝̻͍̟́w̕h̖̯͓o̝͙̖͎̱̮ ҉̺̙̞̟͈w̷̼̭a̺̪͍į͈͕̭͙̯̜t̶̼̮s̘͙͖̕ ̠̫̠b̻͍͙͉̳ͅe̵h̵̬͇̫͙i̹͓̳̳̮͎̫̕n͟d̴̪̜̖ ̰͉̩͇͙̲͞ͅt͖̼͓̪͢h͏͓̮̻e̬̝̟ͅ ̤̹̝w͙̞̝͔͇͝ͅa͏͓͔̹̼̣l̴͔̰̤̟͔ḽ̫.͕" + "H̬̤̗̤͝e͜ ̜̥̝̻͍̟́w̕h̖̯͓o̝͙̖͎̱̮ ҉̺̙̞̟͈W̷̼̭a̺̪͍į͈͕̭͙̯̜t̶̼̮s̘͙͖̕ ̠̫̠B̻͍͙͉̳ͅe̵h̵̬͇̫͙i̹͓̳̳̮͎̫̕n͟d̴̪̜̖ ̰͉̩͇͙̲͞ͅT͖̼͓̪͢h͏͓̮̻e̬̝̟ͅ ̤̹̝W͙̞̝͔͇͝ͅa͏͓͔̹̼̣l̴͔̰̤̟͔ḽ̫.͕" + == "h̬̤̗̤͝e͜ ̜̥̝̻͍̟́w̕h̖̯͓o̝͙̖͎̱̮ ҉̺̙̞̟͈w̷̼̭a̺̪͍į͈͕̭͙̯̜t̶̼̮s̘͙͖̕ ̠̫̠b̻͍͙͉̳ͅe̵h̵̬͇̫͙i̹͓̳̳̮͎̫̕n͟d̴̪̜̖ ̰͉̩͇͙̲͞ͅt͖̼͓̪͢h͏͓̮̻e̬̝̟ͅ ̤̹̝w͙̞̝͔͇͝ͅa͏͓͔̹̼̣l̴͔̰̤̟͔ḽ̫.͕" module ToUppercase = - Stdlib.String.toUppercase "" = "" - Stdlib.String.toUppercase "hello😄world" = "HELLO😄WORLD" - Stdlib.String.toUppercase "abcdef" = "ABCDEF" - Stdlib.String.toUppercase "ab323cdef" = "AB323CDEF" - Stdlib.String.toUppercase "sánchez" = "SÁNCHEZ" // not lowercase a - Stdlib.String.toUppercase "SÁNChEZ" = "SÁNCHEZ" - Stdlib.String.toUppercase "żółw" = "ŻÓŁW" - Stdlib.String.toUppercase "😄orange" = "😄ORANGE" - Stdlib.String.toUppercase "🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" = "🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" - Stdlib.String.toUppercase "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" = "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" - Stdlib.String.toUppercase "👱👱🏻👱🏼👱🏽👱🏾👱🏿" = "👱👱🏻👱🏼👱🏽👱🏾👱🏿" - Stdlib.String.toUppercase "🧟‍♀️🧟‍♂️" = "🧟‍♀️🧟‍♂️" - Stdlib.String.toUppercase "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" = "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" - Stdlib.String.toUppercase "żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" = "ŻÓŁW🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" - Stdlib.String.toUppercase "ჾ" = "Ჾ" + Stdlib.String.toUppercase "" == "" + Stdlib.String.toUppercase "hello😄world" == "HELLO😄WORLD" + Stdlib.String.toUppercase "abcdef" == "ABCDEF" + Stdlib.String.toUppercase "ab323cdef" == "AB323CDEF" + Stdlib.String.toUppercase "sánchez" == "SÁNCHEZ" // not lowercase a + Stdlib.String.toUppercase "SÁNChEZ" == "SÁNCHEZ" + Stdlib.String.toUppercase "żółw" == "ŻÓŁW" + Stdlib.String.toUppercase "😄orange" == "😄ORANGE" + Stdlib.String.toUppercase "🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" == "🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" + Stdlib.String.toUppercase "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" == "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" + Stdlib.String.toUppercase "👱👱🏻👱🏼👱🏽👱🏾👱🏿" == "👱👱🏻👱🏼👱🏽👱🏾👱🏿" + Stdlib.String.toUppercase "🧟‍♀️🧟‍♂️" == "🧟‍♀️🧟‍♂️" + + Stdlib.String.toUppercase "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" + == "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" + + Stdlib.String.toUppercase "żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" + == "ŻÓŁW🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" + + Stdlib.String.toUppercase "ჾ" == "Ჾ" // TODO: There are two types of unicode case "mapping" (conversion), "simple" // and "full". .NET supports simple mapping, which maps a single character to a @@ -643,342 +733,406 @@ module ToUppercase = // (packaged at // https://dnceng.visualstudio.com/public/_packaging?_a=package&feed=dotnet-experimental&view=overview&package=System.Text.CaseFolding&version=0.1.2-alpha.21059.1&protocolType=NuGet) - Stdlib.String.toUppercase "fifl" = "fifl" // should be "FIFL" - Stdlib.String.toUppercase "և" = "և" // should be "ԵՒ" + Stdlib.String.toUppercase "fifl" == "fifl" // should be "FIFL" + Stdlib.String.toUppercase "և" == "և" // should be "ԵՒ" - Stdlib.String.toUppercase "z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" = "Z̤͔ͧ̑̓Ä͖̭̈̇Lͮ̒ͫǦ̗͚̚O̙̔ͮ̇͐̇" + Stdlib.String.toUppercase "z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" + == "Z̤͔ͧ̑̓Ä͖̭̈̇Lͮ̒ͫǦ̗͚̚O̙̔ͮ̇͐̇" Stdlib.String.toUppercase - "H̬̤̗̤͝e͜ ̜̥̝̻͍̟́w̕h̖̯͓o̝͙̖͎̱̮ ҉̺̙̞̟͈W̷̼̭a̺̪͍į͈͕̭͙̯̜t̶̼̮s̘͙͖̕ ̠̫̠B̻͍͙͉̳ͅe̵h̵̬͇̫͙i̹͓̳̳̮͎̫̕n͟d̴̪̜̖ ̰͉̩͇͙̲͞ͅT͖̼͓̪͢h͏͓̮̻e̬̝̟ͅ ̤̹̝W͙̞̝͔͇͝ͅa͏͓͔̹̼̣l̴͔̰̤̟͔ḽ̫.͕" = "H̬̤̗̤͝E͜ ̜̥̝̻͍̟́W̕H̖̯͓O̝͙̖͎̱̮ ҉̺̙̞̟͈W̷̼̭A̺̪͍Į͈͕̭͙̯̜T̶̼̮S̘͙͖̕ ̠̫̠B̻͍͙͉̳ΙE̵H̵̬͇̫͙I̹͓̳̳̮͎̫̕N͟D̴̪̜̖ ̰͉̩͇͙̲͞ΙT͖̼͓̪͢H͏͓̮̻E̬̝̟Ι ̤̹̝W͙̞̝͔͇͝ΙA͏͓͔̹̼̣L̴͔̰̤̟͔Ḽ̫.͕" - + "H̬̤̗̤͝e͜ ̜̥̝̻͍̟́w̕h̖̯͓o̝͙̖͎̱̮ ҉̺̙̞̟͈W̷̼̭a̺̪͍į͈͕̭͙̯̜t̶̼̮s̘͙͖̕ ̠̫̠B̻͍͙͉̳ͅe̵h̵̬͇̫͙i̹͓̳̳̮͎̫̕n͟d̴̪̜̖ ̰͉̩͇͙̲͞ͅT͖̼͓̪͢h͏͓̮̻e̬̝̟ͅ ̤̹̝W͙̞̝͔͇͝ͅa͏͓͔̹̼̣l̴͔̰̤̟͔ḽ̫.͕" + == "H̬̤̗̤͝E͜ ̜̥̝̻͍̟́W̕H̖̯͓O̝͙̖͎̱̮ ҉̺̙̞̟͈W̷̼̭A̺̪͍Į͈͕̭͙̯̜T̶̼̮S̘͙͖̕ ̠̫̠B̻͍͙͉̳ΙE̵H̵̬͇̫͙I̹͓̳̳̮͎̫̕N͟D̴̪̜̖ ̰͉̩͇͙̲͞ΙT͖̼͓̪͢H͏͓̮̻E̬̝̟Ι ̤̹̝W͙̞̝͔͇͝ΙA͏͓͔̹̼̣L̴͔̰̤̟͔Ḽ̫.͕" module TrimEnd = - Stdlib.String.trimEnd_v0 " " = "" - Stdlib.String.trimEnd_v0 "" = "" - Stdlib.String.trimEnd_v0 " foo " = " foo" - Stdlib.String.trimEnd_v0 " foo bar " = " foo bar" - Stdlib.String.trimEnd_v0 " foo" = " foo" - Stdlib.String.trimEnd_v0 " 😄foobar😄 " = " 😄foobar😄" - Stdlib.String.trimEnd_v0 "  foo bar  " = "  foo bar" - Stdlib.String.trimEnd_v0 "foo " = "foo" - Stdlib.String.trimEnd_v0 "foo" = "foo" + Stdlib.String.trimEnd " " == "" + Stdlib.String.trimEnd "" == "" + Stdlib.String.trimEnd " foo " == " foo" + Stdlib.String.trimEnd " foo bar " == " foo bar" + Stdlib.String.trimEnd " foo" == " foo" + Stdlib.String.trimEnd " 😄foobar😄 " == " 😄foobar😄" + Stdlib.String.trimEnd "  foo bar  " == "  foo bar" + Stdlib.String.trimEnd "foo " == "foo" + Stdlib.String.trimEnd "foo" == "foo" + + Stdlib.String.trimEnd " \xe2\x80\x83foo\xe2\x80\x83bar\xe2\x80\x83 " + == " \xe2\x80\x83foo\xe2\x80\x83bar\xe2\x80\x83" - Stdlib.String.trimEnd_v0 " \xe2\x80\x83foo\xe2\x80\x83bar\xe2\x80\x83 " = " \xe2\x80\x83foo\xe2\x80\x83bar\xe2\x80\x83" + Stdlib.String.trimEnd " \xf0\x9f\x98\x84foobar\xf0\x9f\x98\x84 " + == " \xf0\x9f\x98\x84foobar\xf0\x9f\x98\x84" - Stdlib.String.trimEnd_v0 " \xf0\x9f\x98\x84foobar\xf0\x9f\x98\x84 " = " \xf0\x9f\x98\x84foobar\xf0\x9f\x98\x84" + Stdlib.String.trimEnd " żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿 " + == " żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" - Stdlib.String.trimEnd_v0 " żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿 " = " żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" - Stdlib.String.trimEnd_v0 " Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇ " = " Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" - Stdlib.String.trimEnd_v0 " ﷽﷽ " = " ﷽﷽" - Stdlib.String.trimEnd_v0 " 🧟‍♀️🧟‍♂️ " = " 🧟‍♀️🧟‍♂️" + Stdlib.String.trimEnd " Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇ " + == " Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" - Stdlib.String.trimEnd_v0 " 👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷 " = " 👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" + Stdlib.String.trimEnd " ﷽﷽ " == " ﷽﷽" + Stdlib.String.trimEnd " 🧟‍♀️🧟‍♂️ " == " 🧟‍♀️🧟‍♂️" - Stdlib.String.trimEnd_v0 " żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿 " = " żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" - Stdlib.String.trimEnd_v0 "🇺🇸🇷🇺🇸 🇦🇫🇦🇲🇸" = "🇺🇸🇷🇺🇸 🇦🇫🇦🇲🇸" + Stdlib.String.trimEnd " 👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷 " + == " 👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" + + Stdlib.String.trimEnd " żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿 " + == " żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" + + Stdlib.String.trimEnd "🇺🇸🇷🇺🇸 🇦🇫🇦🇲🇸" == "🇺🇸🇷🇺🇸 🇦🇫🇦🇲🇸" module TrimStart = - Stdlib.String.trimStart_v0 " \xe2\x80\x83foo\xe2\x80\x83bar\xe2\x80\x83 " = "\xe2\x80\x83foo\xe2\x80\x83bar\xe2\x80\x83 " + Stdlib.String.trimStart " \xe2\x80\x83foo\xe2\x80\x83bar\xe2\x80\x83 " + == "\xe2\x80\x83foo\xe2\x80\x83bar\xe2\x80\x83 " + + Stdlib.String.trimStart " \xf0\x9f\x98\x84foobar\xf0\x9f\x98\x84 " + == "\xf0\x9f\x98\x84foobar\xf0\x9f\x98\x84 " - Stdlib.String.trimStart_v0 " \xf0\x9f\x98\x84foobar\xf0\x9f\x98\x84 " = "\xf0\x9f\x98\x84foobar\xf0\x9f\x98\x84 " + Stdlib.String.trimStart " " == "" + Stdlib.String.trimStart "" == "" + Stdlib.String.trimStart " foo " == "foo " + Stdlib.String.trimStart " foo bar " == "foo bar " + Stdlib.String.trimStart " foo" == "foo" + Stdlib.String.trimStart " 😄foobar😄 " == "😄foobar😄 " + Stdlib.String.trimStart "  foo bar  " == "foo bar  " + Stdlib.String.trimStart "foo " == "foo " + Stdlib.String.trimStart "foo" == "foo" - Stdlib.String.trimStart_v0 " " = "" - Stdlib.String.trimStart_v0 "" = "" - Stdlib.String.trimStart_v0 " foo " = "foo " - Stdlib.String.trimStart_v0 " foo bar " = "foo bar " - Stdlib.String.trimStart_v0 " foo" = "foo" - Stdlib.String.trimStart_v0 " 😄foobar😄 " = "😄foobar😄 " - Stdlib.String.trimStart_v0 "  foo bar  " = "foo bar  " - Stdlib.String.trimStart_v0 "foo " = "foo " - Stdlib.String.trimStart_v0 "foo" = "foo" - Stdlib.String.trimStart_v0 " żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿 " = "żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿 " - Stdlib.String.trimStart_v0 " Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇ " = "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇ " - Stdlib.String.trimStart_v0 " ﷽﷽ " = "﷽﷽ " - Stdlib.String.trimStart_v0 " 🧟‍♀️🧟‍♂️ " = "🧟‍♀️🧟‍♂️ " + Stdlib.String.trimStart " żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿 " + == "żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿 " - Stdlib.String.trimStart_v0 " 👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷 " = "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷 " + Stdlib.String.trimStart " Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇ " + == "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇ " - Stdlib.String.trimStart_v0 " żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿 " = "żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿 " + Stdlib.String.trimStart " ﷽﷽ " == "﷽﷽ " + Stdlib.String.trimStart " 🧟‍♀️🧟‍♂️ " == "🧟‍♀️🧟‍♂️ " + + Stdlib.String.trimStart " 👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷 " + == "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷 " + + Stdlib.String.trimStart " żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿 " + == "żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿 " module Trim = - Stdlib.String.trim_v0 " " = "" - Stdlib.String.trim_v0 "" = "" - Stdlib.String.trim_v0 " foo " = "foo" // String trims both leading + trailing spaces - Stdlib.String.trim_v0 " foo bar " = "foo bar" // String trims both leading + trailing spaces, leaving inner untouched - Stdlib.String.trim_v0 " foo" = "foo" // String trims leading spaces - Stdlib.String.trim_v0 " 😄foobar😄 " = "😄foobar😄" // String trims both leading + trailing spaces, preserving emoji - Stdlib.String.trim_v0 "  foo bar " = "foo bar" // String trims both leading + trailing spaces, leaving inner untouched w/ unicode spaces - Stdlib.String.trim_v0 "foo " = "foo" // String trims trailing spaces - Stdlib.String.trim_v0 "foo" = "foo" // String trim noops - Stdlib.String.trim_v0 " żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿 " = "żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" - Stdlib.String.trim_v0 " Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇ " = "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" - Stdlib.String.trim_v0 " ﷽﷽" = "﷽﷽" - Stdlib.String.trim_v0 " 🧟‍♀️🧟‍♂️ " = "🧟‍♀️🧟‍♂️" - Stdlib.String.trim_v0 " 👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷 " = "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" - Stdlib.String.trim_v0 " żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" = "żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" - - Stdlib.String.trim_v0 " \xe2\x80\x83foo\xe2\x80\x83bar\xe2\x80\x83 " = "\xe2\x80\x83foo\xe2\x80\x83bar\xe2\x80\x83" - - Stdlib.String.trim_v0 " \xf0\x9f\x98\x84foobar\xf0\x9f\x98\x84 " = "\xf0\x9f\x98\x84foobar\xf0\x9f\x98\x84" - Stdlib.String.trim_v0 "쉆ꥨ逴皪巌䖑ⱝዓ淋" = "쉆ꥨ逴皪巌䖑ⱝዓ淋" + Stdlib.String.trim " " == "" + Stdlib.String.trim "" == "" + Stdlib.String.trim " foo " == "foo" // String trims both leading + trailing spaces + Stdlib.String.trim " foo bar " == "foo bar" // String trims both leading + trailing spaces, leaving inner untouched + Stdlib.String.trim " foo" == "foo" // String trims leading spaces + Stdlib.String.trim " 😄foobar😄 " == "😄foobar😄" // String trims both leading + trailing spaces, preserving emoji + Stdlib.String.trim "  foo bar " == "foo bar" // String trims both leading + trailing spaces, leaving inner untouched w/ unicode spaces + Stdlib.String.trim "foo " == "foo" // String trims trailing spaces + Stdlib.String.trim "foo" == "foo" // String trim noops + + Stdlib.String.trim " żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿 " + == "żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" + + Stdlib.String.trim " Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇ " + == "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" + + Stdlib.String.trim " ﷽﷽" == "﷽﷽" + Stdlib.String.trim " 🧟‍♀️🧟‍♂️ " == "🧟‍♀️🧟‍♂️" + + Stdlib.String.trim " 👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷 " + == "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" + + Stdlib.String.trim " żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" + == "żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" + + Stdlib.String.trim " \xe2\x80\x83foo\xe2\x80\x83bar\xe2\x80\x83 " + == "\xe2\x80\x83foo\xe2\x80\x83bar\xe2\x80\x83" + + Stdlib.String.trim " \xf0\x9f\x98\x84foobar\xf0\x9f\x98\x84 " + == "\xf0\x9f\x98\x84foobar\xf0\x9f\x98\x84" + + Stdlib.String.trim "쉆ꥨ逴皪巌䖑ⱝዓ淋" == "쉆ꥨ逴皪巌䖑ⱝዓ淋" module Reverse = - Stdlib.String.reverse_v0 "abcde" = "edcba" - Stdlib.String.reverse_v0 "0abcde" = "edcba0" - Stdlib.String.reverse_v0 "a" = "a" - Stdlib.String.reverse_v0 "" = "" - Stdlib.String.reverse_v0 "ábc" = "cbá" - Stdlib.String.reverse_v0 "🎁🧸DŽʠ123" = "321ʠDŽ🧸🎁" - Stdlib.String.reverse_v0 "😄foobar👽" = "👽raboof😄" - Stdlib.String.reverse_v0 "żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" = "✋🏿✋🏻✋🧑🏻‍🍼🧑🏽‍🦰włóż" - Stdlib.String.reverse_v0 "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" = "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" - Stdlib.String.reverse_v0 "👱👱🏻👱🏼👱🏽👱🏾👱🏿" = "👱🏿👱🏾👱🏽👱🏼👱🏻👱" - Stdlib.String.reverse_v0 "🧟‍♀️🧟‍♂️" = "🧟‍♂️🧟‍♀️" - Stdlib.String.reverse_v0 "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" = "🇵🇷🏳️‍⚧️‍️👩‍👩‍👧‍👦👨‍❤️‍💋‍👨" - Stdlib.String.reverse_v0 "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" = "o̙̔ͮ̇͐̇ǧ̗͚̚lͮ̒ͫä͖̭̈̇Z̤͔ͧ̑̓" + Stdlib.String.reverse "abcde" == "edcba" + Stdlib.String.reverse "0abcde" == "edcba0" + Stdlib.String.reverse "a" == "a" + Stdlib.String.reverse "" == "" + Stdlib.String.reverse "ábc" == "cbá" + Stdlib.String.reverse "🎁🧸DŽʠ123" == "321ʠDŽ🧸🎁" + Stdlib.String.reverse "😄foobar👽" == "👽raboof😄" + Stdlib.String.reverse "żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" == "✋🏿✋🏻✋🧑🏻‍🍼🧑🏽‍🦰włóż" + Stdlib.String.reverse "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" == "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" + Stdlib.String.reverse "👱👱🏻👱🏼👱🏽👱🏾👱🏿" == "👱🏿👱🏾👱🏽👱🏼👱🏻👱" + Stdlib.String.reverse "🧟‍♀️🧟‍♂️" == "🧟‍♂️🧟‍♀️" + + Stdlib.String.reverse "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" + == "🇵🇷🏳️‍⚧️‍️👩‍👩‍👧‍👦👨‍❤️‍💋‍👨" + + Stdlib.String.reverse "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" + == "o̙̔ͮ̇͐̇ǧ̗͚̚lͮ̒ͫä͖̭̈̇Z̤͔ͧ̑̓" module DropFirst = - Stdlib.String.dropFirst_v0 "abcd" -3L = "abcd" - Stdlib.String.dropFirst_v0 "abcd" 0L = "abcd" - Stdlib.String.dropFirst_v0 "abcd" 3L = "d" - Stdlib.String.dropFirst_v0 "" 3L = "" - Stdlib.String.dropFirst_v0 "abcd" 3L = "d" - Stdlib.String.dropFirst_v0 "🍏🍒🍒" 1L = "🍒🍒" - Stdlib.String.dropFirst_v0 "🍏🍒🍍" 2L = "🍍" - Stdlib.String.dropFirst_v0 "🍏a🍒b🍍c" 2L = "🍒b🍍c" - Stdlib.String.dropFirst_v0 "żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" 5L = "🧑🏻‍🍼✋✋🏻✋🏿" - Stdlib.String.dropFirst_v0 "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" 1L = "ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" - Stdlib.String.dropFirst_v0 "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" 2L = "lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" - Stdlib.String.dropFirst_v0 "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" 3L = "ǧ̗͚̚o̙̔ͮ̇͐̇" - Stdlib.String.dropFirst_v0 "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" 1L = "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" - Stdlib.String.dropFirst_v0 "👱👱🏻👱🏼👱🏽👱🏾👱🏿" 1L = "👱🏻👱🏼👱🏽👱🏾👱🏿" - Stdlib.String.dropFirst_v0 "🧟‍♀️🧟‍♂️" 20L = "" - Stdlib.String.dropFirst_v0 "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" 3L = "🇵🇷" + Stdlib.String.dropFirst "abcd" -3L == "abcd" + Stdlib.String.dropFirst "abcd" 0L == "abcd" + Stdlib.String.dropFirst "abcd" 3L == "d" + Stdlib.String.dropFirst "" 3L == "" + Stdlib.String.dropFirst "abcd" 3L == "d" + Stdlib.String.dropFirst "🍏🍒🍒" 1L == "🍒🍒" + Stdlib.String.dropFirst "🍏🍒🍍" 2L == "🍍" + Stdlib.String.dropFirst "🍏a🍒b🍍c" 2L == "🍒b🍍c" + Stdlib.String.dropFirst "żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" 5L == "🧑🏻‍🍼✋✋🏻✋🏿" + + Stdlib.String.dropFirst "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" 1L + == "ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" + + Stdlib.String.dropFirst "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" 2L == "lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" + Stdlib.String.dropFirst "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" 3L == "ǧ̗͚̚o̙̔ͮ̇͐̇" + Stdlib.String.dropFirst "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" 1L == "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" + Stdlib.String.dropFirst "👱👱🏻👱🏼👱🏽👱🏾👱🏿" 1L == "👱🏻👱🏼👱🏽👱🏾👱🏿" + Stdlib.String.dropFirst "🧟‍♀️🧟‍♂️" 20L == "" + Stdlib.String.dropFirst "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" 3L == "🇵🇷" module DropLast = - Stdlib.String.dropLast_v0 "abcd" -3L = "abcd" - Stdlib.String.dropLast_v0 "abcd" 0L = "abcd" - Stdlib.String.dropLast_v0 "abcd" 3L = "a" - Stdlib.String.dropLast_v0 "" 3L = "" - Stdlib.String.dropLast_v0 "🍏🍒🍒" 1L = "🍏🍒" - Stdlib.String.dropLast_v0 "🍏🍒🍍" 2L = "🍏" - Stdlib.String.dropLast_v0 "🍏a🍒b🍍c" 2L = "🍏a🍒b" - Stdlib.String.dropLast_v0 "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" 2L = "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫ" - Stdlib.String.dropLast_v0 "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" 10L = "﷽﷽﷽﷽﷽﷽" - Stdlib.String.dropLast_v0 "👱👱🏻👱🏼👱🏽👱🏾👱🏿" 3L = "👱👱🏻👱🏼" - Stdlib.String.dropLast_v0 "🧟‍♀️🧟‍♂️" 20L = "" - Stdlib.String.dropLast_v0 "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" 2L = "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦" - Stdlib.String.dropLast_v0 "żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" 4L = "żółw🧑🏽‍🦰" + Stdlib.String.dropLast "abcd" -3L == "abcd" + Stdlib.String.dropLast "abcd" 0L == "abcd" + Stdlib.String.dropLast "abcd" 3L == "a" + Stdlib.String.dropLast "" 3L == "" + Stdlib.String.dropLast "🍏🍒🍒" 1L == "🍏🍒" + Stdlib.String.dropLast "🍏🍒🍍" 2L == "🍏" + Stdlib.String.dropLast "🍏a🍒b🍍c" 2L == "🍏a🍒b" + Stdlib.String.dropLast "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" 2L == "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫ" + Stdlib.String.dropLast "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" 10L == "﷽﷽﷽﷽﷽﷽" + Stdlib.String.dropLast "👱👱🏻👱🏼👱🏽👱🏾👱🏿" 3L == "👱👱🏻👱🏼" + Stdlib.String.dropLast "🧟‍♀️🧟‍♂️" 20L == "" + + Stdlib.String.dropLast "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" 2L + == "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦" + + Stdlib.String.dropLast "żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" 4L == "żółw🧑🏽‍🦰" module Last = - Stdlib.String.last_v0 "żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" 4L = "🧑🏻‍🍼✋✋🏻✋🏿" - Stdlib.String.last_v0 "abcd" -3L = "" - Stdlib.String.last_v0 "abcd" 0L = "" - Stdlib.String.last_v0 "" 7L = "" - Stdlib.String.last_v0 "abcd" 1L = "d" - Stdlib.String.last_v0 "abcd" 2L = "cd" - Stdlib.String.last_v0 "abcd" 3L = "bcd" - Stdlib.String.last_v0 "🍍🍍🍏" 1L = "🍏" - Stdlib.String.last_v0 "🍊🍍🍏" 2L = "🍍🍏" - Stdlib.String.last_v0 "🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿🧑🏻‍🍼" 1L = "🧑🏻‍🍼" - Stdlib.String.last_v0 "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" 2L = "ǧ̗͚̚o̙̔ͮ̇͐̇" - Stdlib.String.last_v0 "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" 2L = "﷽﷽" - Stdlib.String.last_v0 "👱👱🏻👱🏼👱🏽👱🏾👱🏿" 3L = "👱🏽👱🏾👱🏿" - Stdlib.String.last_v0 "🧟‍♀️🧟‍♂️" 1L = "🧟‍♂️" - Stdlib.String.last_v0 "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" 1L = "🇵🇷" + Stdlib.String.last "żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" 4L == "🧑🏻‍🍼✋✋🏻✋🏿" + Stdlib.String.last "abcd" -3L == "" + Stdlib.String.last "abcd" 0L == "" + Stdlib.String.last "" 7L == "" + Stdlib.String.last "abcd" 1L == "d" + Stdlib.String.last "abcd" 2L == "cd" + Stdlib.String.last "abcd" 3L == "bcd" + Stdlib.String.last "🍍🍍🍏" 1L == "🍏" + Stdlib.String.last "🍊🍍🍏" 2L == "🍍🍏" + Stdlib.String.last "🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿🧑🏻‍🍼" 1L == "🧑🏻‍🍼" + Stdlib.String.last "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" 2L == "ǧ̗͚̚o̙̔ͮ̇͐̇" + Stdlib.String.last "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" 2L == "﷽﷽" + Stdlib.String.last "👱👱🏻👱🏼👱🏽👱🏾👱🏿" 3L == "👱🏽👱🏾👱🏿" + Stdlib.String.last "🧟‍♀️🧟‍♂️" 1L == "🧟‍♂️" + Stdlib.String.last "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" 1L == "🇵🇷" module Contains = - Stdlib.String.contains_v0 "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" "2223" = false - Stdlib.String.contains_v0 "👱👱🏻👱🏼👱🏽👱🏾" "👱🏿" = false - Stdlib.String.contains_v0 "🧟‍♀️🧟‍♂️" "🧟‍♂️" = true - Stdlib.String.contains_v0 "🧟‍♀️🧟‍♂️" "🧟‍♂️🧟‍♂️" = false + Stdlib.String.contains "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" "2223" == false + Stdlib.String.contains "👱👱🏻👱🏼👱🏽👱🏾" "👱🏿" == false + Stdlib.String.contains "🧟‍♀️🧟‍♂️" "🧟‍♂️" == true + Stdlib.String.contains "🧟‍♀️🧟‍♂️" "🧟‍♂️🧟‍♂️" == false - Stdlib.String.contains_v0 - "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️🇵🇷" - "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦" = true + Stdlib.String.contains "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️🇵🇷" "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦" + == true - Stdlib.String.contains_v0 "اختبار" "اختبار" = true - Stdlib.String.contains_v0 "" "" = true - Stdlib.String.contains_v0 "a" "" = true - Stdlib.String.contains_v0 "" "a" = false + Stdlib.String.contains "اختبار" "اختبار" == true + Stdlib.String.contains "" "" == true + Stdlib.String.contains "a" "" == true + Stdlib.String.contains "" "a" == false module Slice = - Stdlib.String.slice_v0 "abcd" -2L 4L = "cd" - Stdlib.String.slice_v0 "abcd" -5L -6L = "" - Stdlib.String.slice_v0 "abcd" -5L 1L = "a" - Stdlib.String.slice_v0 "abcd" 0L -1L = "abc" - Stdlib.String.slice_v0 "abcd" 2L 3L = "c" - Stdlib.String.slice_v0 "abcd" 2L 6L = "cd" - Stdlib.String.slice_v0 "abcd" 3L 2L = "" - Stdlib.String.slice_v0 "abcd" 5L 6L = "" - Stdlib.String.slice_v0 "🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" 2L 10L = "✋✋🏻✋🏿" - Stdlib.String.slice_v0 "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" 1L 3L = "ä͖̭̈̇lͮ̒ͫ" - Stdlib.String.slice_v0 "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" 2L 6L = "﷽﷽﷽﷽" - Stdlib.String.slice_v0 "👱👱🏻👱🏼👱🏽👱🏾👱🏿" 2L 6L = "👱🏼👱🏽👱🏾👱🏿" - Stdlib.String.slice_v0 "🧟‍♀️🧟‍♂️" 2L 4L = "" - Stdlib.String.slice_v0 "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" 2L 10L = "🏳️‍⚧️‍️🇵🇷" - Stdlib.String.slice_v0 "abc" 0L 4503599627370498L = "abc" + Stdlib.String.slice "abcd" -2L 4L == "cd" + Stdlib.String.slice "abcd" -5L -6L == "" + Stdlib.String.slice "abcd" -5L 1L == "a" + Stdlib.String.slice "abcd" 0L -1L == "abc" + Stdlib.String.slice "abcd" 2L 3L == "c" + Stdlib.String.slice "abcd" 2L 6L == "cd" + Stdlib.String.slice "abcd" 3L 2L == "" + Stdlib.String.slice "abcd" 5L 6L == "" + Stdlib.String.slice "🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" 2L 10L == "✋✋🏻✋🏿" + Stdlib.String.slice "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" 1L 3L == "ä͖̭̈̇lͮ̒ͫ" + Stdlib.String.slice "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" 2L 6L == "﷽﷽﷽﷽" + Stdlib.String.slice "👱👱🏻👱🏼👱🏽👱🏾👱🏿" 2L 6L == "👱🏼👱🏽👱🏾👱🏿" + Stdlib.String.slice "🧟‍♀️🧟‍♂️" 2L 4L == "" + + Stdlib.String.slice "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" 2L 10L + == "🏳️‍⚧️‍️🇵🇷" + + Stdlib.String.slice "abc" 0L 4503599627370498L == "abc" module First = - Stdlib.String.first_v0 "abcd" -3L = "" - Stdlib.String.first_v0 "abcd" 0L = "" - Stdlib.String.first_v0 "abcd" 1L = "a" - Stdlib.String.first_v0 "abcd" 2L = "ab" - Stdlib.String.first_v0 "abcd" 3L = "abc" - Stdlib.String.first_v0 "abcd" 3000000000000000L = "abcd" - Stdlib.String.first_v0 "" 7L = "" - Stdlib.String.first_v0 "🍊🍍🍏" 1L = "🍊" - Stdlib.String.first_v0 "🍊🍍🍏" 2L = "🍊🍍" - Stdlib.String.first_v0 "🍊🍍🍏" 3L = "🍊🍍🍏" - Stdlib.String.first_v0 "🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" 1L = "🧑🏽‍🦰" - Stdlib.String.first_v0 "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" 10L = "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" - Stdlib.String.first_v0 "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" 2L = "Z̤͔ͧ̑̓ä͖̭̈̇" - Stdlib.String.first_v0 "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" 3L = "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫ" - Stdlib.String.first_v0 "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" 4L = "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚" - Stdlib.String.first_v0 "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" 1L = "﷽" - Stdlib.String.first_v0 "👱👱🏻👱🏼👱🏽👱🏾👱🏿" 2L = "👱👱🏻" - Stdlib.String.first_v0 "🧟‍♀️🧟‍♂️" 1L = "🧟‍♀️" - Stdlib.String.first_v0 "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" 3L = "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️" + Stdlib.String.first "abcd" -3L == "" + Stdlib.String.first "abcd" 0L == "" + Stdlib.String.first "abcd" 1L == "a" + Stdlib.String.first "abcd" 2L == "ab" + Stdlib.String.first "abcd" 3L == "abc" + Stdlib.String.first "abcd" 3000000000000000L == "abcd" + Stdlib.String.first "" 7L == "" + Stdlib.String.first "🍊🍍🍏" 1L == "🍊" + Stdlib.String.first "🍊🍍🍏" 2L == "🍊🍍" + Stdlib.String.first "🍊🍍🍏" 3L == "🍊🍍🍏" + Stdlib.String.first "🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" 1L == "🧑🏽‍🦰" + + Stdlib.String.first "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" 10L + == "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" + + Stdlib.String.first "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" 2L == "Z̤͔ͧ̑̓ä͖̭̈̇" + Stdlib.String.first "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" 3L == "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫ" + Stdlib.String.first "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" 4L == "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚" + Stdlib.String.first "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" 1L == "﷽" + Stdlib.String.first "👱👱🏻👱🏼👱🏽👱🏾👱🏿" 2L == "👱👱🏻" + Stdlib.String.first "🧟‍♀️🧟‍♂️" 1L == "🧟‍♀️" + + Stdlib.String.first "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" 3L + == "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️" module PadStart = - Stdlib.String.padStart_v0 "123" "0" 3L = Stdlib.Result.Result.Ok "123" + Stdlib.String.padStart "123" "0" 3L == Stdlib.Result.Result.Ok("123") - Stdlib.String.padStart_v0 "123" "0" -3L = Stdlib.Result.Result.Ok "123" + Stdlib.String.padStart "123" "0" -3L == Stdlib.Result.Result.Ok("123") - Stdlib.String.padStart_v0 "123" "_-" 4L = Stdlib.Result.Result.Error + Stdlib.String.padStart "123" "_-" 4L + == Stdlib.Result.Result.Error( "Expected `padWith` to be 1 character long, but it was `\"_-\"`" + ) - Stdlib.String.padStart_v0 "123" "" 10L = Stdlib.Result.Result.Error + Stdlib.String.padStart "123" "" 10L + == Stdlib.Result.Result.Error( "Expected `padWith` to be 1 character long, but it was `\"\"`" + ) - Stdlib.String.padStart_v0 "123" "0" 6L = Stdlib.Result.Result.Ok "000123" + Stdlib.String.padStart "123" "0" 6L == Stdlib.Result.Result.Ok("000123") - Stdlib.String.padStart_v0 "" "0" 0L = Stdlib.Result.Result.Ok "" + Stdlib.String.padStart "" "0" 0L == Stdlib.Result.Result.Ok("") - Stdlib.String.padStart_v0 "123🍊🍊" "0" 3L = Stdlib.Result.Result.Ok "123🍊🍊" + Stdlib.String.padStart "123🍊🍊" "0" 3L == Stdlib.Result.Result.Ok("123🍊🍊") - Stdlib.String.padStart_v0 "🍍🍍🍊🍊" "0" 7L = Stdlib.Result.Result.Ok "000🍍🍍🍊🍊" + Stdlib.String.padStart "🍍🍍🍊🍊" "0" 7L + == Stdlib.Result.Result.Ok("000🍍🍍🍊🍊") - Stdlib.String.padStart_v0 "żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" "0" 10L = Stdlib.Result.Result.Ok - "0żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" + Stdlib.String.padStart "żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" "0" 10L + == Stdlib.Result.Result.Ok("0żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿") - Stdlib.String.padStart_v0 "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" "0" 10L = Stdlib.Result.Result.Ok - "00000Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" + Stdlib.String.padStart "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" "0" 10L + == Stdlib.Result.Result.Ok("00000Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇") - Stdlib.String.padStart_v0 "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" "0" 20L = Stdlib.Result.Result.Ok - "0000﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" + Stdlib.String.padStart "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" "0" 20L + == Stdlib.Result.Result.Ok("0000﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽") - Stdlib.String.padStart_v0 "👱👱🏻👱🏼👱🏽👱🏾👱🏿" "0" 10L = Stdlib.Result.Result.Ok - "0000👱👱🏻👱🏼👱🏽👱🏾👱🏿" + Stdlib.String.padStart "👱👱🏻👱🏼👱🏽👱🏾👱🏿" "0" 10L + == Stdlib.Result.Result.Ok("0000👱👱🏻👱🏼👱🏽👱🏾👱🏿") - Stdlib.String.padStart_v0 "🧟‍♀️🧟‍♂️" "0" 5L = Stdlib.Result.Result.Ok - "000🧟‍♀️🧟‍♂️" + Stdlib.String.padStart "🧟‍♀️🧟‍♂️" "0" 5L + == Stdlib.Result.Result.Ok("000🧟‍♀️🧟‍♂️") - Stdlib.String.padStart_v0 "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️🇵🇷" "0" 10L = Stdlib.Result.Result.Ok - "000000👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️🇵🇷" + Stdlib.String.padStart "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️🇵🇷" "0" 10L + == Stdlib.Result.Result.Ok("000000👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️🇵🇷") - Stdlib.String.padStart_v0 "鷝" "觌഻" 0L = Stdlib.Result.Result.Ok "鷝" + Stdlib.String.padStart "鷝" "觌഻" 0L == Stdlib.Result.Result.Ok("鷝") module PadEnd = - Stdlib.String.padEnd_v0 "123" "0" 3L = Stdlib.Result.Result.Ok "123" + Stdlib.String.padEnd "123" "0" 3L == Stdlib.Result.Result.Ok("123") - Stdlib.String.padEnd_v0 "123" "0" -3L = Stdlib.Result.Result.Ok "123" + Stdlib.String.padEnd "123" "0" -3L == Stdlib.Result.Result.Ok("123") - Stdlib.String.padEnd_v0 "123" "_-" 3L = Stdlib.Result.Result.Error + Stdlib.String.padEnd "123" "_-" 3L + == Stdlib.Result.Result.Error( "Expected `padWith` to be 1 character long, but it was `\"_-\"`" + ) - Stdlib.String.padEnd_v0 "123" "" 10L = Stdlib.Result.Result.Error + Stdlib.String.padEnd "123" "" 10L + == Stdlib.Result.Result.Error( "Expected `padWith` to be 1 character long, but it was `\"\"`" + ) - Stdlib.String.padEnd_v0 "123" "0" 6L = Stdlib.Result.Result.Ok "123000" + Stdlib.String.padEnd "123" "0" 6L == Stdlib.Result.Result.Ok("123000") - Stdlib.String.padEnd_v0 "" "0" 0L = Stdlib.Result.Result.Ok "" + Stdlib.String.padEnd "" "0" 0L == Stdlib.Result.Result.Ok("") - Stdlib.String.padEnd_v0 "123🍊🍊" "0" 8L = Stdlib.Result.Result.Ok "123🍊🍊000" + Stdlib.String.padEnd "123🍊🍊" "0" 8L == Stdlib.Result.Result.Ok("123🍊🍊000") - Stdlib.String.padEnd_v0 "żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" "0" 10L = Stdlib.Result.Result.Ok - "żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿0" + Stdlib.String.padEnd "żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" "0" 10L + == Stdlib.Result.Result.Ok("żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿0") - Stdlib.String.padEnd_v0 "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" "0" 10L = Stdlib.Result.Result.Ok - "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇00000" + Stdlib.String.padEnd "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" "0" 10L + == Stdlib.Result.Result.Ok("Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇00000") - Stdlib.String.padEnd_v0 "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" "0" 20L = Stdlib.Result.Result.Ok - "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽0000" + Stdlib.String.padEnd "﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽" "0" 20L + == Stdlib.Result.Result.Ok("﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽﷽0000") - Stdlib.String.padEnd_v0 "👱👱🏻👱🏼👱🏽👱🏾👱🏿" "0" 10L = Stdlib.Result.Result.Ok - "👱👱🏻👱🏼👱🏽👱🏾👱🏿0000" + Stdlib.String.padEnd "👱👱🏻👱🏼👱🏽👱🏾👱🏿" "0" 10L + == Stdlib.Result.Result.Ok("👱👱🏻👱🏼👱🏽👱🏾👱🏿0000") - Stdlib.String.padEnd_v0 "🧟‍♀️🧟‍♂️" "0" 5L = Stdlib.Result.Result.Ok - "🧟‍♀️🧟‍♂️000" + Stdlib.String.padEnd "🧟‍♀️🧟‍♂️" "0" 5L + == Stdlib.Result.Result.Ok("🧟‍♀️🧟‍♂️000") - Stdlib.String.padEnd_v0 "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️🇵🇷" "0" 10L = Stdlib.Result.Result.Ok - "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️🇵🇷000000" + Stdlib.String.padEnd "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️🇵🇷" "0" 10L + == Stdlib.Result.Result.Ok("👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️🇵🇷000000") - Stdlib.String.padEnd_v0 "鷝" "觌഻" 0L = Stdlib.Result.Result.Ok "鷝" + Stdlib.String.padEnd "鷝" "觌഻" 0L == Stdlib.Result.Result.Ok("鷝") module IndexOf = - Stdlib.String.indexOf_v0 "hello world" "world" = Stdlib.Option.Option.Some 6L + Stdlib.String.indexOf "hello world" "world" == Stdlib.Option.Option.Some(6L) - Stdlib.String.indexOf_v0 "hello world" "earth" = Stdlib.Option.Option.None + Stdlib.String.indexOf "hello world" "earth" == Stdlib.Option.Option.None() - Stdlib.String.indexOf_v0 "" "" = Stdlib.Option.Option.Some 0L + Stdlib.String.indexOf "" "" == Stdlib.Option.Option.Some(0L) - Stdlib.String.indexOf_v0 "hello" "" = Stdlib.Option.Option.Some 0L + Stdlib.String.indexOf "hello" "" == Stdlib.Option.Option.Some(0L) - Stdlib.String.indexOf_v0 "" "hello" = Stdlib.Option.Option.None + Stdlib.String.indexOf "" "hello" == Stdlib.Option.Option.None() - Stdlib.String.indexOf_v0 "👱👱🏻👱🏼👱🏽👱🏾👱🏿" "👱🏼👱🏽" = Stdlib.Option.Option.Some - 6L + Stdlib.String.indexOf "👱👱🏻👱🏼👱🏽👱🏾👱🏿" "👱🏼👱🏽" + == Stdlib.Option.Option.Some(6L) - Stdlib.String.indexOf_v0 "👱👱🏻👱🏼👱🏽👱🏾👱🏿" "👱🏼👱🏿" = Stdlib.Option.Option.None + Stdlib.String.indexOf "👱👱🏻👱🏼👱🏽👱🏾👱🏿" "👱🏼👱🏿" + == Stdlib.Option.Option.None() - Stdlib.String.indexOf_v0 "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" "👩‍👩‍👧‍👦" = Stdlib.Option.Option.Some - 11L + Stdlib.String.indexOf "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" "👩‍👩‍👧‍👦" + == Stdlib.Option.Option.Some(11L) - Stdlib.String.indexOf_v0 "żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" "🧑🏽‍🦰" = Stdlib.Option.Option.Some - 4L + Stdlib.String.indexOf "żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" "🧑🏽‍🦰" + == Stdlib.Option.Option.Some(4L) - Stdlib.String.indexOf_v0 "żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" "👱🏽" = Stdlib.Option.Option.None + Stdlib.String.indexOf "żółw🧑🏽‍🦰🧑🏻‍🍼✋✋🏻✋🏿" "👱🏽" + == Stdlib.Option.Option.None() - Stdlib.String.indexOf_v0 "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" "🧑🏻‍🍼" = Stdlib.Option.Option.None + Stdlib.String.indexOf "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷" "🧑🏻‍🍼" + == Stdlib.Option.Option.None() module Ellipsis = - Stdlib.String.ellipsis_v0 "hello world" 5L = "hello..." - Stdlib.String.ellipsis_v0 "hello world" 9L = "hello wor..." - Stdlib.String.ellipsis_v0 "hello world" 11L = "hello world" - Stdlib.String.ellipsis_v0 "hello world" 12L = "hello world" - Stdlib.String.ellipsis_v0 "👱👱🏻👱🏼👱🏽👱🏾👱🏿" 5L = "👱👱🏻👱🏼👱🏽👱🏾..." - Stdlib.String.ellipsis_v0 "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" 3L = "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫ..." - Stdlib.String.ellipsis_v0 "👩‍👩‍👧‍👦" 2L = "👩‍👩‍👧‍👦" + Stdlib.String.ellipsis "hello world" 5L == "hello..." + Stdlib.String.ellipsis "hello world" 9L == "hello wor..." + Stdlib.String.ellipsis "hello world" 11L == "hello world" + Stdlib.String.ellipsis "hello world" 12L == "hello world" + Stdlib.String.ellipsis "👱👱🏻👱🏼👱🏽👱🏾👱🏿" 5L == "👱👱🏻👱🏼👱🏽👱🏾..." + + Stdlib.String.ellipsis "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫǧ̗͚̚o̙̔ͮ̇͐̇" 3L + == "Z̤͔ͧ̑̓ä͖̭̈̇lͮ̒ͫ..." + + Stdlib.String.ellipsis "👩‍👩‍👧‍👦" 2L == "👩‍👩‍👧‍👦" - Stdlib.String.ellipsis_v0 "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷✋✋🏻✋🏿" 4L = "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷..." + Stdlib.String.ellipsis "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷✋✋🏻✋🏿" 4L + == "👨‍❤️‍💋‍👨👩‍👩‍👧‍👦🏳️‍⚧️‍️🇵🇷..." module Head = - Stdlib.String.head "hello world" = Stdlib.Option.Option.Some 'h' + Stdlib.String.head "hello world" == Stdlib.Option.Option.Some('h') - Stdlib.String.head "" = Stdlib.Option.Option.None + Stdlib.String.head "" == Stdlib.Option.Option.None() // Commented out as Fantomas doesn't like unicode "characters" -// Stdlib.String.head "👱👱🏻👱🏼👱🏽👱🏾👱🏿" = Stdlib.Option.Option.Some '👱' -// Stdlib.String.head "🧟‍♀️🧟‍♂️" = Stdlib.Option.Option.Some '🧟' -// Stdlib.String.head "👨‍❤️‍💋‍👨" = Stdlib.Option.Option.Some '👨‍❤️‍💋‍👨' +// Stdlib.String.head "👱👱🏻👱🏼👱🏽👱🏾👱🏿" == Stdlib.Option.Option.Some('👱') +// Stdlib.String.head "🧟‍♀️🧟‍♂️" == Stdlib.Option.Option.Some('🧟') +// Stdlib.String.head "👨‍❤️‍💋‍👨" == Stdlib.Option.Option.Some('👨‍❤️‍💋‍👨') module ArticleFor = - Stdlib.String.articleFor "apple" = "an" - Stdlib.String.articleFor "banana" = "a" - Stdlib.String.articleFor "🍍" = "a" - Stdlib.String.articleFor "🍊" = "a" - Stdlib.String.articleFor "" = "" \ No newline at end of file + Stdlib.String.articleFor "apple" == "an" + Stdlib.String.articleFor "banana" == "a" + Stdlib.String.articleFor "🍍" == "a" + Stdlib.String.articleFor "🍊" == "a" + Stdlib.String.articleFor "" == "" \ No newline at end of file diff --git a/backend/testfiles/execution/stdlib/tuple.dark b/backend/testfiles/execution/stdlib/tuple.dark index 73d7228279..09e553b9a5 100644 --- a/backend/testfiles/execution/stdlib/tuple.dark +++ b/backend/testfiles/execution/stdlib/tuple.dark @@ -1,77 +1,77 @@ // Tuple2 -Stdlib.Tuple2.create "one" 2L = ("one", 2L) -Stdlib.Tuple2.create 1L "two" = (1L, "two") +Stdlib.Tuple2.create "one" 2L == ("one", 2L) +Stdlib.Tuple2.create 1L "two" == (1L, "two") -Stdlib.Tuple2.first ("one", 2L) = "one" -Stdlib.Tuple2.first (1L, "two") = 1L -Stdlib.Tuple2.second ("one", 2L) = 2L -Stdlib.Tuple2.second (1L, "two") = "two" +Stdlib.Tuple2.first ("one", 2L) == "one" +Stdlib.Tuple2.first (1L, "two") == 1L +Stdlib.Tuple2.second ("one", 2L) == 2L +Stdlib.Tuple2.second (1L, "two") == "two" -Stdlib.Tuple2.swap ("one", 2L) = (2L, "one") -Stdlib.Tuple2.swap (1L, "two") = ("two", 1L) +Stdlib.Tuple2.swap ("one", 2L) == (2L, "one") +Stdlib.Tuple2.swap (1L, "two") == ("two", 1L) -Stdlib.Tuple2.swap (Stdlib.Tuple2.swap ("two swaps", "back to original")) = ("two swaps", - "back to original") +Stdlib.Tuple2.swap (Stdlib.Tuple2.swap ("two swaps", "back to original")) +== ("two swaps", "back to original") -Stdlib.Tuple2.mapFirst (fun x -> Stdlib.String.toUppercase x) ("one", 2L) = ("ONE", - 2L) +Stdlib.Tuple2.mapFirst (fun x -> Stdlib.String.toUppercase x) ("one", 2L) +== ("ONE", 2L) -Stdlib.Tuple2.mapFirst (fun x -> x - 2L) (1L, "two") = (-1L, "two") -Stdlib.Tuple2.mapSecond (fun x -> x - 2L) ("one", 2L) = ("one", 0L) +Stdlib.Tuple2.mapFirst (fun x -> x - 2L) (1L, "two") == (-1L, "two") +Stdlib.Tuple2.mapSecond (fun x -> x - 2L) ("one", 2L) == ("one", 0L) -Stdlib.Tuple2.mapSecond (fun x -> Stdlib.String.toUppercase x) (1L, "two") = (1L, - "TWO") +Stdlib.Tuple2.mapSecond (fun x -> Stdlib.String.toUppercase x) (1L, "two") +== (1L, "TWO") Stdlib.Tuple2.mapBoth (fun x -> Stdlib.String.toUppercase x) (fun x -> x - 2L) - ("one", 2L) = ("ONE", 0L) + ("one", 2L) +== ("ONE", 0L) Stdlib.Tuple2.mapBoth (fun x -> x - 2L) (fun x -> Stdlib.String.toUppercase x) - (1L, "two") = (-1L, "TWO") + (1L, "two") +== (-1L, "TWO") // Tuple3 -Stdlib.Tuple3.create "one" 2L "pi" = ("one", 2L, "pi") -Stdlib.Tuple3.create 1L "two" 3.14 = (1L, "two", 3.14) +Stdlib.Tuple3.create "one" 2L "pi" == ("one", 2L, "pi") +Stdlib.Tuple3.create 1L "two" 3.14 == (1L, "two", 3.14) -Stdlib.Tuple3.first (1L, "two", 3.14) = 1L -Stdlib.Tuple3.first ("one", 2L, "pi") = "one" -Stdlib.Tuple3.second (1L, "two", 3.14) = "two" -Stdlib.Tuple3.second ("one", 2L, "pi") = 2L -Stdlib.Tuple3.third (1L, "two", 3.14) = 3.14 -Stdlib.Tuple3.third ("one", 2L, "pi") = "pi" +Stdlib.Tuple3.first (1L, "two", 3.14) == 1L +Stdlib.Tuple3.first ("one", 2L, "pi") == "one" +Stdlib.Tuple3.second (1L, "two", 3.14) == "two" +Stdlib.Tuple3.second ("one", 2L, "pi") == 2L +Stdlib.Tuple3.third (1L, "two", 3.14) == 3.14 +Stdlib.Tuple3.third ("one", 2L, "pi") == "pi" -Stdlib.Tuple3.mapFirst (fun x -> Stdlib.String.toUppercase x) ("one", 2L, "pi") = ("ONE", - 2L, - "pi") +Stdlib.Tuple3.mapFirst (fun x -> Stdlib.String.toUppercase x) ("one", 2L, "pi") +== ("ONE", 2L, "pi") -Stdlib.Tuple3.mapFirst (fun x -> x - 2L) (1L, "two", 3.14) = (-1L, "two", 3.14) +Stdlib.Tuple3.mapFirst (fun x -> x - 2L) (1L, "two", 3.14) == (-1L, "two", 3.14) -Stdlib.Tuple3.mapSecond (fun x -> x - 2L) ("one", 2L, "pi") = ("one", 0L, "pi") +Stdlib.Tuple3.mapSecond (fun x -> x - 2L) ("one", 2L, "pi") == ("one", 0L, "pi") -Stdlib.Tuple3.mapSecond (fun x -> Stdlib.String.toUppercase x) (1L, "two", 3.14) = (1L, - "TWO", - 3.14) +Stdlib.Tuple3.mapSecond (fun x -> Stdlib.String.toUppercase x) (1L, "two", 3.14) +== (1L, "TWO", 3.14) -Stdlib.Tuple3.mapThird (fun x -> Stdlib.String.toUppercase x) ("one", 2L, "pi") = ("one", - 2L, - "PI") +Stdlib.Tuple3.mapThird (fun x -> Stdlib.String.toUppercase x) ("one", 2L, "pi") +== ("one", 2L, "PI") -Stdlib.Tuple3.mapThird (fun x -> Stdlib.Float.roundDown_v0 x) (1L, "two", 3.14) = (1L, - "two", - 3L) +Stdlib.Tuple3.mapThird (fun x -> Stdlib.Float.roundDown x) (1L, "two", 3.14) +== (1L, "two", 3L) Stdlib.Tuple3.mapAllThree (fun x -> Stdlib.String.toUppercase x) (fun x -> x - 2L) (fun x -> Stdlib.String.toUppercase x) - ("one", 2L, "pi") = ("ONE", 0L, "PI") + ("one", 2L, "pi") +== ("ONE", 0L, "PI") Stdlib.Tuple3.mapAllThree (fun x -> x - 2L) (fun x -> Stdlib.String.toUppercase x) - (fun x -> Stdlib.Float.roundDown_v0 x) - (1L, "two", 3.14) = (-1L, "TWO", 3L) \ No newline at end of file + (fun x -> Stdlib.Float.roundDown x) + (1L, "two", 3.14) +== (-1L, "TWO", 3L) \ No newline at end of file diff --git a/backend/testfiles/execution/stdlib/uint128.dark b/backend/testfiles/execution/stdlib/uint128.dark index 80dfde6acc..138abc57b8 100644 --- a/backend/testfiles/execution/stdlib/uint128.dark +++ b/backend/testfiles/execution/stdlib/uint128.dark @@ -1,162 +1,157 @@ -Stdlib.UInt128.max_v0 5Z 6Z = 6Z -Stdlib.UInt128.max_v0 10Z 1Z = 10Z +Stdlib.UInt128.max 5Z 6Z == 6Z +Stdlib.UInt128.max 10Z 1Z == 10Z -Stdlib.UInt128.min_v0 5Z 6Z = 5Z -Stdlib.UInt128.min_v0 10Z 10Z = 10Z -Stdlib.UInt128.min_v0 340282366920938463463374607431768211455Z 0Z = 0Z +Stdlib.UInt128.min 5Z 6Z == 5Z +Stdlib.UInt128.min 10Z 10Z == 10Z +Stdlib.UInt128.min 340282366920938463463374607431768211455Z 0Z == 0Z -Stdlib.UInt128.clamp_v0 1Z 2Z 1Z = 1Z -Stdlib.UInt128.clamp_v0 3Z 0Z 2Z = 2Z -Stdlib.UInt128.clamp_v0 100Z 0Z 0Z = 0Z -Stdlib.UInt128.clamp_v0 100Z 1Z 0Z = 1Z +Stdlib.UInt128.clamp 1Z 2Z 1Z == 1Z +Stdlib.UInt128.clamp 3Z 0Z 2Z == 2Z +Stdlib.UInt128.clamp 100Z 0Z 0Z == 0Z +Stdlib.UInt128.clamp 100Z 1Z 0Z == 1Z -Stdlib.UInt128.add_v0 10Z 9Z = 19Z -Stdlib.UInt128.add_v0 88Z 9Z = 97Z -Stdlib.UInt128.add_v0 1Z 0Z = 1Z -Stdlib.UInt128.add_v0 55Z 55Z = 110Z -Stdlib.UInt128.add_v0 9223372036854775807Z 2Z = 9223372036854775809Z +Stdlib.UInt128.add 10Z 9Z == 19Z +Stdlib.UInt128.add 88Z 9Z == 97Z +Stdlib.UInt128.add 1Z 0Z == 1Z +Stdlib.UInt128.add 55Z 55Z == 110Z +Stdlib.UInt128.add 9223372036854775807Z 2Z == 9223372036854775809Z -Stdlib.UInt128.add_v0 170141183460469231731687303715884105726Z 4Z = 170141183460469231731687303715884105730Z +Stdlib.UInt128.add 170141183460469231731687303715884105726Z 4Z == 170141183460469231731687303715884105730Z -Stdlib.UInt128.add_v0 340282366920938463463374607431768211455Z 1Z = Builtin.testDerrorMessage +Stdlib.UInt128.add 340282366920938463463374607431768211455Z 1Z == Builtin.testDerrorMessage "Out of range" -Stdlib.UInt128.subtract_v0 10Z 9Z = 1Z -Stdlib.UInt128.subtract_v0 88Z 9Z = 79Z -Stdlib.UInt128.subtract_v0 1Z 0Z = 1Z +Stdlib.UInt128.subtract 10Z 9Z == 1Z +Stdlib.UInt128.subtract 88Z 9Z == 79Z +Stdlib.UInt128.subtract 1Z 0Z == 1Z -Stdlib.UInt128.multiply_v0 8Z 8Z = 64Z -Stdlib.UInt128.multiply_v0 1Z 0Z = 0Z +Stdlib.UInt128.multiply 8Z 8Z == 64Z +Stdlib.UInt128.multiply 1Z 0Z == 0Z -Stdlib.UInt128.multiply_v0 340282366920938463463374607431768211455Z 2Z = Builtin.testDerrorMessage +Stdlib.UInt128.multiply 340282366920938463463374607431768211455Z 2Z == Builtin.testDerrorMessage "Out of range" -Stdlib.UInt128.divide_v0 10Z 5Z = 2Z -Stdlib.UInt128.divide_v0 17Z 3Z = 5Z -Stdlib.UInt128.divide_v0 0Z 1Z = 0Z +Stdlib.UInt128.divide 10Z 5Z == 2Z +Stdlib.UInt128.divide 17Z 3Z == 5Z +Stdlib.UInt128.divide 0Z 1Z == 0Z -Stdlib.UInt128.divide_v0 1Z 0Z = Builtin.testDerrorMessage "Division by zero" +Stdlib.UInt128.divide 1Z 0Z == Builtin.testDerrorMessage "Division by zero" -Stdlib.UInt128.greaterThan_v0 20Z 1Z = true +Stdlib.UInt128.greaterThan 20Z 1Z == true -Stdlib.UInt128.greaterThan_v0 (20Z) (170141183460469231731687303715884105727Z) = false +Stdlib.UInt128.greaterThan (20Z) (170141183460469231731687303715884105727Z) == false -Stdlib.UInt128.greaterThanOrEqualTo_v0 0Z 1Z = false -Stdlib.UInt128.greaterThanOrEqualTo_v0 1Z 0Z = true -Stdlib.UInt128.greaterThanOrEqualTo_v0 6Z 1Z = true -Stdlib.UInt128.greaterThanOrEqualTo_v0 6Z 8Z = false +Stdlib.UInt128.greaterThanOrEqualTo 0Z 1Z == false +Stdlib.UInt128.greaterThanOrEqualTo 1Z 0Z == true +Stdlib.UInt128.greaterThanOrEqualTo 6Z 1Z == true +Stdlib.UInt128.greaterThanOrEqualTo 6Z 8Z == false -Stdlib.UInt128.lessThanOrEqualTo_v0 6Z 8Z = true -Stdlib.UInt128.lessThanOrEqualTo_v0 10Z 1Z = false -Stdlib.UInt128.lessThanOrEqualTo_v0 0Z 1Z = true -Stdlib.UInt128.lessThanOrEqualTo_v0 1Z 0Z = false +Stdlib.UInt128.lessThanOrEqualTo 6Z 8Z == true +Stdlib.UInt128.lessThanOrEqualTo 10Z 1Z == false +Stdlib.UInt128.lessThanOrEqualTo 0Z 1Z == true +Stdlib.UInt128.lessThanOrEqualTo 1Z 0Z == false -Stdlib.UInt128.lessThan_v0 6Z 8Z = true -Stdlib.UInt128.lessThan_v0 10Z 1Z = false -Stdlib.UInt128.lessThan_v0 0Z 1Z = true -Stdlib.UInt128.lessThan_v0 1Z 0Z = false +Stdlib.UInt128.lessThan 6Z 8Z == true +Stdlib.UInt128.lessThan 10Z 1Z == false +Stdlib.UInt128.lessThan 0Z 1Z == true +Stdlib.UInt128.lessThan 1Z 0Z == false -Stdlib.UInt128.toString 0Z = "0" -Stdlib.UInt128.toString 1Z = "1" -Stdlib.UInt128.toString 340282366920938463463374607431768211455Z = "340282366920938463463374607431768211455" +Stdlib.UInt128.toString 0Z == "0" +Stdlib.UInt128.toString 1Z == "1" +Stdlib.UInt128.toString 340282366920938463463374607431768211455Z == "340282366920938463463374607431768211455" -Stdlib.UInt128.toFloat_v0 2Z = 2.0 -Stdlib.UInt128.toFloat_v0 340282366920938463463374607431768211455Z = 340282366920938463463374607431768211455.0 +Stdlib.UInt128.toFloat 2Z == 2.0 +Stdlib.UInt128.toFloat 340282366920938463463374607431768211455Z == 340282366920938463463374607431768211455.0 -Stdlib.UInt128.sqrt_v0 4Z = 2.0 -Stdlib.UInt128.sqrt_v0 100Z = 10.0 -Stdlib.UInt128.sqrt_v0 86Z = 9.273618495495704 +Stdlib.UInt128.sqrt 4Z == 2.0 +Stdlib.UInt128.sqrt 100Z == 10.0 +Stdlib.UInt128.sqrt 86Z == 9.273618495495704 -Stdlib.UInt128.mod_v0 15Z 5Z = 0Z -Stdlib.UInt128.mod_v0 15Z 6Z = 3Z -Stdlib.UInt128.mod_v0 0Z 15Z = 0Z -Stdlib.UInt128.mod_v0 127Z 3Z = 1Z +Stdlib.UInt128.mod 15Z 5Z == 0Z +Stdlib.UInt128.mod 15Z 6Z == 3Z +Stdlib.UInt128.mod 0Z 15Z == 0Z +Stdlib.UInt128.mod 127Z 3Z == 1Z -Stdlib.UInt128.mod_v0 5Z 0Z = Builtin.testDerrorMessage "Zero modulus" +Stdlib.UInt128.mod 5Z 0Z == Builtin.testDerrorMessage "Zero modulus" -Stdlib.UInt128.parse_v0 "0" = Stdlib.Result.Result.Ok(0Z) +Stdlib.UInt128.parse "0" == Stdlib.Result.Result.Ok(0Z) -Stdlib.UInt128.parse_v0 "1" = Stdlib.Result.Result.Ok(1Z) +Stdlib.UInt128.parse "1" == Stdlib.Result.Result.Ok(1Z) -Stdlib.UInt128.parse_v0 " 1" = Stdlib.Result.Result.Ok(1Z) +Stdlib.UInt128.parse " 1" == Stdlib.Result.Result.Ok(1Z) -Stdlib.UInt128.parse_v0 "1 " = Stdlib.Result.Result.Ok(1Z) +Stdlib.UInt128.parse "1 " == Stdlib.Result.Result.Ok(1Z) -Stdlib.UInt128.parse_v0 "+1" = Stdlib.Result.Result.Ok(1Z) +Stdlib.UInt128.parse "+1" == Stdlib.Result.Result.Ok(1Z) -Stdlib.UInt128.parse_v0 " +1 " = Stdlib.Result.Result.Ok(1Z) +Stdlib.UInt128.parse " +1 " == Stdlib.Result.Result.Ok(1Z) -Stdlib.UInt128.parse_v0 "078" = Stdlib.Result.Result.Ok(78Z) // "octal" format ignored +Stdlib.UInt128.parse "078" == Stdlib.Result.Result.Ok(78Z) // "octal" format ignored -Stdlib.UInt128.parse_v0 "170141183460469231731687303715884105727" = PACKAGE - .Darklang - .Stdlib - .Result - .Result - .Ok(170141183460469231731687303715884105727Z) +Stdlib.UInt128.parse "170141183460469231731687303715884105727" +== PACKAGE.Darklang.Stdlib.Result.Result.Ok(170141183460469231731687303715884105727Z) -Stdlib.UInt128.parse_v0 "170141183460469231731687303715884105729" = Stdlib.Result.Result.Ok - 170141183460469231731687303715884105729Z +Stdlib.UInt128.parse "170141183460469231731687303715884105729" == Stdlib.Result.Result.Ok(170141183460469231731687303715884105729Z) -Stdlib.UInt128.parse_v0 "1 2 3" = Stdlib.Result.Result.Error - Stdlib.UInt128.ParseError.BadFormat +Stdlib.UInt128.parse "1 2 3" == Stdlib.Result.Result.Error( + Stdlib.UInt128.ParseError.BadFormat) -Stdlib.UInt128.parse_v0 "+ 1" = Stdlib.Result.Result.Error - Stdlib.UInt128.ParseError.BadFormat +Stdlib.UInt128.parse "+ 1" == Stdlib.Result.Result.Error( + Stdlib.UInt128.ParseError.BadFormat) -Stdlib.UInt128.parse_v0 "0xA" = Stdlib.Result.Result.Error - Stdlib.UInt128.ParseError.BadFormat +Stdlib.UInt128.parse "0xA" == Stdlib.Result.Result.Error( + Stdlib.UInt128.ParseError.BadFormat) -Stdlib.UInt128.parse_v0 "0x123" = Stdlib.Result.Result.Error - Stdlib.UInt128.ParseError.BadFormat +Stdlib.UInt128.parse "0x123" == Stdlib.Result.Result.Error( + Stdlib.UInt128.ParseError.BadFormat) -Stdlib.UInt128.parse_v0 "0b0100" = Stdlib.Result.Result.Error - Stdlib.UInt128.ParseError.BadFormat +Stdlib.UInt128.parse "0b0100" == Stdlib.Result.Result.Error( + Stdlib.UInt128.ParseError.BadFormat) -Stdlib.UInt128.parse_v0 "pi" = Stdlib.Result.Result.Error - Stdlib.UInt128.ParseError.BadFormat +Stdlib.UInt128.parse "pi" == Stdlib.Result.Result.Error( + Stdlib.UInt128.ParseError.BadFormat) -Stdlib.UInt128.parse_v0 "Stdlib.Math.pi" = Stdlib.Result.Result.Error - Stdlib.UInt128.ParseError.BadFormat +Stdlib.UInt128.parse "Stdlib.Math.pi" == Stdlib.Result.Result.Error( + Stdlib.UInt128.ParseError.BadFormat) -Stdlib.UInt128.parse_v0 "1.23E+04" = Stdlib.Result.Result.Error - Stdlib.UInt128.ParseError.BadFormat +Stdlib.UInt128.parse "1.23E+04" == Stdlib.Result.Result.Error( + Stdlib.UInt128.ParseError.BadFormat) -Stdlib.UInt128.parse_v0 "" = Stdlib.Result.Result.Error - Stdlib.UInt128.ParseError.BadFormat +Stdlib.UInt128.parse "" == Stdlib.Result.Result.Error( + Stdlib.UInt128.ParseError.BadFormat) -Stdlib.UInt128.parse_v0 "1I" = Stdlib.Result.Result.Error - Stdlib.UInt128.ParseError.BadFormat +Stdlib.UInt128.parse "1I" == Stdlib.Result.Result.Error( + Stdlib.UInt128.ParseError.BadFormat) -Stdlib.UInt128.parse_v0 "one" = Stdlib.Result.Result.Error - Stdlib.UInt128.ParseError.BadFormat +Stdlib.UInt128.parse "one" == Stdlib.Result.Result.Error( + Stdlib.UInt128.ParseError.BadFormat) -Stdlib.UInt128.parse_v0 "XIV" = Stdlib.Result.Result.Error - Stdlib.UInt128.ParseError.BadFormat +Stdlib.UInt128.parse "XIV" == Stdlib.Result.Result.Error( + Stdlib.UInt128.ParseError.BadFormat) -Stdlib.UInt128.fromUInt8_v0 0uy = 0Z +Stdlib.UInt128.fromUInt8 0uy == 0Z -Stdlib.UInt128.fromUInt8_v0 1uy = 1Z +Stdlib.UInt128.fromUInt8 1uy == 1Z -Stdlib.UInt128.fromUInt8_v0 255uy = 255Z +Stdlib.UInt128.fromUInt8 255uy == 255Z -Stdlib.UInt128.fromUInt16_v0 0us = 0Z +Stdlib.UInt128.fromUInt16 0us == 0Z -Stdlib.UInt128.fromUInt16_v0 1us = 1Z +Stdlib.UInt128.fromUInt16 1us == 1Z -Stdlib.UInt128.fromUInt16_v0 65535us = 65535Z +Stdlib.UInt128.fromUInt16 65535us == 65535Z -Stdlib.UInt128.fromUInt32_v0 0ul = 0Z +Stdlib.UInt128.fromUInt32 0ul == 0Z -Stdlib.UInt128.fromUInt32_v0 1ul = 1Z +Stdlib.UInt128.fromUInt32 1ul == 1Z -Stdlib.UInt128.fromUInt32_v0 4294967295ul = 4294967295Z +Stdlib.UInt128.fromUInt32 4294967295ul == 4294967295Z -Stdlib.UInt128.fromUInt64_v0 0UL = 0Z +Stdlib.UInt128.fromUInt64 0UL == 0Z -Stdlib.UInt128.fromUInt64_v0 1UL = 1Z +Stdlib.UInt128.fromUInt64 1UL == 1Z -Stdlib.UInt128.fromUInt64_v0 18446744073709551615UL = 18446744073709551615Z \ No newline at end of file +Stdlib.UInt128.fromUInt64 18446744073709551615UL == 18446744073709551615Z \ No newline at end of file diff --git a/backend/testfiles/execution/stdlib/uint16.dark b/backend/testfiles/execution/stdlib/uint16.dark index 412ff90d98..e1d9947f59 100644 --- a/backend/testfiles/execution/stdlib/uint16.dark +++ b/backend/testfiles/execution/stdlib/uint16.dark @@ -1,259 +1,259 @@ -Stdlib.UInt16.max_v0 5us 6us = 6us -Stdlib.UInt16.max_v0 10us 1us = 10us -Stdlib.UInt16.max_v0 0us 6us = 6us -Stdlib.UInt16.max_v0 65535us 0us = 65535us +Stdlib.UInt16.max 5us 6us == 6us +Stdlib.UInt16.max 10us 1us == 10us +Stdlib.UInt16.max 0us 6us == 6us +Stdlib.UInt16.max 65535us 0us == 65535us -Stdlib.UInt16.min_v0 5us 6us = 5us -Stdlib.UInt16.min_v0 10us 10us = 10us -Stdlib.UInt16.min_v0 65535us 0us = 0us +Stdlib.UInt16.min 5us 6us == 5us +Stdlib.UInt16.min 10us 10us == 10us +Stdlib.UInt16.min 65535us 0us == 0us -Stdlib.UInt16.clamp_v0 1us 2us 1us = 1us -Stdlib.UInt16.clamp_v0 3us 0us 2us = 2us -Stdlib.UInt16.clamp_v0 100us 0us 0us = 0us -Stdlib.UInt16.clamp_v0 100us 0us 1us = 1us -Stdlib.UInt16.clamp_v0 100us 1us 0us = 1us +Stdlib.UInt16.clamp 1us 2us 1us == 1us +Stdlib.UInt16.clamp 3us 0us 2us == 2us +Stdlib.UInt16.clamp 100us 0us 0us == 0us +Stdlib.UInt16.clamp 100us 0us 1us == 1us +Stdlib.UInt16.clamp 100us 1us 0us == 1us -Stdlib.UInt16.add_v0 10us 9us = 19us -Stdlib.UInt16.add_v0 88us 9us = 97us -Stdlib.UInt16.add_v0 1us 0us = 1us -Stdlib.UInt16.add_v0 65534us 1us = 65535us +Stdlib.UInt16.add 10us 9us == 19us +Stdlib.UInt16.add 88us 9us == 97us +Stdlib.UInt16.add 1us 0us == 1us +Stdlib.UInt16.add 65534us 1us == 65535us -Stdlib.UInt16.add_v0 65535us 1us = Builtin.testDerrorMessage "Out of range" +Stdlib.UInt16.add 65535us 1us == Builtin.testDerrorMessage "Out of range" -Stdlib.UInt16.subtract_v0 10us 9us = 1us -Stdlib.UInt16.subtract_v0 88us 9us = 79us +Stdlib.UInt16.subtract 10us 9us == 1us +Stdlib.UInt16.subtract 88us 9us == 79us -Stdlib.UInt16.subtract_v0 0us 1us = Builtin.testDerrorMessage "Out of range" +Stdlib.UInt16.subtract 0us 1us == Builtin.testDerrorMessage "Out of range" -Stdlib.UInt16.subtract_v0 1us 0us = 1us -Stdlib.UInt16.subtract_v0 65535us 1us = 65534us +Stdlib.UInt16.subtract 1us 0us == 1us +Stdlib.UInt16.subtract 65535us 1us == 65534us -Stdlib.UInt16.multiply_v0 8us 8us = 64us -Stdlib.UInt16.multiply_v0 8us 0us = 0us -Stdlib.UInt16.multiply_v0 32767us 2us = 65534us +Stdlib.UInt16.multiply 8us 8us == 64us +Stdlib.UInt16.multiply 8us 0us == 0us +Stdlib.UInt16.multiply 32767us 2us == 65534us -Stdlib.UInt16.multiply_v0 32768us 2us = Builtin.testDerrorMessage "Out of range" +Stdlib.UInt16.multiply 32768us 2us == Builtin.testDerrorMessage "Out of range" -Stdlib.UInt16.multiply_v0 65535us 2us = Builtin.testDerrorMessage "Out of range" +Stdlib.UInt16.multiply 65535us 2us == Builtin.testDerrorMessage "Out of range" -Stdlib.UInt16.power_v0 2us 3us = 8us -Stdlib.UInt16.power_v0 0us 1us = 0us -Stdlib.UInt16.power_v0 1us 0us = 1us -Stdlib.UInt16.power_v0 0us 0us = 1us -Stdlib.UInt16.power_v0 1us 255us = 1us +Stdlib.UInt16.power 2us 3us == 8us +Stdlib.UInt16.power 0us 1us == 0us +Stdlib.UInt16.power 1us 0us == 1us +Stdlib.UInt16.power 0us 0us == 1us +Stdlib.UInt16.power 1us 255us == 1us -Stdlib.UInt16.power_v0 256us 2us = Builtin.testDerrorMessage "Out of range" +Stdlib.UInt16.power 256us 2us == Builtin.testDerrorMessage "Out of range" -Stdlib.UInt16.divide_v0 10us 5us = 2us -Stdlib.UInt16.divide_v0 17us 3us = 5us -Stdlib.UInt16.divide_v0 8us 5us = 1us -Stdlib.UInt16.divide_v0 0us 1us = 0us -Stdlib.UInt16.divide_v0 65535us 2us = 32767us +Stdlib.UInt16.divide 10us 5us == 2us +Stdlib.UInt16.divide 17us 3us == 5us +Stdlib.UInt16.divide 8us 5us == 1us +Stdlib.UInt16.divide 0us 1us == 0us +Stdlib.UInt16.divide 65535us 2us == 32767us -Stdlib.UInt16.divide_v0 1us 0us = Builtin.testDerrorMessage "Division by zero" +Stdlib.UInt16.divide 1us 0us == Builtin.testDerrorMessage "Division by zero" -Stdlib.UInt16.greaterThan_v0 20us 1us = true +Stdlib.UInt16.greaterThan 20us 1us == true -Stdlib.UInt16.greaterThanOrEqualTo_v0 0us 1us = false -Stdlib.UInt16.greaterThanOrEqualTo_v0 1us 0us = true -Stdlib.UInt16.greaterThanOrEqualTo_v0 6us 1us = true -Stdlib.UInt16.greaterThanOrEqualTo_v0 6us 8us = false -Stdlib.UInt16.greaterThanOrEqualTo_v0 65535us 0us = true -Stdlib.UInt16.greaterThanOrEqualTo_v0 0us 65535us = false +Stdlib.UInt16.greaterThanOrEqualTo 0us 1us == false +Stdlib.UInt16.greaterThanOrEqualTo 1us 0us == true +Stdlib.UInt16.greaterThanOrEqualTo 6us 1us == true +Stdlib.UInt16.greaterThanOrEqualTo 6us 8us == false +Stdlib.UInt16.greaterThanOrEqualTo 65535us 0us == true +Stdlib.UInt16.greaterThanOrEqualTo 0us 65535us == false -Stdlib.UInt16.lessThanOrEqualTo_v0 6us 8us = true -Stdlib.UInt16.lessThanOrEqualTo_v0 10us 1us = false -Stdlib.UInt16.lessThanOrEqualTo_v0 0us 1us = true -Stdlib.UInt16.lessThanOrEqualTo_v0 1us 0us = false -Stdlib.UInt16.lessThanOrEqualTo_v0 65535us 0us = false -Stdlib.UInt16.lessThanOrEqualTo_v0 0us 65535us = true -Stdlib.UInt16.lessThanOrEqualTo_v0 65535us 65535us = true +Stdlib.UInt16.lessThanOrEqualTo 6us 8us == true +Stdlib.UInt16.lessThanOrEqualTo 10us 1us == false +Stdlib.UInt16.lessThanOrEqualTo 0us 1us == true +Stdlib.UInt16.lessThanOrEqualTo 1us 0us == false +Stdlib.UInt16.lessThanOrEqualTo 65535us 0us == false +Stdlib.UInt16.lessThanOrEqualTo 0us 65535us == true +Stdlib.UInt16.lessThanOrEqualTo 65535us 65535us == true -Stdlib.UInt16.lessThan_v0 6us 8us = true -Stdlib.UInt16.lessThan_v0 10us 1us = false -Stdlib.UInt16.lessThan_v0 0us 1us = true -Stdlib.UInt16.lessThan_v0 1us 0us = false -Stdlib.UInt16.lessThan_v0 0us 65535us = true -Stdlib.UInt16.lessThan_v0 65535us 65535us = false +Stdlib.UInt16.lessThan 6us 8us == true +Stdlib.UInt16.lessThan 10us 1us == false +Stdlib.UInt16.lessThan 0us 1us == true +Stdlib.UInt16.lessThan 1us 0us == false +Stdlib.UInt16.lessThan 0us 65535us == true +Stdlib.UInt16.lessThan 65535us 65535us == false -Stdlib.UInt16.toString 120us = "120" -Stdlib.UInt16.toString 1us = "1" -Stdlib.UInt16.toString 0us = "0" // UInt16 lower limit -Stdlib.UInt16.toString 65535us = "65535" // UInt16 upper limit +Stdlib.UInt16.toString 120us == "120" +Stdlib.UInt16.toString 1us == "1" +Stdlib.UInt16.toString 0us == "0" // UInt16 lower limit +Stdlib.UInt16.toString 65535us == "65535" // UInt16 upper limit -Stdlib.UInt16.toFloat_v0 2us = 2.0 -Stdlib.UInt16.toFloat_v0 0us = 0.0 +Stdlib.UInt16.toFloat 2us == 2.0 +Stdlib.UInt16.toFloat 0us == 0.0 -Stdlib.UInt16.sqrt_v0 4us = 2.0 -Stdlib.UInt16.sqrt_v0 100us = 10.0 -Stdlib.UInt16.sqrt_v0 86us = 9.273618495495704 +Stdlib.UInt16.sqrt 4us == 2.0 +Stdlib.UInt16.sqrt 100us == 10.0 +Stdlib.UInt16.sqrt 86us == 9.273618495495704 -Stdlib.UInt16.mod_v0 15us 5us = 0us -Stdlib.UInt16.mod_v0 15us 6us = 3us -Stdlib.UInt16.mod_v0 0us 15us = 0us -Stdlib.UInt16.mod_v0 1us 2us = 1us -Stdlib.UInt16.mod_v0 32768us 53us = 14us -Stdlib.UInt16.mod_v0 65535us 3us = 0us +Stdlib.UInt16.mod 15us 5us == 0us +Stdlib.UInt16.mod 15us 6us == 3us +Stdlib.UInt16.mod 0us 15us == 0us +Stdlib.UInt16.mod 1us 2us == 1us +Stdlib.UInt16.mod 32768us 53us == 14us +Stdlib.UInt16.mod 65535us 3us == 0us -Stdlib.UInt16.mod_v0 5us 0us = Builtin.testDerrorMessage "Zero modulus" +Stdlib.UInt16.mod 5us 0us == Builtin.testDerrorMessage "Zero modulus" -(Stdlib.List.range_v0 1L 5L) -|> Stdlib.List.map_v0 (fun x -> Stdlib.UInt16.random 1us 2us) -|> Stdlib.List.map_v0 (fun x -> +(Stdlib.List.range 1L 5L) +|> Stdlib.List.map (fun x -> Stdlib.UInt16.random 1us 2us) +|> Stdlib.List.map (fun x -> (Stdlib.UInt16.greaterThanOrEqualTo x 1us) - && (Stdlib.UInt16.lessThanOrEqualTo x 2us)) = [ true; true; true; true; true ] + && (Stdlib.UInt16.lessThanOrEqualTo x 2us)) == [ true; true; true; true; true ] -(Stdlib.List.range_v0 1L 5L) -|> Stdlib.List.map_v0 (fun x -> Stdlib.UInt16.random 10us 20us) -|> Stdlib.List.map_v0 (fun x -> +(Stdlib.List.range 1L 5L) +|> Stdlib.List.map (fun x -> Stdlib.UInt16.random 10us 20us) +|> Stdlib.List.map (fun x -> (Stdlib.UInt16.greaterThanOrEqualTo x 10us) - && (Stdlib.UInt16.lessThanOrEqualTo x 20us)) = [ true; true; true; true; true ] + && (Stdlib.UInt16.lessThanOrEqualTo x 20us)) == [ true; true; true; true; true ] -(Stdlib.List.range_v0 1L 5L) -|> Stdlib.List.map_v0 (fun x -> Stdlib.UInt16.random 2us 1us) -|> Stdlib.List.map_v0 (fun x -> +(Stdlib.List.range 1L 5L) +|> Stdlib.List.map (fun x -> Stdlib.UInt16.random 2us 1us) +|> Stdlib.List.map (fun x -> (Stdlib.UInt16.greaterThanOrEqualTo x 1us) - && (Stdlib.UInt16.lessThanOrEqualTo x 2us)) = [ true; true; true; true; true ] + && (Stdlib.UInt16.lessThanOrEqualTo x 2us)) == [ true; true; true; true; true ] -(Stdlib.List.range_v0 1L 5L) -|> Stdlib.List.map_v0 (fun x -> Stdlib.UInt16.random 20us 10us) -|> Stdlib.List.map_v0 (fun x -> +(Stdlib.List.range 1L 5L) +|> Stdlib.List.map (fun x -> Stdlib.UInt16.random 20us 10us) +|> Stdlib.List.map (fun x -> (Stdlib.UInt16.greaterThanOrEqualTo x 10us) - && (Stdlib.UInt16.lessThanOrEqualTo x 20us)) = [ true; true; true; true; true ] + && (Stdlib.UInt16.lessThanOrEqualTo x 20us)) == [ true; true; true; true; true ] -((Stdlib.List.range_v0 1L 100L) - |> Stdlib.List.map_v0 (fun x -> Stdlib.UInt16.random 0us 1us) - |> Stdlib.List.unique_v0) = [ 0us; 1us ] +((Stdlib.List.range 1L 100L) + |> Stdlib.List.map (fun x -> Stdlib.UInt16.random 0us 1us) + |> Stdlib.List.unique) == [ 0us; 1us ] -((Stdlib.List.range_v0 1L 100L) - |> Stdlib.List.map_v0 (fun x -> Stdlib.UInt16.random 0us 2us) - |> Stdlib.List.unique_v0) = [ 0us; 1us; 2us ] +((Stdlib.List.range 1L 100L) + |> Stdlib.List.map (fun x -> Stdlib.UInt16.random 0us 2us) + |> Stdlib.List.unique) == [ 0us; 1us; 2us ] -Stdlib.UInt16.sum_v0 [ 1us; 2us ] = 3us +Stdlib.UInt16.sum [ 1us; 2us ] == 3us -Stdlib.UInt16.sum_v0 [ 1us; 65535us ] = Builtin.testDerrorMessage "Out of range" +Stdlib.UInt16.sum [ 1us; 65535us ] == Builtin.testDerrorMessage "Out of range" -Stdlib.UInt16.parse_v0 "-129" = Stdlib.Result.Result.Error - Stdlib.UInt16.ParseError.OutOfRange +Stdlib.UInt16.parse "-129" == Stdlib.Result.Result.Error( + Stdlib.UInt16.ParseError.OutOfRange()) -Stdlib.UInt16.parse_v0 "65536" = Stdlib.Result.Result.Error - Stdlib.UInt16.ParseError.OutOfRange +Stdlib.UInt16.parse "65536" == Stdlib.Result.Result.Error( + Stdlib.UInt16.ParseError.OutOfRange()) -Stdlib.UInt16.parse_v0 "65536us" = Stdlib.Result.Result.Error - Stdlib.UInt16.ParseError.BadFormat +Stdlib.UInt16.parse "65536us" == Stdlib.Result.Result.Error( + Stdlib.UInt16.ParseError.BadFormat()) -Stdlib.UInt16.parse_v0 "1 2 3" = Stdlib.Result.Result.Error - Stdlib.UInt16.ParseError.BadFormat +Stdlib.UInt16.parse "1 2 3" == Stdlib.Result.Result.Error( + Stdlib.UInt16.ParseError.BadFormat()) -Stdlib.UInt16.parse_v0 "+ 1" = Stdlib.Result.Result.Error - Stdlib.UInt16.ParseError.BadFormat +Stdlib.UInt16.parse "+ 1" == Stdlib.Result.Result.Error( + Stdlib.UInt16.ParseError.BadFormat()) -Stdlib.UInt16.parse_v0 "- 1" = Stdlib.Result.Result.Error - Stdlib.UInt16.ParseError.BadFormat +Stdlib.UInt16.parse "- 1" == Stdlib.Result.Result.Error( + Stdlib.UInt16.ParseError.BadFormat()) -Stdlib.UInt16.parse_v0 "0xA" = Stdlib.Result.Result.Error - Stdlib.UInt16.ParseError.BadFormat +Stdlib.UInt16.parse "0xA" == Stdlib.Result.Result.Error( + Stdlib.UInt16.ParseError.BadFormat()) -Stdlib.UInt16.parse_v0 "0x123" = Stdlib.Result.Result.Error - Stdlib.UInt16.ParseError.BadFormat +Stdlib.UInt16.parse "0x123" == Stdlib.Result.Result.Error( + Stdlib.UInt16.ParseError.BadFormat()) -Stdlib.UInt16.parse_v0 "0b0100" = Stdlib.Result.Result.Error - Stdlib.UInt16.ParseError.BadFormat +Stdlib.UInt16.parse "0b0100" == Stdlib.Result.Result.Error( + Stdlib.UInt16.ParseError.BadFormat()) -Stdlib.UInt16.parse_v0 "pi" = Stdlib.Result.Result.Error - Stdlib.UInt16.ParseError.BadFormat +Stdlib.UInt16.parse "pi" == Stdlib.Result.Result.Error( + Stdlib.UInt16.ParseError.BadFormat()) -Stdlib.UInt16.parse_v0 "PACKAGE.Darklang.Stdlib.Math.pi" = Stdlib.Result.Result.Error - Stdlib.UInt16.ParseError.BadFormat +Stdlib.UInt16.parse "PACKAGE.Darklang.Stdlib.Math.pi" == Stdlib.Result.Result.Error( + Stdlib.UInt16.ParseError.BadFormat()) -Stdlib.UInt16.parse_v0 "1.23E+04" = Stdlib.Result.Result.Error - Stdlib.UInt16.ParseError.BadFormat +Stdlib.UInt16.parse "1.23E+04" == Stdlib.Result.Result.Error( + Stdlib.UInt16.ParseError.BadFormat()) -Stdlib.UInt16.parse_v0 "" = Stdlib.Result.Result.Error - Stdlib.UInt16.ParseError.BadFormat +Stdlib.UInt16.parse "" == Stdlib.Result.Result.Error( + Stdlib.UInt16.ParseError.BadFormat()) -Stdlib.UInt16.parse_v0 "1I" = Stdlib.Result.Result.Error - Stdlib.UInt16.ParseError.BadFormat +Stdlib.UInt16.parse "1I" == Stdlib.Result.Result.Error( + Stdlib.UInt16.ParseError.BadFormat()) -Stdlib.UInt16.parse_v0 "one" = Stdlib.Result.Result.Error - Stdlib.UInt16.ParseError.BadFormat +Stdlib.UInt16.parse "one" == Stdlib.Result.Result.Error( + Stdlib.UInt16.ParseError.BadFormat()) -Stdlib.UInt16.parse_v0 "XIV" = Stdlib.Result.Result.Error - Stdlib.UInt16.ParseError.BadFormat +Stdlib.UInt16.parse "XIV" == Stdlib.Result.Result.Error( + Stdlib.UInt16.ParseError.BadFormat()) -Stdlib.UInt16.fromInt8_v0 0y = Stdlib.Option.Option.Some 0us +Stdlib.UInt16.fromInt8 0y == Stdlib.Option.Option.Some(0us) -Stdlib.UInt16.fromInt8_v0 1y = Stdlib.Option.Option.Some 1us +Stdlib.UInt16.fromInt8 1y == Stdlib.Option.Option.Some(1us) -Stdlib.UInt16.fromInt8_v0 127y = Stdlib.Option.Option.Some 127us +Stdlib.UInt16.fromInt8 127y == Stdlib.Option.Option.Some(127us) -Stdlib.UInt16.fromInt8_v0 (-1y) = Stdlib.Option.Option.None -Stdlib.UInt16.fromInt8_v0 (-128y) = Stdlib.Option.Option.None +Stdlib.UInt16.fromInt8 (-1y) == Stdlib.Option.Option.None() +Stdlib.UInt16.fromInt8 (-128y) == Stdlib.Option.Option.None() -Stdlib.UInt16.fromUInt8_v0 0uy = 0us +Stdlib.UInt16.fromUInt8 0uy == 0us -Stdlib.UInt16.fromUInt8_v0 1uy = 1us +Stdlib.UInt16.fromUInt8 1uy == 1us -Stdlib.UInt16.fromUInt8_v0 255uy = 255us +Stdlib.UInt16.fromUInt8 255uy == 255us -Stdlib.UInt16.fromInt16_v0 0s = Stdlib.Option.Option.Some 0us +Stdlib.UInt16.fromInt16 0s == Stdlib.Option.Option.Some(0us) -Stdlib.UInt16.fromInt16_v0 1s = Stdlib.Option.Option.Some 1us +Stdlib.UInt16.fromInt16 1s == Stdlib.Option.Option.Some(1us) -Stdlib.UInt16.fromInt16_v0 32767s = Stdlib.Option.Option.Some 32767us +Stdlib.UInt16.fromInt16 32767s == Stdlib.Option.Option.Some(32767us) -Stdlib.UInt16.fromInt16_v0 (-1s) = Stdlib.Option.Option.None -Stdlib.UInt16.fromInt16_v0 (-32768s) = Stdlib.Option.Option.None +Stdlib.UInt16.fromInt16 (-1s) == Stdlib.Option.Option.None() +Stdlib.UInt16.fromInt16 (-32768s) == Stdlib.Option.Option.None() -Stdlib.UInt16.fromInt32_v0 0l = Stdlib.Option.Option.Some 0us +Stdlib.UInt16.fromInt32 0l == Stdlib.Option.Option.Some(0us) -Stdlib.UInt16.fromInt32_v0 1l = Stdlib.Option.Option.Some 1us +Stdlib.UInt16.fromInt32 1l == Stdlib.Option.Option.Some(1us) -Stdlib.UInt16.fromInt32_v0 65535l = Stdlib.Option.Option.Some 65535us +Stdlib.UInt16.fromInt32 65535l == Stdlib.Option.Option.Some(65535us) -Stdlib.UInt16.fromInt32_v0 65536l = Stdlib.Option.Option.None -Stdlib.UInt16.fromInt32_v0 (-1l) = Stdlib.Option.Option.None +Stdlib.UInt16.fromInt32 65536l == Stdlib.Option.Option.None() +Stdlib.UInt16.fromInt32 (-1l) == Stdlib.Option.Option.None() -Stdlib.UInt16.fromUInt32_v0 0ul = Stdlib.Option.Option.Some 0us +Stdlib.UInt16.fromUInt32 0ul == Stdlib.Option.Option.Some(0us) -Stdlib.UInt16.fromUInt32_v0 1ul = Stdlib.Option.Option.Some 1us +Stdlib.UInt16.fromUInt32 1ul == Stdlib.Option.Option.Some(1us) -Stdlib.UInt16.fromUInt32_v0 65535ul = Stdlib.Option.Option.Some 65535us +Stdlib.UInt16.fromUInt32 65535ul == Stdlib.Option.Option.Some(65535us) -Stdlib.UInt16.fromUInt32_v0 65536ul = Stdlib.Option.Option.None +Stdlib.UInt16.fromUInt32 65536ul == Stdlib.Option.Option.None() -Stdlib.UInt16.fromInt64_v0 0L = Stdlib.Option.Option.Some 0us +Stdlib.UInt16.fromInt64 0L == Stdlib.Option.Option.Some(0us) -Stdlib.UInt16.fromInt64_v0 1L = Stdlib.Option.Option.Some 1us +Stdlib.UInt16.fromInt64 1L == Stdlib.Option.Option.Some(1us) -Stdlib.UInt16.fromInt64_v0 65535L = Stdlib.Option.Option.Some 65535us +Stdlib.UInt16.fromInt64 65535L == Stdlib.Option.Option.Some(65535us) -Stdlib.UInt16.fromInt64_v0 65536L = Stdlib.Option.Option.None -Stdlib.UInt16.fromInt64_v0 (-1L) = Stdlib.Option.Option.None +Stdlib.UInt16.fromInt64 65536L == Stdlib.Option.Option.None() +Stdlib.UInt16.fromInt64 (-1L) == Stdlib.Option.Option.None() -Stdlib.UInt16.fromUInt64_v0 0UL = Stdlib.Option.Option.Some 0us +Stdlib.UInt16.fromUInt64 0UL == Stdlib.Option.Option.Some(0us) -Stdlib.UInt16.fromUInt64_v0 1UL = Stdlib.Option.Option.Some 1us +Stdlib.UInt16.fromUInt64 1UL == Stdlib.Option.Option.Some(1us) -Stdlib.UInt16.fromUInt64_v0 65535UL = Stdlib.Option.Option.Some 65535us +Stdlib.UInt16.fromUInt64 65535UL == Stdlib.Option.Option.Some(65535us) -Stdlib.UInt16.fromUInt64_v0 65536UL = Stdlib.Option.Option.None +Stdlib.UInt16.fromUInt64 65536UL == Stdlib.Option.Option.None() -Stdlib.UInt16.fromInt128_v0 0Q = Stdlib.Option.Option.Some 0us +Stdlib.UInt16.fromInt128 0Q == Stdlib.Option.Option.Some(0us) -Stdlib.UInt16.fromInt128_v0 1Q = Stdlib.Option.Option.Some 1us +Stdlib.UInt16.fromInt128 1Q == Stdlib.Option.Option.Some(1us) -Stdlib.UInt16.fromInt128_v0 65535Q = Stdlib.Option.Option.Some 65535us +Stdlib.UInt16.fromInt128 65535Q == Stdlib.Option.Option.Some(65535us) -Stdlib.UInt16.fromInt128_v0 65536Q = Stdlib.Option.Option.None -Stdlib.UInt16.fromInt128_v0 (-1Q) = Stdlib.Option.Option.None +Stdlib.UInt16.fromInt128 65536Q == Stdlib.Option.Option.None() +Stdlib.UInt16.fromInt128 (-1Q) == Stdlib.Option.Option.None() -Stdlib.UInt16.fromUInt128_v0 0Z = Stdlib.Option.Option.Some 0us +Stdlib.UInt16.fromUInt128 0Z == Stdlib.Option.Option.Some(0us) -Stdlib.UInt16.fromUInt128_v0 1Z = Stdlib.Option.Option.Some 1us +Stdlib.UInt16.fromUInt128 1Z == Stdlib.Option.Option.Some(1us) -Stdlib.UInt16.fromUInt128_v0 65535Z = Stdlib.Option.Option.Some 65535us +Stdlib.UInt16.fromUInt128 65535Z == Stdlib.Option.Option.Some(65535us) -Stdlib.UInt16.fromUInt128_v0 65536Z = Stdlib.Option.Option.None \ No newline at end of file +Stdlib.UInt16.fromUInt128 65536Z == Stdlib.Option.Option.None() \ No newline at end of file diff --git a/backend/testfiles/execution/stdlib/uint32.dark b/backend/testfiles/execution/stdlib/uint32.dark index bb7bf575ec..df7f157c51 100644 --- a/backend/testfiles/execution/stdlib/uint32.dark +++ b/backend/testfiles/execution/stdlib/uint32.dark @@ -1,254 +1,254 @@ -Stdlib.UInt32.max_v0 5ul 6ul = 6ul -Stdlib.UInt32.max_v0 10ul 1ul = 10ul -Stdlib.UInt32.max_v0 0ul 6ul = 6ul -Stdlib.UInt32.max_v0 4294967295ul 0ul = 4294967295ul +Stdlib.UInt32.max 5ul 6ul == 6ul +Stdlib.UInt32.max 10ul 1ul == 10ul +Stdlib.UInt32.max 0ul 6ul == 6ul +Stdlib.UInt32.max 4294967295ul 0ul == 4294967295ul -Stdlib.UInt32.min_v0 5ul 6ul = 5ul -Stdlib.UInt32.min_v0 10ul 10ul = 10ul -Stdlib.UInt32.min_v0 4294967295ul 0ul = 0ul +Stdlib.UInt32.min 5ul 6ul == 5ul +Stdlib.UInt32.min 10ul 10ul == 10ul +Stdlib.UInt32.min 4294967295ul 0ul == 0ul -Stdlib.UInt32.clamp_v0 1ul 2ul 1ul = 1ul -Stdlib.UInt32.clamp_v0 3ul 0ul 2ul = 2ul -Stdlib.UInt32.clamp_v0 100ul 0ul 0ul = 0ul -Stdlib.UInt32.clamp_v0 100ul 0ul 1ul = 1ul -Stdlib.UInt32.clamp_v0 100ul 1ul 0ul = 1ul +Stdlib.UInt32.clamp 1ul 2ul 1ul == 1ul +Stdlib.UInt32.clamp 3ul 0ul 2ul == 2ul +Stdlib.UInt32.clamp 100ul 0ul 0ul == 0ul +Stdlib.UInt32.clamp 100ul 0ul 1ul == 1ul +Stdlib.UInt32.clamp 100ul 1ul 0ul == 1ul -Stdlib.UInt32.add_v0 10ul 9ul = 19ul -Stdlib.UInt32.add_v0 88ul 9ul = 97ul -Stdlib.UInt32.add_v0 1ul 0ul = 1ul -Stdlib.UInt32.add_v0 4294967294ul 1ul = 4294967295ul +Stdlib.UInt32.add 10ul 9ul == 19ul +Stdlib.UInt32.add 88ul 9ul == 97ul +Stdlib.UInt32.add 1ul 0ul == 1ul +Stdlib.UInt32.add 4294967294ul 1ul == 4294967295ul -Stdlib.UInt32.add_v0 4294967295ul 1ul = Builtin.testDerrorMessage "Out of range" +Stdlib.UInt32.add 4294967295ul 1ul == Builtin.testDerrorMessage "Out of range" -Stdlib.UInt32.subtract_v0 10ul 9ul = 1ul -Stdlib.UInt32.subtract_v0 88ul 9ul = 79ul +Stdlib.UInt32.subtract 10ul 9ul == 1ul +Stdlib.UInt32.subtract 88ul 9ul == 79ul -Stdlib.UInt32.subtract_v0 0ul 1ul = Builtin.testDerrorMessage "Out of range" +Stdlib.UInt32.subtract 0ul 1ul == Builtin.testDerrorMessage "Out of range" -Stdlib.UInt32.subtract_v0 1ul 0ul = 1ul -Stdlib.UInt32.subtract_v0 4294967295ul 1ul = 4294967294ul +Stdlib.UInt32.subtract 1ul 0ul == 1ul +Stdlib.UInt32.subtract 4294967295ul 1ul == 4294967294ul -Stdlib.UInt32.multiply_v0 8ul 8ul = 64ul -Stdlib.UInt32.multiply_v0 8ul 0ul = 0ul -Stdlib.UInt32.multiply_v0 2147483647ul 2ul = 4294967294ul +Stdlib.UInt32.multiply 8ul 8ul == 64ul +Stdlib.UInt32.multiply 8ul 0ul == 0ul +Stdlib.UInt32.multiply 2147483647ul 2ul == 4294967294ul -Stdlib.UInt32.multiply_v0 2147483648ul 2ul = Builtin.testDerrorMessage "Out of range" +Stdlib.UInt32.multiply 2147483648ul 2ul == Builtin.testDerrorMessage "Out of range" -Stdlib.UInt32.power_v0 2ul 3ul = 8ul -Stdlib.UInt32.power_v0 0ul 1ul = 0ul -Stdlib.UInt32.power_v0 1ul 0ul = 1ul -Stdlib.UInt32.power_v0 0ul 0ul = 1ul -Stdlib.UInt32.power_v0 1ul 255ul = 1ul +Stdlib.UInt32.power 2ul 3ul == 8ul +Stdlib.UInt32.power 0ul 1ul == 0ul +Stdlib.UInt32.power 1ul 0ul == 1ul +Stdlib.UInt32.power 0ul 0ul == 1ul +Stdlib.UInt32.power 1ul 255ul == 1ul -Stdlib.UInt32.power_v0 65536ul 2ul = Builtin.testDerrorMessage "Out of range" +Stdlib.UInt32.power 65536ul 2ul == Builtin.testDerrorMessage "Out of range" -Stdlib.UInt32.divide_v0 10ul 5ul = 2ul -Stdlib.UInt32.divide_v0 17ul 3ul = 5ul -Stdlib.UInt32.divide_v0 8ul 5ul = 1ul -Stdlib.UInt32.divide_v0 0ul 1ul = 0ul -Stdlib.UInt32.divide_v0 4294967295ul 2ul = 2147483647ul +Stdlib.UInt32.divide 10ul 5ul == 2ul +Stdlib.UInt32.divide 17ul 3ul == 5ul +Stdlib.UInt32.divide 8ul 5ul == 1ul +Stdlib.UInt32.divide 0ul 1ul == 0ul +Stdlib.UInt32.divide 4294967295ul 2ul == 2147483647ul -Stdlib.UInt32.divide_v0 1ul 0ul = Builtin.testDerrorMessage "Division by zero" +Stdlib.UInt32.divide 1ul 0ul == Builtin.testDerrorMessage "Division by zero" -Stdlib.UInt32.greaterThan_v0 20ul 1ul = true +Stdlib.UInt32.greaterThan 20ul 1ul == true -Stdlib.UInt32.greaterThanOrEqualTo_v0 0ul 1ul = false -Stdlib.UInt32.greaterThanOrEqualTo_v0 1ul 0ul = true -Stdlib.UInt32.greaterThanOrEqualTo_v0 6ul 1ul = true -Stdlib.UInt32.greaterThanOrEqualTo_v0 6ul 8ul = false -Stdlib.UInt32.greaterThanOrEqualTo_v0 4294967295ul 0ul = true -Stdlib.UInt32.greaterThanOrEqualTo_v0 0ul 4294967295ul = false +Stdlib.UInt32.greaterThanOrEqualTo 0ul 1ul == false +Stdlib.UInt32.greaterThanOrEqualTo 1ul 0ul == true +Stdlib.UInt32.greaterThanOrEqualTo 6ul 1ul == true +Stdlib.UInt32.greaterThanOrEqualTo 6ul 8ul == false +Stdlib.UInt32.greaterThanOrEqualTo 4294967295ul 0ul == true +Stdlib.UInt32.greaterThanOrEqualTo 0ul 4294967295ul == false -Stdlib.UInt32.lessThanOrEqualTo_v0 6ul 8ul = true -Stdlib.UInt32.lessThanOrEqualTo_v0 10ul 1ul = false -Stdlib.UInt32.lessThanOrEqualTo_v0 0ul 1ul = true -Stdlib.UInt32.lessThanOrEqualTo_v0 1ul 0ul = false -Stdlib.UInt32.lessThanOrEqualTo_v0 4294967295ul 0ul = false -Stdlib.UInt32.lessThanOrEqualTo_v0 0ul 4294967295ul = true -Stdlib.UInt32.lessThanOrEqualTo_v0 4294967295ul 4294967295ul = true +Stdlib.UInt32.lessThanOrEqualTo 6ul 8ul == true +Stdlib.UInt32.lessThanOrEqualTo 10ul 1ul == false +Stdlib.UInt32.lessThanOrEqualTo 0ul 1ul == true +Stdlib.UInt32.lessThanOrEqualTo 1ul 0ul == false +Stdlib.UInt32.lessThanOrEqualTo 4294967295ul 0ul == false +Stdlib.UInt32.lessThanOrEqualTo 0ul 4294967295ul == true +Stdlib.UInt32.lessThanOrEqualTo 4294967295ul 4294967295ul == true -Stdlib.UInt32.lessThan_v0 6ul 8ul = true -Stdlib.UInt32.lessThan_v0 10ul 1ul = false -Stdlib.UInt32.lessThan_v0 0ul 1ul = true -Stdlib.UInt32.lessThan_v0 1ul 0ul = false -Stdlib.UInt32.lessThan_v0 0ul 4294967295ul = true -Stdlib.UInt32.lessThan_v0 4294967295ul 4294967295ul = false +Stdlib.UInt32.lessThan 6ul 8ul == true +Stdlib.UInt32.lessThan 10ul 1ul == false +Stdlib.UInt32.lessThan 0ul 1ul == true +Stdlib.UInt32.lessThan 1ul 0ul == false +Stdlib.UInt32.lessThan 0ul 4294967295ul == true +Stdlib.UInt32.lessThan 4294967295ul 4294967295ul == false -Stdlib.UInt32.toString 120ul = "120" -Stdlib.UInt32.toString 1ul = "1" -Stdlib.UInt32.toString 0ul = "0" // UInt32 lower limit -Stdlib.UInt32.toString 4294967295ul = "4294967295" // UInt32 upper limit +Stdlib.UInt32.toString 120ul == "120" +Stdlib.UInt32.toString 1ul == "1" +Stdlib.UInt32.toString 0ul == "0" // UInt32 lower limit +Stdlib.UInt32.toString 4294967295ul == "4294967295" // UInt32 upper limit -Stdlib.UInt32.toFloat_v0 2ul = 2.0 -Stdlib.UInt32.toFloat_v0 0ul = 0.0 +Stdlib.UInt32.toFloat 2ul == 2.0 +Stdlib.UInt32.toFloat 0ul == 0.0 -Stdlib.UInt32.sqrt_v0 4ul = 2.0 -Stdlib.UInt32.sqrt_v0 100ul = 10.0 -Stdlib.UInt32.sqrt_v0 86ul = 9.273618495495704 +Stdlib.UInt32.sqrt 4ul == 2.0 +Stdlib.UInt32.sqrt 100ul == 10.0 +Stdlib.UInt32.sqrt 86ul == 9.273618495495704 -Stdlib.UInt32.mod_v0 15ul 5ul = 0ul -Stdlib.UInt32.mod_v0 15ul 6ul = 3ul -Stdlib.UInt32.mod_v0 0ul 15ul = 0ul -Stdlib.UInt32.mod_v0 1ul 2ul = 1ul -Stdlib.UInt32.mod_v0 32768ul 53ul = 14ul -Stdlib.UInt32.mod_v0 4294967295ul 3ul = 0ul +Stdlib.UInt32.mod 15ul 5ul == 0ul +Stdlib.UInt32.mod 15ul 6ul == 3ul +Stdlib.UInt32.mod 0ul 15ul == 0ul +Stdlib.UInt32.mod 1ul 2ul == 1ul +Stdlib.UInt32.mod 32768ul 53ul == 14ul +Stdlib.UInt32.mod 4294967295ul 3ul == 0ul -Stdlib.UInt32.mod_v0 5ul 0ul = Builtin.testDerrorMessage "Zero modulus" +Stdlib.UInt32.mod 5ul 0ul == Builtin.testDerrorMessage "Zero modulus" -(Stdlib.List.range_v0 1L 5L) -|> Stdlib.List.map_v0 (fun x -> Stdlib.UInt32.random 1ul 2ul) -|> Stdlib.List.map_v0 (fun x -> +(Stdlib.List.range 1L 5L) +|> Stdlib.List.map (fun x -> Stdlib.UInt32.random 1ul 2ul) +|> Stdlib.List.map (fun x -> (Stdlib.UInt32.greaterThanOrEqualTo x 1ul) - && (Stdlib.UInt32.lessThanOrEqualTo x 2ul)) = [ true; true; true; true; true ] + && (Stdlib.UInt32.lessThanOrEqualTo x 2ul)) == [ true; true; true; true; true ] -(Stdlib.List.range_v0 1L 5L) -|> Stdlib.List.map_v0 (fun x -> Stdlib.UInt32.random 10ul 20ul) -|> Stdlib.List.map_v0 (fun x -> +(Stdlib.List.range 1L 5L) +|> Stdlib.List.map (fun x -> Stdlib.UInt32.random 10ul 20ul) +|> Stdlib.List.map (fun x -> (Stdlib.UInt32.greaterThanOrEqualTo x 10ul) - && (Stdlib.UInt32.lessThanOrEqualTo x 20ul)) = [ true; true; true; true; true ] + && (Stdlib.UInt32.lessThanOrEqualTo x 20ul)) == [ true; true; true; true; true ] -(Stdlib.List.range_v0 1L 5L) -|> Stdlib.List.map_v0 (fun x -> Stdlib.UInt32.random 2ul 1ul) -|> Stdlib.List.map_v0 (fun x -> +(Stdlib.List.range 1L 5L) +|> Stdlib.List.map (fun x -> Stdlib.UInt32.random 2ul 1ul) +|> Stdlib.List.map (fun x -> (Stdlib.UInt32.greaterThanOrEqualTo x 1ul) - && (Stdlib.UInt32.lessThanOrEqualTo x 2ul)) = [ true; true; true; true; true ] + && (Stdlib.UInt32.lessThanOrEqualTo x 2ul)) == [ true; true; true; true; true ] -(Stdlib.List.range_v0 1L 5L) -|> Stdlib.List.map_v0 (fun x -> Stdlib.UInt32.random 20ul 10ul) -|> Stdlib.List.map_v0 (fun x -> +(Stdlib.List.range 1L 5L) +|> Stdlib.List.map (fun x -> Stdlib.UInt32.random 20ul 10ul) +|> Stdlib.List.map (fun x -> (Stdlib.UInt32.greaterThanOrEqualTo x 10ul) - && (Stdlib.UInt32.lessThanOrEqualTo x 20ul)) = [ true; true; true; true; true ] + && (Stdlib.UInt32.lessThanOrEqualTo x 20ul)) == [ true; true; true; true; true ] -((Stdlib.List.range_v0 1L 100L) - |> Stdlib.List.map_v0 (fun x -> Stdlib.UInt32.random 0ul 1ul) - |> Stdlib.List.unique_v0) = [ 0ul; 1ul ] +((Stdlib.List.range 1L 100L) + |> Stdlib.List.map (fun x -> Stdlib.UInt32.random 0ul 1ul) + |> Stdlib.List.unique) == [ 0ul; 1ul ] -((Stdlib.List.range_v0 1L 100L) - |> Stdlib.List.map_v0 (fun x -> Stdlib.UInt32.random 0ul 2ul) - |> Stdlib.List.unique_v0) = [ 0ul; 1ul; 2ul ] +((Stdlib.List.range 1L 100L) + |> Stdlib.List.map (fun x -> Stdlib.UInt32.random 0ul 2ul) + |> Stdlib.List.unique) == [ 0ul; 1ul; 2ul ] -Stdlib.UInt32.sum_v0 [ 1ul; 2ul ] = 3ul +Stdlib.UInt32.sum [ 1ul; 2ul ] == 3ul -Stdlib.UInt32.sum_v0 [ 1ul; 4294967295ul ] = Builtin.testDerrorMessage "Out of range" +Stdlib.UInt32.sum [ 1ul; 4294967295ul ] == Builtin.testDerrorMessage "Out of range" -Stdlib.UInt32.parse_v0 "-129" = Stdlib.Result.Result.Error - Stdlib.UInt32.ParseError.OutOfRange +Stdlib.UInt32.parse "-129" == Stdlib.Result.Result.Error( + Stdlib.UInt32.ParseError.OutOfRange) -Stdlib.UInt32.parse_v0 "4294967296" = Stdlib.Result.Result.Error - Stdlib.UInt32.ParseError.OutOfRange +Stdlib.UInt32.parse "4294967296" == Stdlib.Result.Result.Error( + Stdlib.UInt32.ParseError.OutOfRange) -Stdlib.UInt32.parse_v0 "4294967296ul" = Stdlib.Result.Result.Error - Stdlib.UInt32.ParseError.BadFormat +Stdlib.UInt32.parse "4294967296ul" == Stdlib.Result.Result.Error( + Stdlib.UInt32.ParseError.BadFormat) -Stdlib.UInt32.parse_v0 "1 2 3" = Stdlib.Result.Result.Error - Stdlib.UInt32.ParseError.BadFormat +Stdlib.UInt32.parse "1 2 3" == Stdlib.Result.Result.Error( + Stdlib.UInt32.ParseError.BadFormat) -Stdlib.UInt32.parse_v0 "+ 1" = Stdlib.Result.Result.Error - Stdlib.UInt32.ParseError.BadFormat +Stdlib.UInt32.parse "+ 1" == Stdlib.Result.Result.Error( + Stdlib.UInt32.ParseError.BadFormat) -Stdlib.UInt32.parse_v0 "- 1" = Stdlib.Result.Result.Error - Stdlib.UInt32.ParseError.BadFormat +Stdlib.UInt32.parse "- 1" == Stdlib.Result.Result.Error( + Stdlib.UInt32.ParseError.BadFormat) -Stdlib.UInt32.parse_v0 "0xA" = Stdlib.Result.Result.Error - Stdlib.UInt32.ParseError.BadFormat +Stdlib.UInt32.parse "0xA" == Stdlib.Result.Result.Error( + Stdlib.UInt32.ParseError.BadFormat) -Stdlib.UInt32.parse_v0 "0x123" = Stdlib.Result.Result.Error - Stdlib.UInt32.ParseError.BadFormat +Stdlib.UInt32.parse "0x123" == Stdlib.Result.Result.Error( + Stdlib.UInt32.ParseError.BadFormat) -Stdlib.UInt32.parse_v0 "0b0100" = Stdlib.Result.Result.Error - Stdlib.UInt32.ParseError.BadFormat +Stdlib.UInt32.parse "0b0100" == Stdlib.Result.Result.Error( + Stdlib.UInt32.ParseError.BadFormat) -Stdlib.UInt32.parse_v0 "pi" = Stdlib.Result.Result.Error - Stdlib.UInt32.ParseError.BadFormat +Stdlib.UInt32.parse "pi" == Stdlib.Result.Result.Error( + Stdlib.UInt32.ParseError.BadFormat) -Stdlib.UInt32.parse_v0 "PACKAGE.Darklang.Stdlib.Math.pi" = Stdlib.Result.Result.Error - Stdlib.UInt32.ParseError.BadFormat +Stdlib.UInt32.parse "PACKAGE.Darklang.Stdlib.Math.pi" == Stdlib.Result.Result.Error( + Stdlib.UInt32.ParseError.BadFormat) -Stdlib.UInt32.parse_v0 "1.23E+04" = Stdlib.Result.Result.Error - Stdlib.UInt32.ParseError.BadFormat +Stdlib.UInt32.parse "1.23E+04" == Stdlib.Result.Result.Error( + Stdlib.UInt32.ParseError.BadFormat) -Stdlib.UInt32.parse_v0 "" = Stdlib.Result.Result.Error - Stdlib.UInt32.ParseError.BadFormat +Stdlib.UInt32.parse "" == Stdlib.Result.Result.Error( + Stdlib.UInt32.ParseError.BadFormat) -Stdlib.UInt32.parse_v0 "1I" = Stdlib.Result.Result.Error - Stdlib.UInt32.ParseError.BadFormat +Stdlib.UInt32.parse "1I" == Stdlib.Result.Result.Error( + Stdlib.UInt32.ParseError.BadFormat) -Stdlib.UInt32.parse_v0 "one" = Stdlib.Result.Result.Error - Stdlib.UInt32.ParseError.BadFormat +Stdlib.UInt32.parse "one" == Stdlib.Result.Result.Error( + Stdlib.UInt32.ParseError.BadFormat) -Stdlib.UInt32.parse_v0 "XIV" = Stdlib.Result.Result.Error - Stdlib.UInt32.ParseError.BadFormat +Stdlib.UInt32.parse "XIV" == Stdlib.Result.Result.Error( + Stdlib.UInt32.ParseError.BadFormat) -Stdlib.UInt32.fromInt8_v0 0y = Stdlib.Option.Option.Some 0ul +Stdlib.UInt32.fromInt8 0y == Stdlib.Option.Option.Some(0ul) -Stdlib.UInt32.fromInt8_v0 1y = Stdlib.Option.Option.Some 1ul +Stdlib.UInt32.fromInt8 1y == Stdlib.Option.Option.Some(1ul) -Stdlib.UInt32.fromInt8_v0 127y = Stdlib.Option.Option.Some 127ul +Stdlib.UInt32.fromInt8 127y == Stdlib.Option.Option.Some(127ul) -Stdlib.UInt32.fromInt8_v0 (-128y) = Stdlib.Option.Option.None +Stdlib.UInt32.fromInt8 (-128y) == Stdlib.Option.Option.None() -Stdlib.UInt32.fromUInt8_v0 0uy = 0ul +Stdlib.UInt32.fromUInt8 0uy == 0ul -Stdlib.UInt32.fromUInt8_v0 1uy = 1ul +Stdlib.UInt32.fromUInt8 1uy == 1ul -Stdlib.UInt32.fromUInt8_v0 255uy = 255ul +Stdlib.UInt32.fromUInt8 255uy == 255ul -Stdlib.UInt32.fromInt16_v0 0s = Stdlib.Option.Option.Some 0ul +Stdlib.UInt32.fromInt16 0s == Stdlib.Option.Option.Some(0ul) -Stdlib.UInt32.fromInt16_v0 1s = Stdlib.Option.Option.Some 1ul +Stdlib.UInt32.fromInt16 1s == Stdlib.Option.Option.Some(1ul) -Stdlib.UInt32.fromInt16_v0 32767s = Stdlib.Option.Option.Some 32767ul +Stdlib.UInt32.fromInt16 32767s == Stdlib.Option.Option.Some(32767ul) -Stdlib.UInt32.fromInt16_v0 (-32768s) = Stdlib.Option.Option.None +Stdlib.UInt32.fromInt16 (-32768s) == Stdlib.Option.Option.None() -Stdlib.UInt32.fromUInt16_v0 0us = 0ul +Stdlib.UInt32.fromUInt16 0us == 0ul -Stdlib.UInt32.fromUInt16_v0 1us = 1ul +Stdlib.UInt32.fromUInt16 1us == 1ul -Stdlib.UInt32.fromUInt16_v0 65535us = 65535ul +Stdlib.UInt32.fromUInt16 65535us == 65535ul -Stdlib.UInt32.fromInt32_v0 0l = Stdlib.Option.Option.Some 0ul +Stdlib.UInt32.fromInt32 0l == Stdlib.Option.Option.Some(0ul) -Stdlib.UInt32.fromInt32_v0 1l = Stdlib.Option.Option.Some 1ul +Stdlib.UInt32.fromInt32 1l == Stdlib.Option.Option.Some(1ul) -Stdlib.UInt32.fromInt32_v0 2147483647l = Stdlib.Option.Option.Some 2147483647ul +Stdlib.UInt32.fromInt32 2147483647l == Stdlib.Option.Option.Some(2147483647ul) -Stdlib.UInt32.fromInt32_v0 (-2147483648l) = Stdlib.Option.Option.None +Stdlib.UInt32.fromInt32 (-2147483648l) == Stdlib.Option.Option.None() -Stdlib.UInt32.fromInt64_v0 0L = Stdlib.Option.Option.Some 0ul +Stdlib.UInt32.fromInt64 0L == Stdlib.Option.Option.Some(0ul) -Stdlib.UInt32.fromInt64_v0 1L = Stdlib.Option.Option.Some 1ul +Stdlib.UInt32.fromInt64 1L == Stdlib.Option.Option.Some(1ul) -Stdlib.UInt32.fromInt64_v0 4294967295L = Stdlib.Option.Option.Some 4294967295ul +Stdlib.UInt32.fromInt64 4294967295L == Stdlib.Option.Option.Some(4294967295ul) -Stdlib.UInt32.fromInt64_v0 4294967296L = Stdlib.Option.Option.None -Stdlib.UInt32.fromInt64_v0 (-1L) = Stdlib.Option.Option.None +Stdlib.UInt32.fromInt64 4294967296L == Stdlib.Option.Option.None() +Stdlib.UInt32.fromInt64 (-1L) == Stdlib.Option.Option.None() -Stdlib.UInt32.fromUInt64_v0 0UL = Stdlib.Option.Option.Some 0ul +Stdlib.UInt32.fromUInt64 0UL == Stdlib.Option.Option.Some(0ul) -Stdlib.UInt32.fromUInt64_v0 1UL = Stdlib.Option.Option.Some 1ul +Stdlib.UInt32.fromUInt64 1UL == Stdlib.Option.Option.Some(1ul) -Stdlib.UInt32.fromUInt64_v0 4294967295UL = Stdlib.Option.Option.Some 4294967295ul +Stdlib.UInt32.fromUInt64 4294967295UL == Stdlib.Option.Option.Some(4294967295ul) -Stdlib.UInt32.fromUInt64_v0 4294967296UL = Stdlib.Option.Option.None +Stdlib.UInt32.fromUInt64 4294967296UL == Stdlib.Option.Option.None() -Stdlib.UInt32.fromInt128_v0 0Q = Stdlib.Option.Option.Some 0ul +Stdlib.UInt32.fromInt128 0Q == Stdlib.Option.Option.Some(0ul) -Stdlib.UInt32.fromInt128_v0 1Q = Stdlib.Option.Option.Some 1ul +Stdlib.UInt32.fromInt128 1Q == Stdlib.Option.Option.Some(1ul) -Stdlib.UInt32.fromInt128_v0 4294967295Q = Stdlib.Option.Option.Some 4294967295ul +Stdlib.UInt32.fromInt128 4294967295Q == Stdlib.Option.Option.Some(4294967295ul) -Stdlib.UInt32.fromInt128_v0 4294967296Q = Stdlib.Option.Option.None -Stdlib.UInt32.fromInt128_v0 (-1Q) = Stdlib.Option.Option.None +Stdlib.UInt32.fromInt128 4294967296Q == Stdlib.Option.Option.None() +Stdlib.UInt32.fromInt128 (-1Q) == Stdlib.Option.Option.None() -Stdlib.UInt32.fromUInt128_v0 0Z = Stdlib.Option.Option.Some 0ul +Stdlib.UInt32.fromUInt128 0Z == Stdlib.Option.Option.Some(0ul) -Stdlib.UInt32.fromUInt128_v0 1Z = Stdlib.Option.Option.Some 1ul +Stdlib.UInt32.fromUInt128 1Z == Stdlib.Option.Option.Some(1ul) -Stdlib.UInt32.fromUInt128_v0 4294967295Z = Stdlib.Option.Option.Some 4294967295ul +Stdlib.UInt32.fromUInt128 4294967295Z == Stdlib.Option.Option.Some(4294967295ul) -Stdlib.UInt32.fromUInt128_v0 4294967296Z = Stdlib.Option.Option.None \ No newline at end of file +Stdlib.UInt32.fromUInt128 4294967296Z == Stdlib.Option.Option.None() \ No newline at end of file diff --git a/backend/testfiles/execution/stdlib/uint64.dark b/backend/testfiles/execution/stdlib/uint64.dark index 8ce993fad4..aaa1969c12 100644 --- a/backend/testfiles/execution/stdlib/uint64.dark +++ b/backend/testfiles/execution/stdlib/uint64.dark @@ -1,273 +1,270 @@ -Stdlib.UInt64.max_v0 5UL 6UL = 6UL -Stdlib.UInt64.max_v0 10UL 1UL = 10UL +Stdlib.UInt64.max 5UL 6UL == 6UL +Stdlib.UInt64.max 10UL 1UL == 10UL -Stdlib.UInt64.min_v0 5UL 6UL = 5UL -Stdlib.UInt64.min_v0 10UL 10UL = 10UL -Stdlib.UInt64.min_v0 18446744073709551615UL 0UL = 0UL +Stdlib.UInt64.min 5UL 6UL == 5UL +Stdlib.UInt64.min 10UL 10UL == 10UL +Stdlib.UInt64.min 18446744073709551615UL 0UL == 0UL -Stdlib.UInt64.clamp_v0 1UL 2UL 1UL = 1UL -Stdlib.UInt64.clamp_v0 3UL 0UL 2UL = 2UL -Stdlib.UInt64.clamp_v0 100UL 0UL 0UL = 0UL -Stdlib.UInt64.clamp_v0 100UL 1UL 0UL = 1UL +Stdlib.UInt64.clamp 1UL 2UL 1UL == 1UL +Stdlib.UInt64.clamp 3UL 0UL 2UL == 2UL +Stdlib.UInt64.clamp 100UL 0UL 0UL == 0UL +Stdlib.UInt64.clamp 100UL 1UL 0UL == 1UL -Stdlib.UInt64.mod_v0 15UL 5UL = 0UL -Stdlib.UInt64.mod_v0 15UL 6UL = 3UL -Stdlib.UInt64.mod_v0 0UL 15UL = 0UL -Stdlib.UInt64.mod_v0 9999999999998UL 3UL = 2UL +Stdlib.UInt64.mod 15UL 5UL == 0UL +Stdlib.UInt64.mod 15UL 6UL == 3UL +Stdlib.UInt64.mod 0UL 15UL == 0UL +Stdlib.UInt64.mod 9999999999998UL 3UL == 2UL -Stdlib.UInt64.mod_v0 5UL 0UL = Builtin.testDerrorMessage "Zero modulus" +Stdlib.UInt64.mod 5UL 0UL == Builtin.testDerrorMessage "Zero modulus" -Stdlib.UInt64.power_v0 8UL 5UL = 32768UL -Stdlib.UInt64.power_v0 0UL 1UL = 0UL -Stdlib.UInt64.power_v0 0UL 0UL = 1UL -Stdlib.UInt64.power_v0 1UL 0UL = 1UL -Stdlib.UInt64.power_v0 1000UL 0UL = 1UL +Stdlib.UInt64.power 8UL 5UL == 32768UL +Stdlib.UInt64.power 0UL 1UL == 0UL +Stdlib.UInt64.power 0UL 0UL == 1UL +Stdlib.UInt64.power 1UL 0UL == 1UL +Stdlib.UInt64.power 1000UL 0UL == 1UL -Stdlib.UInt64.power_v0 200UL 20UL = Builtin.testDerrorMessage "Out of range" +Stdlib.UInt64.power 200UL 20UL == Builtin.testDerrorMessage "Out of range" -Stdlib.UInt64.power_v0 200UL 7UL = 12800000000000000UL +Stdlib.UInt64.power 200UL 7UL == 12800000000000000UL -Stdlib.UInt64.power_v0 1UL 2147483649UL = 1UL +Stdlib.UInt64.power 1UL 2147483649UL == 1UL -Stdlib.UInt64.greaterThan_v0 20UL 1UL = true +Stdlib.UInt64.greaterThan 20UL 1UL == true -Stdlib.UInt64.greaterThanOrEqualTo_v0 0UL 1UL = false -Stdlib.UInt64.greaterThanOrEqualTo_v0 1UL 0UL = true -Stdlib.UInt64.greaterThanOrEqualTo_v0 6UL 1UL = true -Stdlib.UInt64.greaterThanOrEqualTo_v0 6UL 8UL = false +Stdlib.UInt64.greaterThanOrEqualTo 0UL 1UL == false +Stdlib.UInt64.greaterThanOrEqualTo 1UL 0UL == true +Stdlib.UInt64.greaterThanOrEqualTo 6UL 1UL == true +Stdlib.UInt64.greaterThanOrEqualTo 6UL 8UL == false -Stdlib.UInt64.lessThanOrEqualTo_v0 6UL 8UL = true -Stdlib.UInt64.lessThanOrEqualTo_v0 10UL 1UL = false -Stdlib.UInt64.lessThanOrEqualTo_v0 0UL 1UL = true -Stdlib.UInt64.lessThanOrEqualTo_v0 1UL 0UL = false +Stdlib.UInt64.lessThanOrEqualTo 6UL 8UL == true +Stdlib.UInt64.lessThanOrEqualTo 10UL 1UL == false +Stdlib.UInt64.lessThanOrEqualTo 0UL 1UL == true +Stdlib.UInt64.lessThanOrEqualTo 1UL 0UL == false -Stdlib.UInt64.lessThan_v0 6UL 8UL = true -Stdlib.UInt64.lessThan_v0 10UL 1UL = false -Stdlib.UInt64.lessThan_v0 0UL 1UL = true -Stdlib.UInt64.lessThan_v0 1UL 0UL = false +Stdlib.UInt64.lessThan 6UL 8UL == true +Stdlib.UInt64.lessThan 10UL 1UL == false +Stdlib.UInt64.lessThan 0UL 1UL == true +Stdlib.UInt64.lessThan 1UL 0UL == false -Stdlib.UInt64.sqrt_v0 4UL = 2.0 -Stdlib.UInt64.sqrt_v0 100UL = 10.0 -Stdlib.UInt64.sqrt_v0 86UL = 9.273618495495704 +Stdlib.UInt64.sqrt 4UL == 2.0 +Stdlib.UInt64.sqrt 100UL == 10.0 +Stdlib.UInt64.sqrt 86UL == 9.273618495495704 -Stdlib.UInt64.toFloat_v0 2UL = 2.0 -Stdlib.UInt64.toFloat_v0 955656UL = 955656.0 +Stdlib.UInt64.toFloat 2UL == 2.0 +Stdlib.UInt64.toFloat 955656UL == 955656.0 -Stdlib.UInt64.add_v0 10UL 9UL = 19UL -Stdlib.UInt64.add_v0 88UL 9UL = 97UL -Stdlib.UInt64.add_v0 1UL 0UL = 1UL -Stdlib.UInt64.add_v0 18446744073709551614UL 1UL = 18446744073709551615UL +Stdlib.UInt64.add 10UL 9UL == 19UL +Stdlib.UInt64.add 88UL 9UL == 97UL +Stdlib.UInt64.add 1UL 0UL == 1UL +Stdlib.UInt64.add 18446744073709551614UL 1UL == 18446744073709551615UL // Overflow tests -Stdlib.UInt64.add_v0 18446744073709551615UL 1UL = Builtin.testDerrorMessage +Stdlib.UInt64.add 18446744073709551615UL 1UL == Builtin.testDerrorMessage "Out of range" -Stdlib.UInt64.add_v0 55UL 18446744073709551615UL = Builtin.testDerrorMessage +Stdlib.UInt64.add 55UL 18446744073709551615UL == Builtin.testDerrorMessage "Out of range" -Stdlib.UInt64.subtract_v0 10UL 9UL = 1UL -Stdlib.UInt64.subtract_v0 88UL 9UL = 79UL -Stdlib.UInt64.subtract_v0 1UL 0UL = 1UL +Stdlib.UInt64.subtract 10UL 9UL == 1UL +Stdlib.UInt64.subtract 88UL 9UL == 79UL +Stdlib.UInt64.subtract 1UL 0UL == 1UL -Stdlib.UInt64.multiply_v0 8UL 8UL = 64UL -Stdlib.UInt64.multiply_v0 5145UL 5145UL = 26471025UL +Stdlib.UInt64.multiply 8UL 8UL == 64UL +Stdlib.UInt64.multiply 5145UL 5145UL == 26471025UL -Stdlib.UInt64.multiply_v0 9223372036854775808UL 2UL = Builtin.testDerrorMessage +Stdlib.UInt64.multiply 9223372036854775808UL 2UL == Builtin.testDerrorMessage "Out of range" -Stdlib.UInt64.divide_v0 10UL 5UL = 2UL -Stdlib.UInt64.divide_v0 17UL 3UL = 5UL -Stdlib.UInt64.divide_v0 0UL 1UL = 0UL +Stdlib.UInt64.divide 10UL 5UL == 2UL +Stdlib.UInt64.divide 17UL 3UL == 5UL +Stdlib.UInt64.divide 0UL 1UL == 0UL -Stdlib.UInt64.divide_v0 1UL 0UL = Builtin.testDerrorMessage "Division by zero" +Stdlib.UInt64.divide 1UL 0UL == Builtin.testDerrorMessage "Division by zero" -(Stdlib.List.range_v0 1L 5L) -|> Stdlib.List.map_v0 (fun x -> Stdlib.UInt64.random 1UL 2UL) -|> Stdlib.List.map_v0 (fun x -> +(Stdlib.List.range 1L 5L) +|> Stdlib.List.map (fun x -> Stdlib.UInt64.random 1UL 2UL) +|> Stdlib.List.map (fun x -> (Builtin.uint64GreaterThanOrEqualTo x 1UL) - && (Builtin.uint64LessThanOrEqualTo x 2UL)) = [ true; true; true; true; true ] + && (Builtin.uint64LessThanOrEqualTo x 2UL)) == [ true; true; true; true; true ] -(Stdlib.List.range_v0 1L 5L) -|> Stdlib.List.map_v0 (fun x -> Stdlib.UInt64.random 10UL 20UL) -|> Stdlib.List.map_v0 (fun x -> +(Stdlib.List.range 1L 5L) +|> Stdlib.List.map (fun x -> Stdlib.UInt64.random 10UL 20UL) +|> Stdlib.List.map (fun x -> (Builtin.uint64GreaterThanOrEqualTo x 10UL) - && (Builtin.uint64LessThanOrEqualTo x 20UL)) = [ true; true; true; true; true ] + && (Builtin.uint64LessThanOrEqualTo x 20UL)) == [ true; true; true; true; true ] -(Stdlib.List.range_v0 1L 5L) -|> Stdlib.List.map_v0 (fun x -> Stdlib.UInt64.random 2UL 1UL) -|> Stdlib.List.map_v0 (fun x -> +(Stdlib.List.range 1L 5L) +|> Stdlib.List.map (fun x -> Stdlib.UInt64.random 2UL 1UL) +|> Stdlib.List.map (fun x -> (Builtin.uint64GreaterThanOrEqualTo x 1UL) - && (Builtin.uint64LessThanOrEqualTo x 2UL)) = [ true; true; true; true; true ] + && (Builtin.uint64LessThanOrEqualTo x 2UL)) == [ true; true; true; true; true ] -(Stdlib.List.range_v0 1L 5L) -|> Stdlib.List.map_v0 (fun x -> Stdlib.UInt64.random 20UL 10UL) -|> Stdlib.List.map_v0 (fun x -> +(Stdlib.List.range 1L 5L) +|> Stdlib.List.map (fun x -> Stdlib.UInt64.random 20UL 10UL) +|> Stdlib.List.map (fun x -> (Builtin.uint64GreaterThanOrEqualTo x 10UL) - && (Builtin.uint64LessThanOrEqualTo x 20UL)) = [ true; true; true; true; true ] + && (Builtin.uint64LessThanOrEqualTo x 20UL)) == [ true; true; true; true; true ] -((Stdlib.List.range_v0 1L 100L) - |> Stdlib.List.map_v0 (fun x -> Stdlib.UInt64.random 0UL 1UL) - |> Stdlib.List.unique_v0) = [ 0UL; 1UL ] +((Stdlib.List.range 1L 100L) + |> Stdlib.List.map (fun x -> Stdlib.UInt64.random 0UL 1UL) + |> Stdlib.List.unique) == [ 0UL; 1UL ] -((Stdlib.List.range_v0 1L 100L) - |> Stdlib.List.map_v0 (fun x -> Stdlib.UInt64.random 0UL 2UL) - |> Stdlib.List.unique_v0) = [ 0UL; 1UL; 2UL ] +((Stdlib.List.range 1L 100L) + |> Stdlib.List.map (fun x -> Stdlib.UInt64.random 0UL 2UL) + |> Stdlib.List.unique) == [ 0UL; 1UL; 2UL ] -Stdlib.UInt64.sum_v0 [ 1UL; 2UL ] = 3UL +Stdlib.UInt64.sum [ 1UL; 2UL ] == 3UL -Stdlib.UInt64.parse_v0 "0" = Stdlib.Result.Result.Ok 0UL +Stdlib.UInt64.parse "0" == Stdlib.Result.Result.Ok(0UL) -Stdlib.UInt64.parse_v0 "1" = Stdlib.Result.Result.Ok 1UL +Stdlib.UInt64.parse "1" == Stdlib.Result.Result.Ok(1UL) -Stdlib.UInt64.parse_v0 " 1" = Stdlib.Result.Result.Ok 1UL +Stdlib.UInt64.parse " 1" == Stdlib.Result.Result.Ok(1UL) -Stdlib.UInt64.parse_v0 "1 " = Stdlib.Result.Result.Ok 1UL +Stdlib.UInt64.parse "1 " == Stdlib.Result.Result.Ok(1UL) -Stdlib.UInt64.parse_v0 "+1" = Stdlib.Result.Result.Ok 1UL +Stdlib.UInt64.parse "+1" == Stdlib.Result.Result.Ok(1UL) -Stdlib.UInt64.parse_v0 " +1 " = Stdlib.Result.Result.Ok 1UL +Stdlib.UInt64.parse " +1 " == Stdlib.Result.Result.Ok(1UL) -Stdlib.UInt64.parse_v0 "-1" = Stdlib.Result.Result.Error - Stdlib.UInt64.ParseError.OutOfRange +Stdlib.UInt64.parse "-1" == Stdlib.Result.Result.Error( + Stdlib.UInt64.ParseError.OutOfRange) -Stdlib.UInt64.parse_v0 "078" = Stdlib.Result.Result.Ok 78UL // "octal" format ignored +Stdlib.UInt64.parse "078" == Stdlib.Result.Result.Ok(78UL) // "octal" format ignored -Stdlib.UInt64.parse_v0 "-00001" = Stdlib.Result.Result.Error - Stdlib.UInt64.ParseError.OutOfRange +Stdlib.UInt64.parse "-00001" == Stdlib.Result.Result.Error( + Stdlib.UInt64.ParseError.OutOfRange) -Stdlib.UInt64.parse_v0 "-10001" = Stdlib.Result.Result.Error - Stdlib.UInt64.ParseError.OutOfRange +Stdlib.UInt64.parse "-10001" == Stdlib.Result.Result.Error( + Stdlib.UInt64.ParseError.OutOfRange) -Stdlib.UInt64.parse_v0 "18446744073709551615" = Stdlib.Result.Result.Ok - 18446744073709551615UL +Stdlib.UInt64.parse "18446744073709551615" == Stdlib.Result.Result.Ok(18446744073709551615UL) -Stdlib.UInt64.parse_v0 "18446744073709551616" = Stdlib.Result.Result.Error - Stdlib.UInt64.ParseError.OutOfRange +Stdlib.UInt64.parse "18446744073709551616" == Stdlib.Result.Result.Error( + Stdlib.UInt64.ParseError.OutOfRange) -Stdlib.UInt64.parse_v0 "1 2 3" = Stdlib.Result.Result.Error - Stdlib.UInt64.ParseError.BadFormat +Stdlib.UInt64.parse "1 2 3" == Stdlib.Result.Result.Error( + Stdlib.UInt64.ParseError.BadFormat) -Stdlib.UInt64.parse_v0 "+ 1" = Stdlib.Result.Result.Error - Stdlib.UInt64.ParseError.BadFormat +Stdlib.UInt64.parse "+ 1" == Stdlib.Result.Result.Error( + Stdlib.UInt64.ParseError.BadFormat) -Stdlib.UInt64.parse_v0 "- 1" = Stdlib.Result.Result.Error - Stdlib.UInt64.ParseError.BadFormat +Stdlib.UInt64.parse "- 1" == Stdlib.Result.Result.Error( + Stdlib.UInt64.ParseError.BadFormat) -Stdlib.UInt64.parse_v0 "0xA" = Stdlib.Result.Result.Error - Stdlib.UInt64.ParseError.BadFormat +Stdlib.UInt64.parse "0xA" == Stdlib.Result.Result.Error( + Stdlib.UInt64.ParseError.BadFormat) -Stdlib.UInt64.parse_v0 "0x123" = Stdlib.Result.Result.Error - Stdlib.UInt64.ParseError.BadFormat +Stdlib.UInt64.parse "0x123" == Stdlib.Result.Result.Error( + Stdlib.UInt64.ParseError.BadFormat) -Stdlib.UInt64.parse_v0 "0b0100" = Stdlib.Result.Result.Error - Stdlib.UInt64.ParseError.BadFormat +Stdlib.UInt64.parse "0b0100" == Stdlib.Result.Result.Error( + Stdlib.UInt64.ParseError.BadFormat) -Stdlib.UInt64.parse_v0 "pi" = Stdlib.Result.Result.Error - Stdlib.UInt64.ParseError.BadFormat +Stdlib.UInt64.parse "pi" == Stdlib.Result.Result.Error( + Stdlib.UInt64.ParseError.BadFormat) -Stdlib.UInt64.parse_v0 "PACKAGE.Darklang.Stdlib.Math.pi" = Stdlib.Result.Result.Error - Stdlib.UInt64.ParseError.BadFormat +Stdlib.UInt64.parse "PACKAGE.Darklang.Stdlib.Math.pi" == Stdlib.Result.Result.Error( + Stdlib.UInt64.ParseError.BadFormat) -Stdlib.UInt64.parse_v0 "1.23E+04" = Stdlib.Result.Result.Error - Stdlib.UInt64.ParseError.BadFormat +Stdlib.UInt64.parse "1.23E+04" == Stdlib.Result.Result.Error( + Stdlib.UInt64.ParseError.BadFormat) -Stdlib.UInt64.parse_v0 "18446744073709551616" = Stdlib.Result.Result.Error - Stdlib.UInt64.ParseError.OutOfRange +Stdlib.UInt64.parse "18446744073709551616" == Stdlib.Result.Result.Error( + Stdlib.UInt64.ParseError.OutOfRange) -Stdlib.UInt64.parse_v0 "" = Stdlib.Result.Result.Error - Stdlib.UInt64.ParseError.BadFormat +Stdlib.UInt64.parse "" == Stdlib.Result.Result.Error( + Stdlib.UInt64.ParseError.BadFormat) -Stdlib.UInt64.parse_v0 "1I" = Stdlib.Result.Result.Error - Stdlib.UInt64.ParseError.BadFormat +Stdlib.UInt64.parse "1I" == Stdlib.Result.Result.Error( + Stdlib.UInt64.ParseError.BadFormat) -Stdlib.UInt64.parse_v0 "one" = Stdlib.Result.Result.Error - Stdlib.UInt64.ParseError.BadFormat +Stdlib.UInt64.parse "one" == Stdlib.Result.Result.Error( + Stdlib.UInt64.ParseError.BadFormat) -Stdlib.UInt64.parse_v0 "XIV" = Stdlib.Result.Result.Error - Stdlib.UInt64.ParseError.BadFormat +Stdlib.UInt64.parse "XIV" == Stdlib.Result.Result.Error( + Stdlib.UInt64.ParseError.BadFormat) -Stdlib.UInt64.toString 0UL = "0" -Stdlib.UInt64.toString 1UL = "1" -Stdlib.UInt64.toString 18446744073709551615UL = "18446744073709551615" +Stdlib.UInt64.toString 0UL == "0" +Stdlib.UInt64.toString 1UL == "1" +Stdlib.UInt64.toString 18446744073709551615UL == "18446744073709551615" -Stdlib.UInt64.fromInt8_v0 0y = Stdlib.Option.Option.Some 0UL +Stdlib.UInt64.fromInt8 0y == Stdlib.Option.Option.Some(0UL) -Stdlib.UInt64.fromInt8_v0 1y = Stdlib.Option.Option.Some 1UL +Stdlib.UInt64.fromInt8 1y == Stdlib.Option.Option.Some(1UL) -Stdlib.UInt64.fromInt8_v0 127y = Stdlib.Option.Option.Some 127UL +Stdlib.UInt64.fromInt8 127y == Stdlib.Option.Option.Some(127UL) -Stdlib.UInt64.fromInt8_v0 -128y = Stdlib.Option.Option.None +Stdlib.UInt64.fromInt8 -128y == Stdlib.Option.Option.None() -Stdlib.UInt64.fromUInt8_v0 0uy = 0UL +Stdlib.UInt64.fromUInt8 0uy == 0UL -Stdlib.UInt64.fromUInt8_v0 1uy = 1UL +Stdlib.UInt64.fromUInt8 1uy == 1UL -Stdlib.UInt64.fromUInt8_v0 255uy = 255UL +Stdlib.UInt64.fromUInt8 255uy == 255UL -Stdlib.UInt64.fromInt16_v0 0s = Stdlib.Option.Option.Some 0UL +Stdlib.UInt64.fromInt16 0s == Stdlib.Option.Option.Some(0UL) -Stdlib.UInt64.fromInt16_v0 1s = Stdlib.Option.Option.Some 1UL +Stdlib.UInt64.fromInt16 1s == Stdlib.Option.Option.Some(1UL) -Stdlib.UInt64.fromInt16_v0 32767s = Stdlib.Option.Option.Some 32767UL +Stdlib.UInt64.fromInt16 32767s == Stdlib.Option.Option.Some(32767UL) -Stdlib.UInt64.fromInt16_v0 -32768s = Stdlib.Option.Option.None +Stdlib.UInt64.fromInt16 -32768s == Stdlib.Option.Option.None() -Stdlib.UInt64.fromUInt16_v0 0us = 0UL +Stdlib.UInt64.fromUInt16 0us == 0UL -Stdlib.UInt64.fromUInt16_v0 1us = 1UL +Stdlib.UInt64.fromUInt16 1us == 1UL -Stdlib.UInt64.fromUInt16_v0 65535us = 65535UL +Stdlib.UInt64.fromUInt16 65535us == 65535UL -Stdlib.UInt64.fromInt32_v0 0l = Stdlib.Option.Option.Some 0UL +Stdlib.UInt64.fromInt32 0l == Stdlib.Option.Option.Some(0UL) -Stdlib.UInt64.fromInt32_v0 1l = Stdlib.Option.Option.Some 1UL +Stdlib.UInt64.fromInt32 1l == Stdlib.Option.Option.Some(1UL) -Stdlib.UInt64.fromInt32_v0 2147483647l = Stdlib.Option.Option.Some 2147483647UL +Stdlib.UInt64.fromInt32 2147483647l == Stdlib.Option.Option.Some(2147483647UL) -Stdlib.UInt64.fromInt32_v0 -1l = Stdlib.Option.Option.None +Stdlib.UInt64.fromInt32 -1l == Stdlib.Option.Option.None() -Stdlib.UInt64.fromUInt32_v0 0ul = 0UL +Stdlib.UInt64.fromUInt32 0ul == 0UL -Stdlib.UInt64.fromUInt32_v0 1ul = 1UL +Stdlib.UInt64.fromUInt32 1ul == 1UL -Stdlib.UInt64.fromUInt32_v0 4294967295ul = 4294967295UL +Stdlib.UInt64.fromUInt32 4294967295ul == 4294967295UL -Stdlib.UInt64.fromInt64_v0 0L = Stdlib.Option.Option.Some 0UL +Stdlib.UInt64.fromInt64 0L == Stdlib.Option.Option.Some(0UL) -Stdlib.UInt64.fromInt64_v0 1L = Stdlib.Option.Option.Some 1UL +Stdlib.UInt64.fromInt64 1L == Stdlib.Option.Option.Some(1UL) -Stdlib.UInt64.fromInt64_v0 9223372036854775807L = Stdlib.Option.Option.Some - 9223372036854775807UL +Stdlib.UInt64.fromInt64 9223372036854775807L == Stdlib.Option.Option.Some(9223372036854775807UL) -Stdlib.UInt64.fromInt64_v0 -1L = Stdlib.Option.Option.None +Stdlib.UInt64.fromInt64 -1L == Stdlib.Option.Option.None() -Stdlib.UInt64.fromInt128_v0 0Q = Stdlib.Option.Option.Some 0UL +Stdlib.UInt64.fromInt128 0Q == Stdlib.Option.Option.Some(0UL) -Stdlib.UInt64.fromInt128_v0 1Q = Stdlib.Option.Option.Some 1UL +Stdlib.UInt64.fromInt128 1Q == Stdlib.Option.Option.Some(1UL) -Stdlib.UInt64.fromInt128_v0 -1Q = Stdlib.Option.Option.None +Stdlib.UInt64.fromInt128 -1Q == Stdlib.Option.Option.None() -Stdlib.UInt64.fromInt128_v0 18446744073709551616Q = Stdlib.Option.Option.None +Stdlib.UInt64.fromInt128 18446744073709551616Q == Stdlib.Option.Option.None() -Stdlib.UInt64.fromInt128_v0 170141183460469231731687303715884105727Q = Stdlib.Option.Option.None +Stdlib.UInt64.fromInt128 170141183460469231731687303715884105727Q == Stdlib.Option.Option.None() -Stdlib.UInt64.fromUInt128_v0 0Z = Stdlib.Option.Option.Some 0UL +Stdlib.UInt64.fromUInt128 0Z == Stdlib.Option.Option.Some(0UL) -Stdlib.UInt64.fromUInt128_v0 1Z = Stdlib.Option.Option.Some 1UL +Stdlib.UInt64.fromUInt128 1Z == Stdlib.Option.Option.Some(1UL) -Stdlib.UInt64.fromUInt128_v0 18446744073709551615Z = Stdlib.Option.Option.Some - 18446744073709551615UL +Stdlib.UInt64.fromUInt128 18446744073709551615Z == Stdlib.Option.Option.Some(18446744073709551615UL) -Stdlib.UInt64.fromUInt128_v0 18446744073709551616Z = Stdlib.Option.Option.None +Stdlib.UInt64.fromUInt128 18446744073709551616Z == Stdlib.Option.Option.None() -Stdlib.UInt64.fromUInt128_v0 340282366920938463463374607431768211455Z = Stdlib.Option.Option.None \ No newline at end of file +Stdlib.UInt64.fromUInt128 340282366920938463463374607431768211455Z == Stdlib.Option.Option.None() \ No newline at end of file diff --git a/backend/testfiles/execution/stdlib/uint8.dark b/backend/testfiles/execution/stdlib/uint8.dark index bdf662f6e2..6d759e458b 100644 --- a/backend/testfiles/execution/stdlib/uint8.dark +++ b/backend/testfiles/execution/stdlib/uint8.dark @@ -1,262 +1,262 @@ -Stdlib.UInt8.max_v0 5uy 6uy = 6uy -Stdlib.UInt8.max_v0 10uy 1uy = 10uy -Stdlib.UInt8.max_v0 0uy 6uy = 6uy -Stdlib.UInt8.max_v0 255uy 0uy = 255uy +Stdlib.UInt8.max 5uy 6uy == 6uy +Stdlib.UInt8.max 10uy 1uy == 10uy +Stdlib.UInt8.max 0uy 6uy == 6uy +Stdlib.UInt8.max 255uy 0uy == 255uy -Stdlib.UInt8.min_v0 5uy 6uy = 5uy -Stdlib.UInt8.min_v0 10uy 10uy = 10uy -Stdlib.UInt8.min_v0 255uy 0uy = 0uy +Stdlib.UInt8.min 5uy 6uy == 5uy +Stdlib.UInt8.min 10uy 10uy == 10uy +Stdlib.UInt8.min 255uy 0uy == 0uy -Stdlib.UInt8.clamp_v0 1uy 2uy 1uy = 1uy -Stdlib.UInt8.clamp_v0 3uy 0uy 2uy = 2uy -Stdlib.UInt8.clamp_v0 100uy 0uy 0uy = 0uy -Stdlib.UInt8.clamp_v0 100uy 0uy 1uy = 1uy -Stdlib.UInt8.clamp_v0 100uy 1uy 0uy = 1uy +Stdlib.UInt8.clamp 1uy 2uy 1uy == 1uy +Stdlib.UInt8.clamp 3uy 0uy 2uy == 2uy +Stdlib.UInt8.clamp 100uy 0uy 0uy == 0uy +Stdlib.UInt8.clamp 100uy 0uy 1uy == 1uy +Stdlib.UInt8.clamp 100uy 1uy 0uy == 1uy -Stdlib.UInt8.add_v0 10uy 9uy = 19uy -Stdlib.UInt8.add_v0 88uy 9uy = 97uy -Stdlib.UInt8.add_v0 1uy 0uy = 1uy -Stdlib.UInt8.add_v0 254uy 1uy = 255uy +Stdlib.UInt8.add 10uy 9uy == 19uy +Stdlib.UInt8.add 88uy 9uy == 97uy +Stdlib.UInt8.add 1uy 0uy == 1uy +Stdlib.UInt8.add 254uy 1uy == 255uy -Stdlib.UInt8.add_v0 255uy 1uy = Builtin.testDerrorMessage "Out of range" +Stdlib.UInt8.add 255uy 1uy == Builtin.testDerrorMessage "Out of range" -Stdlib.UInt8.subtract_v0 10uy 9uy = 1uy -Stdlib.UInt8.subtract_v0 88uy 9uy = 79uy +Stdlib.UInt8.subtract 10uy 9uy == 1uy +Stdlib.UInt8.subtract 88uy 9uy == 79uy -Stdlib.UInt8.subtract_v0 0uy 1uy = Builtin.testDerrorMessage "Out of range" +Stdlib.UInt8.subtract 0uy 1uy == Builtin.testDerrorMessage "Out of range" -Stdlib.UInt8.subtract_v0 1uy 0uy = 1uy -Stdlib.UInt8.subtract_v0 255uy 1uy = 254uy +Stdlib.UInt8.subtract 1uy 0uy == 1uy +Stdlib.UInt8.subtract 255uy 1uy == 254uy -Stdlib.UInt8.multiply_v0 8uy 8uy = 64uy -Stdlib.UInt8.multiply_v0 8uy 0uy = 0uy -Stdlib.UInt8.multiply_v0 127uy 2uy = 254uy +Stdlib.UInt8.multiply 8uy 8uy == 64uy +Stdlib.UInt8.multiply 8uy 0uy == 0uy +Stdlib.UInt8.multiply 127uy 2uy == 254uy -Stdlib.UInt8.multiply_v0 128uy 2uy = Builtin.testDerrorMessage "Out of range" +Stdlib.UInt8.multiply 128uy 2uy == Builtin.testDerrorMessage "Out of range" -Stdlib.UInt8.multiply_v0 255uy 2uy = Builtin.testDerrorMessage "Out of range" +Stdlib.UInt8.multiply 255uy 2uy == Builtin.testDerrorMessage "Out of range" -Stdlib.UInt8.power_v0 2uy 3uy = 8uy -Stdlib.UInt8.power_v0 0uy 1uy = 0uy -Stdlib.UInt8.power_v0 1uy 0uy = 1uy -Stdlib.UInt8.power_v0 0uy 0uy = 1uy -Stdlib.UInt8.power_v0 1uy 255uy = 1uy +Stdlib.UInt8.power 2uy 3uy == 8uy +Stdlib.UInt8.power 0uy 1uy == 0uy +Stdlib.UInt8.power 1uy 0uy == 1uy +Stdlib.UInt8.power 0uy 0uy == 1uy +Stdlib.UInt8.power 1uy 255uy == 1uy -Stdlib.UInt8.power_v0 16uy 2uy = Builtin.testDerrorMessage "Out of range" +Stdlib.UInt8.power 16uy 2uy == Builtin.testDerrorMessage "Out of range" -Stdlib.UInt8.divide_v0 10uy 5uy = 2uy -Stdlib.UInt8.divide_v0 17uy 3uy = 5uy -Stdlib.UInt8.divide_v0 8uy 5uy = 1uy -Stdlib.UInt8.divide_v0 0uy 1uy = 0uy -Stdlib.UInt8.divide_v0 255uy 2uy = 127uy +Stdlib.UInt8.divide 10uy 5uy == 2uy +Stdlib.UInt8.divide 17uy 3uy == 5uy +Stdlib.UInt8.divide 8uy 5uy == 1uy +Stdlib.UInt8.divide 0uy 1uy == 0uy +Stdlib.UInt8.divide 255uy 2uy == 127uy -Stdlib.UInt8.divide_v0 1uy 0uy = Builtin.testDerrorMessage "Division by zero" +Stdlib.UInt8.divide 1uy 0uy == Builtin.testDerrorMessage "Division by zero" -Stdlib.UInt8.greaterThan_v0 20uy 1uy = true +Stdlib.UInt8.greaterThan 20uy 1uy == true -Stdlib.UInt8.greaterThanOrEqualTo_v0 0uy 1uy = false -Stdlib.UInt8.greaterThanOrEqualTo_v0 1uy 0uy = true -Stdlib.UInt8.greaterThanOrEqualTo_v0 6uy 1uy = true -Stdlib.UInt8.greaterThanOrEqualTo_v0 6uy 8uy = false -Stdlib.UInt8.greaterThanOrEqualTo_v0 255uy 0uy = true -Stdlib.UInt8.greaterThanOrEqualTo_v0 0uy 255uy = false +Stdlib.UInt8.greaterThanOrEqualTo 0uy 1uy == false +Stdlib.UInt8.greaterThanOrEqualTo 1uy 0uy == true +Stdlib.UInt8.greaterThanOrEqualTo 6uy 1uy == true +Stdlib.UInt8.greaterThanOrEqualTo 6uy 8uy == false +Stdlib.UInt8.greaterThanOrEqualTo 255uy 0uy == true +Stdlib.UInt8.greaterThanOrEqualTo 0uy 255uy == false -Stdlib.UInt8.lessThanOrEqualTo_v0 6uy 8uy = true -Stdlib.UInt8.lessThanOrEqualTo_v0 10uy 1uy = false -Stdlib.UInt8.lessThanOrEqualTo_v0 0uy 1uy = true -Stdlib.UInt8.lessThanOrEqualTo_v0 1uy 0uy = false -Stdlib.UInt8.lessThanOrEqualTo_v0 255uy 0uy = false -Stdlib.UInt8.lessThanOrEqualTo_v0 0uy 255uy = true -Stdlib.UInt8.lessThanOrEqualTo_v0 255uy 255uy = true +Stdlib.UInt8.lessThanOrEqualTo 6uy 8uy == true +Stdlib.UInt8.lessThanOrEqualTo 10uy 1uy == false +Stdlib.UInt8.lessThanOrEqualTo 0uy 1uy == true +Stdlib.UInt8.lessThanOrEqualTo 1uy 0uy == false +Stdlib.UInt8.lessThanOrEqualTo 255uy 0uy == false +Stdlib.UInt8.lessThanOrEqualTo 0uy 255uy == true +Stdlib.UInt8.lessThanOrEqualTo 255uy 255uy == true -Stdlib.UInt8.lessThan_v0 6uy 8uy = true -Stdlib.UInt8.lessThan_v0 10uy 1uy = false -Stdlib.UInt8.lessThan_v0 0uy 1uy = true -Stdlib.UInt8.lessThan_v0 1uy 0uy = false -Stdlib.UInt8.lessThan_v0 0uy 255uy = true -Stdlib.UInt8.lessThan_v0 255uy 255uy = false +Stdlib.UInt8.lessThan 6uy 8uy == true +Stdlib.UInt8.lessThan 10uy 1uy == false +Stdlib.UInt8.lessThan 0uy 1uy == true +Stdlib.UInt8.lessThan 1uy 0uy == false +Stdlib.UInt8.lessThan 0uy 255uy == true +Stdlib.UInt8.lessThan 255uy 255uy == false -Stdlib.UInt8.toString 120uy = "120" -Stdlib.UInt8.toString 1uy = "1" -Stdlib.UInt8.toString 0uy = "0" // UInt8 lower limit -Stdlib.UInt8.toString 255uy = "255" // UInt8 upper limit +Stdlib.UInt8.toString 120uy == "120" +Stdlib.UInt8.toString 1uy == "1" +Stdlib.UInt8.toString 0uy == "0" // UInt8 lower limit +Stdlib.UInt8.toString 255uy == "255" // UInt8 upper limit -Stdlib.UInt8.toFloat_v0 2uy = 2.0 -Stdlib.UInt8.toFloat_v0 0uy = 0.0 +Stdlib.UInt8.toFloat 2uy == 2.0 +Stdlib.UInt8.toFloat 0uy == 0.0 -Stdlib.UInt8.sqrt_v0 4uy = 2.0 -Stdlib.UInt8.sqrt_v0 100uy = 10.0 -Stdlib.UInt8.sqrt_v0 86uy = 9.273618495495704 +Stdlib.UInt8.sqrt 4uy == 2.0 +Stdlib.UInt8.sqrt 100uy == 10.0 +Stdlib.UInt8.sqrt 86uy == 9.273618495495704 -Stdlib.UInt8.mod_v0 15uy 5uy = 0uy -Stdlib.UInt8.mod_v0 15uy 6uy = 3uy -Stdlib.UInt8.mod_v0 0uy 15uy = 0uy -Stdlib.UInt8.mod_v0 1uy 2uy = 1uy -Stdlib.UInt8.mod_v0 128uy 53uy = 22uy -Stdlib.UInt8.mod_v0 255uy 3uy = 0uy +Stdlib.UInt8.mod 15uy 5uy == 0uy +Stdlib.UInt8.mod 15uy 6uy == 3uy +Stdlib.UInt8.mod 0uy 15uy == 0uy +Stdlib.UInt8.mod 1uy 2uy == 1uy +Stdlib.UInt8.mod 128uy 53uy == 22uy +Stdlib.UInt8.mod 255uy 3uy == 0uy -Stdlib.UInt8.mod_v0 5uy 0uy = Builtin.testDerrorMessage "Zero modulus" +Stdlib.UInt8.mod 5uy 0uy == Builtin.testDerrorMessage "Zero modulus" -(Stdlib.List.range_v0 1L 5L) -|> Stdlib.List.map_v0 (fun x -> Stdlib.UInt8.random 1uy 2uy) -|> Stdlib.List.map_v0 (fun x -> +(Stdlib.List.range 1L 5L) +|> Stdlib.List.map (fun x -> Stdlib.UInt8.random 1uy 2uy) +|> Stdlib.List.map (fun x -> (Stdlib.UInt8.greaterThanOrEqualTo x 1uy) - && (Stdlib.UInt8.lessThanOrEqualTo x 2uy)) = [ true; true; true; true; true ] + && (Stdlib.UInt8.lessThanOrEqualTo x 2uy)) == [ true; true; true; true; true ] -(Stdlib.List.range_v0 1L 5L) -|> Stdlib.List.map_v0 (fun x -> Stdlib.UInt8.random 10uy 20uy) -|> Stdlib.List.map_v0 (fun x -> +(Stdlib.List.range 1L 5L) +|> Stdlib.List.map (fun x -> Stdlib.UInt8.random 10uy 20uy) +|> Stdlib.List.map (fun x -> (Stdlib.UInt8.greaterThanOrEqualTo x 10uy) - && (Stdlib.UInt8.lessThanOrEqualTo x 20uy)) = [ true; true; true; true; true ] + && (Stdlib.UInt8.lessThanOrEqualTo x 20uy)) == [ true; true; true; true; true ] -(Stdlib.List.range_v0 1L 5L) -|> Stdlib.List.map_v0 (fun x -> Stdlib.UInt8.random 2uy 1uy) -|> Stdlib.List.map_v0 (fun x -> +(Stdlib.List.range 1L 5L) +|> Stdlib.List.map (fun x -> Stdlib.UInt8.random 2uy 1uy) +|> Stdlib.List.map (fun x -> (Stdlib.UInt8.greaterThanOrEqualTo x 1uy) - && (Stdlib.UInt8.lessThanOrEqualTo x 2uy)) = [ true; true; true; true; true ] + && (Stdlib.UInt8.lessThanOrEqualTo x 2uy)) == [ true; true; true; true; true ] -(Stdlib.List.range_v0 1L 5L) -|> Stdlib.List.map_v0 (fun x -> Stdlib.UInt8.random 20uy 10uy) -|> Stdlib.List.map_v0 (fun x -> +(Stdlib.List.range 1L 5L) +|> Stdlib.List.map (fun x -> Stdlib.UInt8.random 20uy 10uy) +|> Stdlib.List.map (fun x -> (Stdlib.UInt8.greaterThanOrEqualTo x 10uy) - && (Stdlib.UInt8.lessThanOrEqualTo x 20uy)) = [ true; true; true; true; true ] + && (Stdlib.UInt8.lessThanOrEqualTo x 20uy)) == [ true; true; true; true; true ] -((Stdlib.List.range_v0 1L 100L) - |> Stdlib.List.map_v0 (fun x -> Stdlib.UInt8.random 0uy 1uy) - |> Stdlib.List.unique_v0) = [ 0uy; 1uy ] +((Stdlib.List.range 1L 100L) + |> Stdlib.List.map (fun x -> Stdlib.UInt8.random 0uy 1uy) + |> Stdlib.List.unique) == [ 0uy; 1uy ] -((Stdlib.List.range_v0 1L 100L) - |> Stdlib.List.map_v0 (fun x -> Stdlib.UInt8.random 0uy 2uy) - |> Stdlib.List.unique_v0) = [ 0uy; 1uy; 2uy ] +((Stdlib.List.range 1L 100L) + |> Stdlib.List.map (fun x -> Stdlib.UInt8.random 0uy 2uy) + |> Stdlib.List.unique) == [ 0uy; 1uy; 2uy ] -Stdlib.UInt8.sum_v0 [ 1uy; 2uy ] = 3uy +Stdlib.UInt8.sum [ 1uy; 2uy ] == 3uy -Stdlib.UInt8.sum_v0 [ 1uy; 255uy ] = Builtin.testDerrorMessage "Out of range" +Stdlib.UInt8.sum [ 1uy; 255uy ] == Builtin.testDerrorMessage "Out of range" -Stdlib.UInt8.parse_v0 "-129" = Stdlib.Result.Result.Error - Stdlib.UInt8.ParseError.OutOfRange +Stdlib.UInt8.parse "-129" == Stdlib.Result.Result.Error( + Stdlib.UInt8.ParseError.OutOfRange()) -Stdlib.UInt8.parse_v0 "256" = Stdlib.Result.Result.Error - Stdlib.UInt8.ParseError.OutOfRange +Stdlib.UInt8.parse "256" == Stdlib.Result.Result.Error( + Stdlib.UInt8.ParseError.OutOfRange()) -Stdlib.UInt8.parse_v0 "256uy" = Stdlib.Result.Result.Error - Stdlib.UInt8.ParseError.BadFormat +Stdlib.UInt8.parse "256uy" == Stdlib.Result.Result.Error( + Stdlib.UInt8.ParseError.BadFormat()) -Stdlib.UInt8.parse_v0 "1 2 3" = Stdlib.Result.Result.Error - Stdlib.UInt8.ParseError.BadFormat +Stdlib.UInt8.parse "1 2 3" == Stdlib.Result.Result.Error( + Stdlib.UInt8.ParseError.BadFormat()) -Stdlib.UInt8.parse_v0 "+ 1" = Stdlib.Result.Result.Error - Stdlib.UInt8.ParseError.BadFormat +Stdlib.UInt8.parse "+ 1" == Stdlib.Result.Result.Error( + Stdlib.UInt8.ParseError.BadFormat()) -Stdlib.UInt8.parse_v0 "- 1" = Stdlib.Result.Result.Error - Stdlib.UInt8.ParseError.BadFormat +Stdlib.UInt8.parse "- 1" == Stdlib.Result.Result.Error( + Stdlib.UInt8.ParseError.BadFormat()) -Stdlib.UInt8.parse_v0 "0xA" = Stdlib.Result.Result.Error - Stdlib.UInt8.ParseError.BadFormat +Stdlib.UInt8.parse "0xA" == Stdlib.Result.Result.Error( + Stdlib.UInt8.ParseError.BadFormat()) -Stdlib.UInt8.parse_v0 "0x123" = Stdlib.Result.Result.Error - Stdlib.UInt8.ParseError.BadFormat +Stdlib.UInt8.parse "0x123" == Stdlib.Result.Result.Error( + Stdlib.UInt8.ParseError.BadFormat()) -Stdlib.UInt8.parse_v0 "0b0100" = Stdlib.Result.Result.Error - Stdlib.UInt8.ParseError.BadFormat +Stdlib.UInt8.parse "0b0100" == Stdlib.Result.Result.Error( + Stdlib.UInt8.ParseError.BadFormat()) -Stdlib.UInt8.parse_v0 "pi" = Stdlib.Result.Result.Error - Stdlib.UInt8.ParseError.BadFormat +Stdlib.UInt8.parse "pi" == Stdlib.Result.Result.Error( + Stdlib.UInt8.ParseError.BadFormat()) -Stdlib.UInt8.parse_v0 "PACKAGE.Darklang.Stdlib.Math.pi" = Stdlib.Result.Result.Error - Stdlib.UInt8.ParseError.BadFormat +Stdlib.UInt8.parse "PACKAGE.Darklang.Stdlib.Math.pi" == Stdlib.Result.Result.Error( + Stdlib.UInt8.ParseError.BadFormat()) -Stdlib.UInt8.parse_v0 "1.23E+04" = Stdlib.Result.Result.Error - Stdlib.UInt8.ParseError.BadFormat +Stdlib.UInt8.parse "1.23E+04" == Stdlib.Result.Result.Error( + Stdlib.UInt8.ParseError.BadFormat()) -Stdlib.UInt8.parse_v0 "" = Stdlib.Result.Result.Error - Stdlib.UInt8.ParseError.BadFormat +Stdlib.UInt8.parse "" == Stdlib.Result.Result.Error( + Stdlib.UInt8.ParseError.BadFormat()) -Stdlib.UInt8.parse_v0 "1I" = Stdlib.Result.Result.Error - Stdlib.UInt8.ParseError.BadFormat +Stdlib.UInt8.parse "1I" == Stdlib.Result.Result.Error( + Stdlib.UInt8.ParseError.BadFormat()) -Stdlib.UInt8.parse_v0 "one" = Stdlib.Result.Result.Error - Stdlib.UInt8.ParseError.BadFormat +Stdlib.UInt8.parse "one" == Stdlib.Result.Result.Error( + Stdlib.UInt8.ParseError.BadFormat()) -Stdlib.UInt8.parse_v0 "XIV" = Stdlib.Result.Result.Error - Stdlib.UInt8.ParseError.BadFormat +Stdlib.UInt8.parse "XIV" == Stdlib.Result.Result.Error( + Stdlib.UInt8.ParseError.BadFormat()) -Stdlib.UInt8.fromInt8_v0 0y = Stdlib.Option.Option.Some 0uy +Stdlib.UInt8.fromInt8 0y == Stdlib.Option.Option.Some(0uy) -Stdlib.UInt8.fromInt8_v0 1y = Stdlib.Option.Option.Some 1uy +Stdlib.UInt8.fromInt8 1y == Stdlib.Option.Option.Some(1uy) -Stdlib.UInt8.fromInt8_v0 127y = Stdlib.Option.Option.Some 127uy +Stdlib.UInt8.fromInt8 127y == Stdlib.Option.Option.Some(127uy) -Stdlib.UInt8.fromInt8_v0 (-128y) = Stdlib.Option.Option.None +Stdlib.UInt8.fromInt8 (-128y) == Stdlib.Option.Option.None() -Stdlib.UInt8.fromInt16_v0 0s = Stdlib.Option.Option.Some 0uy +Stdlib.UInt8.fromInt16 0s == Stdlib.Option.Option.Some(0uy) -Stdlib.UInt8.fromInt16_v0 1s = Stdlib.Option.Option.Some 1uy +Stdlib.UInt8.fromInt16 1s == Stdlib.Option.Option.Some(1uy) -Stdlib.UInt8.fromInt16_v0 255s = Stdlib.Option.Option.Some 255uy +Stdlib.UInt8.fromInt16 255s == Stdlib.Option.Option.Some(255uy) -Stdlib.UInt8.fromInt16_v0 256s = Stdlib.Option.Option.None -Stdlib.UInt8.fromInt16_v0 (-1s) = Stdlib.Option.Option.None +Stdlib.UInt8.fromInt16 256s == Stdlib.Option.Option.None() +Stdlib.UInt8.fromInt16 (-1s) == Stdlib.Option.Option.None() -Stdlib.UInt8.fromUInt16_v0 0us = Stdlib.Option.Option.Some 0uy +Stdlib.UInt8.fromUInt16 0us == Stdlib.Option.Option.Some(0uy) -Stdlib.UInt8.fromUInt16_v0 1us = Stdlib.Option.Option.Some 1uy +Stdlib.UInt8.fromUInt16 1us == Stdlib.Option.Option.Some(1uy) -Stdlib.UInt8.fromUInt16_v0 255us = Stdlib.Option.Option.Some 255uy +Stdlib.UInt8.fromUInt16 255us == Stdlib.Option.Option.Some(255uy) -Stdlib.UInt8.fromUInt16_v0 256us = Stdlib.Option.Option.None +Stdlib.UInt8.fromUInt16 256us == Stdlib.Option.Option.None() -Stdlib.UInt8.fromInt32_v0 0l = Stdlib.Option.Option.Some 0uy +Stdlib.UInt8.fromInt32 0l == Stdlib.Option.Option.Some(0uy) -Stdlib.UInt8.fromInt32_v0 1l = Stdlib.Option.Option.Some 1uy +Stdlib.UInt8.fromInt32 1l == Stdlib.Option.Option.Some(1uy) -Stdlib.UInt8.fromInt32_v0 255l = Stdlib.Option.Option.Some 255uy +Stdlib.UInt8.fromInt32 255l == Stdlib.Option.Option.Some(255uy) -Stdlib.UInt8.fromInt32_v0 256l = Stdlib.Option.Option.None -Stdlib.UInt8.fromInt32_v0 (-1l) = Stdlib.Option.Option.None +Stdlib.UInt8.fromInt32 256l == Stdlib.Option.Option.None() +Stdlib.UInt8.fromInt32 (-1l) == Stdlib.Option.Option.None() -Stdlib.UInt8.fromUInt32_v0 0ul = Stdlib.Option.Option.Some 0uy +Stdlib.UInt8.fromUInt32 0ul == Stdlib.Option.Option.Some(0uy) -Stdlib.UInt8.fromUInt32_v0 1ul = Stdlib.Option.Option.Some 1uy +Stdlib.UInt8.fromUInt32 1ul == Stdlib.Option.Option.Some(1uy) -Stdlib.UInt8.fromUInt32_v0 255ul = Stdlib.Option.Option.Some 255uy +Stdlib.UInt8.fromUInt32 255ul == Stdlib.Option.Option.Some(255uy) -Stdlib.UInt8.fromUInt32_v0 256ul = Stdlib.Option.Option.None +Stdlib.UInt8.fromUInt32 256ul == Stdlib.Option.Option.None() -Stdlib.UInt8.fromInt64_v0 0L = Stdlib.Option.Option.Some 0uy +Stdlib.UInt8.fromInt64 0L == Stdlib.Option.Option.Some(0uy) -Stdlib.UInt8.fromInt64_v0 1L = Stdlib.Option.Option.Some 1uy +Stdlib.UInt8.fromInt64 1L == Stdlib.Option.Option.Some(1uy) -Stdlib.UInt8.fromInt64_v0 255L = Stdlib.Option.Option.Some 255uy +Stdlib.UInt8.fromInt64 255L == Stdlib.Option.Option.Some(255uy) -Stdlib.UInt8.fromInt64_v0 256L = Stdlib.Option.Option.None -Stdlib.UInt8.fromInt64_v0 (-1L) = Stdlib.Option.Option.None +Stdlib.UInt8.fromInt64 256L == Stdlib.Option.Option.None() +Stdlib.UInt8.fromInt64 (-1L) == Stdlib.Option.Option.None() -Stdlib.UInt8.fromUInt64_v0 0UL = Stdlib.Option.Option.Some 0uy +Stdlib.UInt8.fromUInt64 0UL == Stdlib.Option.Option.Some(0uy) -Stdlib.UInt8.fromUInt64_v0 1UL = Stdlib.Option.Option.Some 1uy +Stdlib.UInt8.fromUInt64 1UL == Stdlib.Option.Option.Some(1uy) -Stdlib.UInt8.fromUInt64_v0 255UL = Stdlib.Option.Option.Some 255uy +Stdlib.UInt8.fromUInt64 255UL == Stdlib.Option.Option.Some(255uy) -Stdlib.UInt8.fromUInt64_v0 256UL = Stdlib.Option.Option.None +Stdlib.UInt8.fromUInt64 256UL == Stdlib.Option.Option.None() -Stdlib.UInt8.fromInt128_v0 0Q = Stdlib.Option.Option.Some 0uy +Stdlib.UInt8.fromInt128 0Q == Stdlib.Option.Option.Some(0uy) -Stdlib.UInt8.fromInt128_v0 1Q = Stdlib.Option.Option.Some 1uy +Stdlib.UInt8.fromInt128 1Q == Stdlib.Option.Option.Some(1uy) -Stdlib.UInt8.fromInt128_v0 255Q = Stdlib.Option.Option.Some 255uy +Stdlib.UInt8.fromInt128 255Q == Stdlib.Option.Option.Some(255uy) -Stdlib.UInt8.fromInt128_v0 256Q = Stdlib.Option.Option.None -Stdlib.UInt8.fromInt128_v0 (-1Q) = Stdlib.Option.Option.None +Stdlib.UInt8.fromInt128 256Q == Stdlib.Option.Option.None() +Stdlib.UInt8.fromInt128 (-1Q) == Stdlib.Option.Option.None() -Stdlib.UInt8.fromUInt128_v0 0Z = Stdlib.Option.Option.Some 0uy +Stdlib.UInt8.fromUInt128 0Z == Stdlib.Option.Option.Some(0uy) -Stdlib.UInt8.fromUInt128_v0 1Z = Stdlib.Option.Option.Some 1uy +Stdlib.UInt8.fromUInt128 1Z == Stdlib.Option.Option.Some(1uy) -Stdlib.UInt8.fromUInt128_v0 255Z = Stdlib.Option.Option.Some 255uy +Stdlib.UInt8.fromUInt128 255Z == Stdlib.Option.Option.Some(255uy) -Stdlib.UInt8.fromUInt128_v0 256Z = Stdlib.Option.Option.None \ No newline at end of file +Stdlib.UInt8.fromUInt128 256Z == Stdlib.Option.Option.None() \ No newline at end of file diff --git a/backend/testfiles/execution/stdlib/uuid.dark b/backend/testfiles/execution/stdlib/uuid.dark index 805d7b07c6..e8047e3f93 100644 --- a/backend/testfiles/execution/stdlib/uuid.dark +++ b/backend/testfiles/execution/stdlib/uuid.dark @@ -1,25 +1,27 @@ -Stdlib.Uuid.parse_v0 "👱🏼" = Stdlib.Result.Result.Error - Stdlib.Uuid.ParseError.BadFormat +Stdlib.Uuid.parse "👱🏼" +== Stdlib.Result.Result.Error(Stdlib.Uuid.ParseError.BadFormat()) -Stdlib.Uuid.parse_v0 "1111111🍇-2222-3333-4444-555555555555" = Stdlib.Result.Result.Error - Stdlib.Uuid.ParseError.BadFormat +Stdlib.Uuid.parse "1111111🍇-2222-3333-4444-555555555555" +== Stdlib.Result.Result.Error(Stdlib.Uuid.ParseError.BadFormat()) -Stdlib.Uuid.parse_v0 "psp-soslsls==" = Stdlib.Result.Result.Error - Stdlib.Uuid.ParseError.BadFormat +Stdlib.Uuid.parse "psp-soslsls====" +== Stdlib.Result.Result.Error(Stdlib.Uuid.ParseError.BadFormat()) -Stdlib.Uuid.parse_v0 "123456" = Stdlib.Result.Result.Error - Stdlib.Uuid.ParseError.BadFormat +Stdlib.Uuid.parse "123456" +== Stdlib.Result.Result.Error(Stdlib.Uuid.ParseError.BadFormat()) -Stdlib.Uuid.parse_v0 "d388ff30-667f-11eb-ae93" = Stdlib.Result.Result.Error - Stdlib.Uuid.ParseError.BadFormat +Stdlib.Uuid.parse "d388ff30-667f-11eb-ae93" +== Stdlib.Result.Result.Error(Stdlib.Uuid.ParseError.BadFormat()) -Stdlib.Uuid.parse_v0 "d388ff30-667f-11eb-ae93-0242ac13000" = Stdlib.Result.Result.Error - Stdlib.Uuid.ParseError.BadFormat +Stdlib.Uuid.parse "d388ff30-667f-11eb-ae93-0242ac13000" +== Stdlib.Result.Result.Error(Stdlib.Uuid.ParseError.BadFormat()) -(Stdlib.Uuid.parse_v0 "3700adbc-7a46-4ff4-81d3-45afb03f6e2d") +(Stdlib.Uuid.parse "3700adbc-7a46-4ff4-81d3-45afb03f6e2d") |> Builtin.unwrap -|> Stdlib.Uuid.toString = "3700adbc-7a46-4ff4-81d3-45afb03f6e2d" +|> Stdlib.Uuid.toString +== "3700adbc-7a46-4ff4-81d3-45afb03f6e2d" -(Stdlib.Uuid.parse_v0 "11111111-2222-3333-4444-555555555555") +(Stdlib.Uuid.parse "11111111-2222-3333-4444-555555555555") |> Builtin.unwrap -|> Stdlib.Uuid.toString = "11111111-2222-3333-4444-555555555555" \ No newline at end of file +|> Stdlib.Uuid.toString +== "11111111-2222-3333-4444-555555555555" \ No newline at end of file diff --git a/backend/testfiles/execution/stdlib/x509.dark b/backend/testfiles/execution/stdlib/x509.dark index 510aff7500..f8f726446f 100644 --- a/backend/testfiles/execution/stdlib/x509.dark +++ b/backend/testfiles/execution/stdlib/x509.dark @@ -1,86 +1,85 @@ // All certs from https://fm4dd.com/openssl/certexamples.shtm module Errors = - Stdlib.X509.pemCertificatePublicKey_v0 "" = Stdlib.Result.Result.Error - "No certificates" + Stdlib.X509.pemCertificatePublicKey "" + == Stdlib.Result.Result.Error("No certificates") - Stdlib.X509.pemCertificatePublicKey_v0 "ABC" = Stdlib.Result.Result.Error - "No certificates" + Stdlib.X509.pemCertificatePublicKey "ABC" + == Stdlib.Result.Result.Error("No certificates") - Stdlib.X509.pemCertificatePublicKey_v0 - "-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----" = Stdlib.Result.Result.Error - "No certificates" + Stdlib.X509.pemCertificatePublicKey + "-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----" + == Stdlib.Result.Result.Error("No certificates") - Stdlib.X509.pemCertificatePublicKey_v0 - "-----BEGIN CERTIFICATE-----\nABC-----END CERTIFICATE-----" = Stdlib.Result.Result.Error - "No certificates" + Stdlib.X509.pemCertificatePublicKey + "-----BEGIN CERTIFICATE-----\nABC-----END CERTIFICATE-----" + == Stdlib.Result.Result.Error("No certificates") module RSA = // 512B Cert PEM - Stdlib.X509.pemCertificatePublicKey_v0 - "-----BEGIN CERTIFICATE-----\nMIICEjCCAXsCAg36MA0GCSqGSIb3DQEBBQUAMIGbMQswCQYDVQQGEwJKUDEOMAwG\nA1UECBMFVG9reW8xEDAOBgNVBAcTB0NodW8ta3UxETAPBgNVBAoTCEZyYW5rNERE\nMRgwFgYDVQQLEw9XZWJDZXJ0IFN1cHBvcnQxGDAWBgNVBAMTD0ZyYW5rNEREIFdl\nYiBDQTEjMCEGCSqGSIb3DQEJARYUc3VwcG9ydEBmcmFuazRkZC5jb20wHhcNMTIw\nODIyMDUyNjU0WhcNMTcwODIxMDUyNjU0WjBKMQswCQYDVQQGEwJKUDEOMAwGA1UE\nCAwFVG9reW8xETAPBgNVBAoMCEZyYW5rNEREMRgwFgYDVQQDDA93d3cuZXhhbXBs\nZS5jb20wXDANBgkqhkiG9w0BAQEFAANLADBIAkEAm/xmkHmEQrurE/0re/jeFRLl\n8ZPjBop7uLHhnia7lQG/5zDtZIUC3RVpqDSwBuw/NTweGyuP+o8AG98HxqxTBwID\nAQABMA0GCSqGSIb3DQEBBQUAA4GBABS2TLuBeTPmcaTaUW/LCB2NYOy8GMdzR1mx\n8iBIu2H6/E2tiY3RIevV2OW61qY2/XRQg7YPxx3ffeUugX9F4J/iPnnu1zAxxyBy\n2VguKv4SWjRFoRkIfIlHX0qVviMhSlNy2ioFLy7JcPZb+v3ftDGywUqcBiVDoea0\nHn+GmxZA\n-----END CERTIFICATE-----" = Stdlib.Result.Result.Ok - "-----BEGIN PUBLIC KEY-----\nMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJv8ZpB5hEK7qxP9K3v43hUS5fGT4waK\ne7ix4Z4mu5UBv+cw7WSFAt0Vaag0sAbsPzU8Hhsrj/qPABvfB8asUwcCAwEAAQ==\n-----END PUBLIC KEY-----\n" + Stdlib.X509.pemCertificatePublicKey "-----BEGIN CERTIFICATE-----\nMIICEjCCAXsCAg36MA0GCSqGSIb3DQEBBQUAMIGbMQswCQYDVQQGEwJKUDEOMAwG\nA1UECBMFVG9reW8xEDAOBgNVBAcTB0NodW8ta3UxETAPBgNVBAoTCEZyYW5rNERE\nMRgwFgYDVQQLEw9XZWJDZXJ0IFN1cHBvcnQxGDAWBgNVBAMTD0ZyYW5rNEREIFdl\nYiBDQTEjMCEGCSqGSIb3DQEJARYUc3VwcG9ydEBmcmFuazRkZC5jb20wHhcNMTIw\nODIyMDUyNjU0WhcNMTcwODIxMDUyNjU0WjBKMQswCQYDVQQGEwJKUDEOMAwGA1UE\nCAwFVG9reW8xETAPBgNVBAoMCEZyYW5rNEREMRgwFgYDVQQDDA93d3cuZXhhbXBs\nZS5jb20wXDANBgkqhkiG9w0BAQEFAANLADBIAkEAm/xmkHmEQrurE/0re/jeFRLl\n8ZPjBop7uLHhnia7lQG/5zDtZIUC3RVpqDSwBuw/NTweGyuP+o8AG98HxqxTBwID\nAQABMA0GCSqGSIb3DQEBBQUAA4GBABS2TLuBeTPmcaTaUW/LCB2NYOy8GMdzR1mx\n8iBIu2H6/E2tiY3RIevV2OW61qY2/XRQg7YPxx3ffeUugX9F4J/iPnnu1zAxxyBy\n2VguKv4SWjRFoRkIfIlHX0qVviMhSlNy2ioFLy7JcPZb+v3ftDGywUqcBiVDoea0\nHn+GmxZA\n-----END CERTIFICATE-----" + == Stdlib.Result.Result.Ok("-----BEGIN PUBLIC KEY-----\nMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJv8ZpB5hEK7qxP9K3v43hUS5fGT4waK\ne7ix4Z4mu5UBv+cw7WSFAt0Vaag0sAbsPzU8Hhsrj/qPABvfB8asUwcCAwEAAQ==\n-----END PUBLIC KEY-----\n") // 512B CSR PEM - Stdlib.X509.pemCertificatePublicKey_v0 - "-----BEGIN CERTIFICATE REQUEST-----\nMIIBBDCBrwIBADBKMQswCQYDVQQGEwJKUDEOMAwGA1UECAwFVG9reW8xETAPBgNV\nBAoMCEZyYW5rNEREMRgwFgYDVQQDDA93d3cuZXhhbXBsZS5jb20wXDANBgkqhkiG\n9w0BAQEFAANLADBIAkEAm/xmkHmEQrurE/0re/jeFRLl8ZPjBop7uLHhnia7lQG/\n5zDtZIUC3RVpqDSwBuw/NTweGyuP+o8AG98HxqxTBwIDAQABoAAwDQYJKoZIhvcN\nAQEFBQADQQByOV52Y17y8xw1V/xvru3rLPrVxYAXS5SgvNpfBsj38lNVtTvuH/Mg\nroBgmjSpnqKqBiBDkoY2YUET2qmGjAu9\n-----END CERTIFICATE REQUEST-----\n" = Stdlib.Result.Result.Error - "No certificates" + Stdlib.X509.pemCertificatePublicKey + "-----BEGIN CERTIFICATE REQUEST-----\nMIIBBDCBrwIBADBKMQswCQYDVQQGEwJKUDEOMAwGA1UECAwFVG9reW8xETAPBgNV\nBAoMCEZyYW5rNEREMRgwFgYDVQQDDA93d3cuZXhhbXBsZS5jb20wXDANBgkqhkiG\n9w0BAQEFAANLADBIAkEAm/xmkHmEQrurE/0re/jeFRLl8ZPjBop7uLHhnia7lQG/\n5zDtZIUC3RVpqDSwBuw/NTweGyuP+o8AG98HxqxTBwIDAQABoAAwDQYJKoZIhvcN\nAQEFBQADQQByOV52Y17y8xw1V/xvru3rLPrVxYAXS5SgvNpfBsj38lNVtTvuH/Mg\nroBgmjSpnqKqBiBDkoY2YUET2qmGjAu9\n-----END CERTIFICATE REQUEST-----\n" + == Stdlib.Result.Result.Error("No certificates") // RSA 512B Keypair PEM - Stdlib.X509.pemCertificatePublicKey_v0 - "-----BEGIN RSA PRIVATE KEY-----\nMIIBOwIBAAJBAJv8ZpB5hEK7qxP9K3v43hUS5fGT4waKe7ix4Z4mu5UBv+cw7WSF\nAt0Vaag0sAbsPzU8Hhsrj/qPABvfB8asUwcCAwEAAQJAG0r3ezH35WFG1tGGaUOr\nQA61cyaII53ZdgCR1IU8bx7AUevmkFtBf+aqMWusWVOWJvGu2r5VpHVAIl8nF6DS\nkQIhAMjEJ3zVYa2/Mo4ey+iU9J9Vd+WoyXDQD4EEtwmyG1PpAiEAxuZlvhDIbbce\n7o5BvOhnCZ2N7kYb1ZC57g3F+cbJyW8CIQCbsDGHBto2qJyFxbAO7uQ8Y0UVHa0J\nBO/g900SAcJbcQIgRtEljIShOB8pDjrsQPxmI1BLhnjD1EhRSubwhDw5AFUCIQCN\nA24pDtdOHydwtSB5+zFqFLfmVZplQM/g5kb4so70Yw==\n-----END RSA PRIVATE KEY-----" = Stdlib.Result.Result.Error - "No certificates" + Stdlib.X509.pemCertificatePublicKey + "-----BEGIN RSA PRIVATE KEY-----\nMIIBOwIBAAJBAJv8ZpB5hEK7qxP9K3v43hUS5fGT4waKe7ix4Z4mu5UBv+cw7WSF\nAt0Vaag0sAbsPzU8Hhsrj/qPABvfB8asUwcCAwEAAQJAG0r3ezH35WFG1tGGaUOr\nQA61cyaII53ZdgCR1IU8bx7AUevmkFtBf+aqMWusWVOWJvGu2r5VpHVAIl8nF6DS\nkQIhAMjEJ3zVYa2/Mo4ey+iU9J9Vd+WoyXDQD4EEtwmyG1PpAiEAxuZlvhDIbbce\n7o5BvOhnCZ2N7kYb1ZC57g3F+cbJyW8CIQCbsDGHBto2qJyFxbAO7uQ8Y0UVHa0J\nBO/g900SAcJbcQIgRtEljIShOB8pDjrsQPxmI1BLhnjD1EhRSubwhDw5AFUCIQCN\nA24pDtdOHydwtSB5+zFqFLfmVZplQM/g5kb4so70Yw==\n-----END RSA PRIVATE KEY-----" + == Stdlib.Result.Result.Error("No certificates") module DSA = // DSA 512B Cert PEM - Stdlib.X509.pemCertificatePublicKey_v0 - "-----BEGIN CERTIFICATE-----\nMIICpzCCAhACAg4AMA0GCSqGSIb3DQEBBQUAMIGbMQswCQYDVQQGEwJKUDEOMAwG\nA1UECBMFVG9reW8xEDAOBgNVBAcTB0NodW8ta3UxETAPBgNVBAoTCEZyYW5rNERE\nMRgwFgYDVQQLEw9XZWJDZXJ0IFN1cHBvcnQxGDAWBgNVBAMTD0ZyYW5rNEREIFdl\nYiBDQTEjMCEGCSqGSIb3DQEJARYUc3VwcG9ydEBmcmFuazRkZC5jb20wHhcNMTIw\nODIyMDcyNjQzWhcNMTcwODIxMDcyNjQzWjBKMQswCQYDVQQGEwJKUDEOMAwGA1UE\nCAwFVG9reW8xETAPBgNVBAoMCEZyYW5rNEREMRgwFgYDVQQDDA93d3cuZXhhbXBs\nZS5jb20wgfAwgagGByqGSM44BAEwgZwCQQDKVt7ZYtFRCzrm2/NTjl45YtMgVctQ\npLadAowFRydY13uhGw+JXyM+qmngfQkXImQpoYdIe+A8DWG2vaO3wKQ3AhUAxx6d\neaDs+XNHcbsiVQ1osvxrG8sCQHQYZDlSy/A5AFXrWXUNlTJbNhWDnitiG/95qYCe\nFGnwYPp/WyhX+/lbDmQujkrbd4wYStudZM0cc4iDAWeOHQ0DQwACQDtK/S6POMQE\n8aI+skBdNQn+Ch76kNDhztC/suOr9FbCSxnZ/CfhSgE1phOJyEkdR2jgErl3uh51\nlo+7to76LLUwDQYJKoZIhvcNAQEFBQADgYEAnrmxZ3HB0LmVoFYdBJWxNBkRaFyn\njBmRsSJp2xvFg2nyAF77AOqBuFOFqOxg04eDxH8TGLQOWjqdyCFCY79AQlmkdB+8\nZ5SWqPEwLJHVLd91O9avQwwRQT5TAxGXFkHTlQxOoaGfTsVQFqSDnlYC4mFjspA7\nW+K8+llxOFmtVzU=\n-----END CERTIFICATE-----" = Stdlib.Result.Result.Ok - "-----BEGIN PUBLIC KEY-----\nMIHwMIGoBgcqhkjOOAQBMIGcAkEAylbe2WLRUQs65tvzU45eOWLTIFXLUKS2nQKM\nBUcnWNd7oRsPiV8jPqpp4H0JFyJkKaGHSHvgPA1htr2jt8CkNwIVAMcenXmg7Plz\nR3G7IlUNaLL8axvLAkB0GGQ5UsvwOQBV61l1DZUyWzYVg54rYhv/eamAnhRp8GD6\nf1soV/v5Ww5kLo5K23eMGErbnWTNHHOIgwFnjh0NA0MAAkA7Sv0ujzjEBPGiPrJA\nXTUJ/goe+pDQ4c7Qv7Ljq/RWwksZ2fwn4UoBNaYTichJHUdo4BK5d7oedZaPu7aO\n+iy1\n-----END PUBLIC KEY-----\n" + Stdlib.X509.pemCertificatePublicKey + "-----BEGIN CERTIFICATE-----\nMIICpzCCAhACAg4AMA0GCSqGSIb3DQEBBQUAMIGbMQswCQYDVQQGEwJKUDEOMAwG\nA1UECBMFVG9reW8xEDAOBgNVBAcTB0NodW8ta3UxETAPBgNVBAoTCEZyYW5rNERE\nMRgwFgYDVQQLEw9XZWJDZXJ0IFN1cHBvcnQxGDAWBgNVBAMTD0ZyYW5rNEREIFdl\nYiBDQTEjMCEGCSqGSIb3DQEJARYUc3VwcG9ydEBmcmFuazRkZC5jb20wHhcNMTIw\nODIyMDcyNjQzWhcNMTcwODIxMDcyNjQzWjBKMQswCQYDVQQGEwJKUDEOMAwGA1UE\nCAwFVG9reW8xETAPBgNVBAoMCEZyYW5rNEREMRgwFgYDVQQDDA93d3cuZXhhbXBs\nZS5jb20wgfAwgagGByqGSM44BAEwgZwCQQDKVt7ZYtFRCzrm2/NTjl45YtMgVctQ\npLadAowFRydY13uhGw+JXyM+qmngfQkXImQpoYdIe+A8DWG2vaO3wKQ3AhUAxx6d\neaDs+XNHcbsiVQ1osvxrG8sCQHQYZDlSy/A5AFXrWXUNlTJbNhWDnitiG/95qYCe\nFGnwYPp/WyhX+/lbDmQujkrbd4wYStudZM0cc4iDAWeOHQ0DQwACQDtK/S6POMQE\n8aI+skBdNQn+Ch76kNDhztC/suOr9FbCSxnZ/CfhSgE1phOJyEkdR2jgErl3uh51\nlo+7to76LLUwDQYJKoZIhvcNAQEFBQADgYEAnrmxZ3HB0LmVoFYdBJWxNBkRaFyn\njBmRsSJp2xvFg2nyAF77AOqBuFOFqOxg04eDxH8TGLQOWjqdyCFCY79AQlmkdB+8\nZ5SWqPEwLJHVLd91O9avQwwRQT5TAxGXFkHTlQxOoaGfTsVQFqSDnlYC4mFjspA7\nW+K8+llxOFmtVzU=\n-----END CERTIFICATE-----" + == Stdlib.Result.Result.Ok("-----BEGIN PUBLIC KEY-----\nMIHwMIGoBgcqhkjOOAQBMIGcAkEAylbe2WLRUQs65tvzU45eOWLTIFXLUKS2nQKM\nBUcnWNd7oRsPiV8jPqpp4H0JFyJkKaGHSHvgPA1htr2jt8CkNwIVAMcenXmg7Plz\nR3G7IlUNaLL8axvLAkB0GGQ5UsvwOQBV61l1DZUyWzYVg54rYhv/eamAnhRp8GD6\nf1soV/v5Ww5kLo5K23eMGErbnWTNHHOIgwFnjh0NA0MAAkA7Sv0ujzjEBPGiPrJA\nXTUJ/goe+pDQ4c7Qv7Ljq/RWwksZ2fwn4UoBNaYTichJHUdo4BK5d7oedZaPu7aO\n+iy1\n-----END PUBLIC KEY-----\n") // DSA 512B Keypair PEM - Stdlib.X509.pemCertificatePublicKey_v0 - "-----BEGIN DSA PARAMETERS-----\nMIGcAkEAylbe2WLRUQs65tvzU45eOWLTIFXLUKS2nQKMBUcnWNd7oRsPiV8jPqpp\n4H0JFyJkKaGHSHvgPA1htr2jt8CkNwIVAMcenXmg7PlzR3G7IlUNaLL8axvLAkB0\nGGQ5UsvwOQBV61l1DZUyWzYVg54rYhv/eamAnhRp8GD6f1soV/v5Ww5kLo5K23eM\nGErbnWTNHHOIgwFnjh0N\n-----END DSA PARAMETERS-----\n-----BEGIN DSA PRIVATE KEY-----\nMIH3AgEAAkEAylbe2WLRUQs65tvzU45eOWLTIFXLUKS2nQKMBUcnWNd7oRsPiV8j\nPqpp4H0JFyJkKaGHSHvgPA1htr2jt8CkNwIVAMcenXmg7PlzR3G7IlUNaLL8axvL\nAkB0GGQ5UsvwOQBV61l1DZUyWzYVg54rYhv/eamAnhRp8GD6f1soV/v5Ww5kLo5K\n23eMGErbnWTNHHOIgwFnjh0NAkA7Sv0ujzjEBPGiPrJAXTUJ/goe+pDQ4c7Qv7Lj\nq/RWwksZ2fwn4UoBNaYTichJHUdo4BK5d7oedZaPu7aO+iy1AhRZb1azIQ2V62dZ\nUHn6qvojCzSfWA==\n-----END DSA PRIVATE KEY-----" = Stdlib.Result.Result.Error - "No certificates" + Stdlib.X509.pemCertificatePublicKey + "-----BEGIN DSA PARAMETERS-----\nMIGcAkEAylbe2WLRUQs65tvzU45eOWLTIFXLUKS2nQKMBUcnWNd7oRsPiV8jPqpp\n4H0JFyJkKaGHSHvgPA1htr2jt8CkNwIVAMcenXmg7PlzR3G7IlUNaLL8axvLAkB0\nGGQ5UsvwOQBV61l1DZUyWzYVg54rYhv/eamAnhRp8GD6f1soV/v5Ww5kLo5K23eM\nGErbnWTNHHOIgwFnjh0N\n-----END DSA PARAMETERS-----\n-----BEGIN DSA PRIVATE KEY-----\nMIH3AgEAAkEAylbe2WLRUQs65tvzU45eOWLTIFXLUKS2nQKMBUcnWNd7oRsPiV8j\nPqpp4H0JFyJkKaGHSHvgPA1htr2jt8CkNwIVAMcenXmg7PlzR3G7IlUNaLL8axvL\nAkB0GGQ5UsvwOQBV61l1DZUyWzYVg54rYhv/eamAnhRp8GD6f1soV/v5Ww5kLo5K\n23eMGErbnWTNHHOIgwFnjh0NAkA7Sv0ujzjEBPGiPrJAXTUJ/goe+pDQ4c7Qv7Lj\nq/RWwksZ2fwn4UoBNaYTichJHUdo4BK5d7oedZaPu7aO+iy1AhRZb1azIQ2V62dZ\nUHn6qvojCzSfWA==\n-----END DSA PRIVATE KEY-----" + == Stdlib.Result.Result.Error("No certificates") // DSA 512B CSR PEM - Stdlib.X509.pemCertificatePublicKey_v0 - "-----BEGIN CERTIFICATE REQUEST-----\nMIIBhDCCAUQCAQAwSjELMAkGA1UEBhMCSlAxDjAMBgNVBAgMBVRva3lvMREwDwYD\nVQQKDAhGcmFuazRERDEYMBYGA1UEAwwPd3d3LmV4YW1wbGUuY29tMIHwMIGoBgcq\nhkjOOAQBMIGcAkEAylbe2WLRUQs65tvzU45eOWLTIFXLUKS2nQKMBUcnWNd7oRsP\niV8jPqpp4H0JFyJkKaGHSHvgPA1htr2jt8CkNwIVAMcenXmg7PlzR3G7IlUNaLL8\naxvLAkB0GGQ5UsvwOQBV61l1DZUyWzYVg54rYhv/eamAnhRp8GD6f1soV/v5Ww5k\nLo5K23eMGErbnWTNHHOIgwFnjh0NA0MAAkA7Sv0ujzjEBPGiPrJAXTUJ/goe+pDQ\n4c7Qv7Ljq/RWwksZ2fwn4UoBNaYTichJHUdo4BK5d7oedZaPu7aO+iy1oAAwCQYH\nKoZIzjgEAwMvADAsAhRez3atcWJFwJLLuKsrblhcrLhQ7AIUEstUTOWpjOZX5V+q\ngGAv5jN7zm8=\n-----END CERTIFICATE REQUEST-----" = Stdlib.Result.Result.Error - "No certificates" + Stdlib.X509.pemCertificatePublicKey + "-----BEGIN CERTIFICATE REQUEST-----\nMIIBhDCCAUQCAQAwSjELMAkGA1UEBhMCSlAxDjAMBgNVBAgMBVRva3lvMREwDwYD\nVQQKDAhGcmFuazRERDEYMBYGA1UEAwwPd3d3LmV4YW1wbGUuY29tMIHwMIGoBgcq\nhkjOOAQBMIGcAkEAylbe2WLRUQs65tvzU45eOWLTIFXLUKS2nQKMBUcnWNd7oRsP\niV8jPqpp4H0JFyJkKaGHSHvgPA1htr2jt8CkNwIVAMcenXmg7PlzR3G7IlUNaLL8\naxvLAkB0GGQ5UsvwOQBV61l1DZUyWzYVg54rYhv/eamAnhRp8GD6f1soV/v5Ww5k\nLo5K23eMGErbnWTNHHOIgwFnjh0NA0MAAkA7Sv0ujzjEBPGiPrJAXTUJ/goe+pDQ\n4c7Qv7Ljq/RWwksZ2fwn4UoBNaYTichJHUdo4BK5d7oedZaPu7aO+iy1oAAwCQYH\nKoZIzjgEAwMvADAsAhRez3atcWJFwJLLuKsrblhcrLhQ7AIUEstUTOWpjOZX5V+q\ngGAv5jN7zm8=\n-----END CERTIFICATE REQUEST-----" + == Stdlib.Result.Result.Error("No certificates") module ECC = // ECC 570B Cert PEM - Stdlib.X509.pemCertificatePublicKey_v0 - "-----BEGIN CERTIFICATE-----\nMIICXjCCAccCAg4GMA0GCSqGSIb3DQEBBQUAMIGbMQswCQYDVQQGEwJKUDEOMAwG\nA1UECBMFVG9reW8xEDAOBgNVBAcTB0NodW8ta3UxETAPBgNVBAoTCEZyYW5rNERE\nMRgwFgYDVQQLEw9XZWJDZXJ0IFN1cHBvcnQxGDAWBgNVBAMTD0ZyYW5rNEREIFdl\nYiBDQTEjMCEGCSqGSIb3DQEJARYUc3VwcG9ydEBmcmFuazRkZC5jb20wHhcNMTIw\nOTI3MTMwMDE0WhcNMTcwOTI2MTMwMDE0WjBKMQswCQYDVQQGEwJKUDEOMAwGA1UE\nCAwFVG9reW8xETAPBgNVBAoMCEZyYW5rNEREMRgwFgYDVQQDDA93d3cuZXhhbXBs\nZS5jb20wgacwEAYHKoZIzj0CAQYFK4EEACcDgZIABAIZ0Rc0Y3jsqPqqptRz3tiS\nAuvTHA9vUigM2gUjM6YkTKofP7RRls4dqt6aM7/1eLbFg4Jdh9DXS4zU1EFeiZQZ\n+drSQYAmAgAtTzpmtmUoy+miwtiSBomu3CSUe6YrVvWb+Oirmvw2x3BCTJW2Xjhy\n5y6tDPVRRyhg0nh5wm/UxZv4jo7AZuJV8ztZKwCEADANBgkqhkiG9w0BAQUFAAOB\ngQBlaOF5O4RyvDQ1qCAuM6oXjmL3kCA3Kp7VfytDYaxbaJVhC8PnE0A8VPX2ypn9\naQR4yq98e2umPsrSL7gPddoga+OvatusG9GnIviWGSzazQBQTTQdESJxrPdDXE0E\nYF5PPxAO+0yKGqkl8PepvymXBrMAeszlHaRFXeRojXVALw==\n-----END CERTIFICATE-----\n" = Stdlib.Result.Result.Ok - "-----BEGIN PUBLIC KEY-----\nMIGnMBAGByqGSM49AgEGBSuBBAAnA4GSAAQCGdEXNGN47Kj6qqbUc97YkgLr0xwP\nb1IoDNoFIzOmJEyqHz+0UZbOHaremjO/9Xi2xYOCXYfQ10uM1NRBXomUGfna0kGA\nJgIALU86ZrZlKMvposLYkgaJrtwklHumK1b1m/joq5r8NsdwQkyVtl44cucurQz1\nUUcoYNJ4ecJv1MWb+I6OwGbiVfM7WSsAhAA=\n-----END PUBLIC KEY-----\n" + Stdlib.X509.pemCertificatePublicKey + "-----BEGIN CERTIFICATE-----\nMIICXjCCAccCAg4GMA0GCSqGSIb3DQEBBQUAMIGbMQswCQYDVQQGEwJKUDEOMAwG\nA1UECBMFVG9reW8xEDAOBgNVBAcTB0NodW8ta3UxETAPBgNVBAoTCEZyYW5rNERE\nMRgwFgYDVQQLEw9XZWJDZXJ0IFN1cHBvcnQxGDAWBgNVBAMTD0ZyYW5rNEREIFdl\nYiBDQTEjMCEGCSqGSIb3DQEJARYUc3VwcG9ydEBmcmFuazRkZC5jb20wHhcNMTIw\nOTI3MTMwMDE0WhcNMTcwOTI2MTMwMDE0WjBKMQswCQYDVQQGEwJKUDEOMAwGA1UE\nCAwFVG9reW8xETAPBgNVBAoMCEZyYW5rNEREMRgwFgYDVQQDDA93d3cuZXhhbXBs\nZS5jb20wgacwEAYHKoZIzj0CAQYFK4EEACcDgZIABAIZ0Rc0Y3jsqPqqptRz3tiS\nAuvTHA9vUigM2gUjM6YkTKofP7RRls4dqt6aM7/1eLbFg4Jdh9DXS4zU1EFeiZQZ\n+drSQYAmAgAtTzpmtmUoy+miwtiSBomu3CSUe6YrVvWb+Oirmvw2x3BCTJW2Xjhy\n5y6tDPVRRyhg0nh5wm/UxZv4jo7AZuJV8ztZKwCEADANBgkqhkiG9w0BAQUFAAOB\ngQBlaOF5O4RyvDQ1qCAuM6oXjmL3kCA3Kp7VfytDYaxbaJVhC8PnE0A8VPX2ypn9\naQR4yq98e2umPsrSL7gPddoga+OvatusG9GnIviWGSzazQBQTTQdESJxrPdDXE0E\nYF5PPxAO+0yKGqkl8PepvymXBrMAeszlHaRFXeRojXVALw==\n-----END CERTIFICATE-----\n" + == Stdlib.Result.Result.Ok("-----BEGIN PUBLIC KEY-----\nMIGnMBAGByqGSM49AgEGBSuBBAAnA4GSAAQCGdEXNGN47Kj6qqbUc97YkgLr0xwP\nb1IoDNoFIzOmJEyqHz+0UZbOHaremjO/9Xi2xYOCXYfQ10uM1NRBXomUGfna0kGA\nJgIALU86ZrZlKMvposLYkgaJrtwklHumK1b1m/joq5r8NsdwQkyVtl44cucurQz1\nUUcoYNJ4ecJv1MWb+I6OwGbiVfM7WSsAhAA=\n-----END PUBLIC KEY-----\n") // ECC 570B Keypair PEM - Stdlib.X509.pemCertificatePublicKey_v0 - "-----BEGIN EC PRIVATE KEY-----\nMIHuAgEBBEgBH3PwaVkfMDZwbwQB0FlKTYFTObjkNxRo++SRg8XOIpNCJk118Z26\npjVLS9UadaisLopUMsZ+f/pQITUhbPl//0rRBfM2KtigBwYFK4EEACehgZUDgZIA\nBAIZ0Rc0Y3jsqPqqptRz3tiSAuvTHA9vUigM2gUjM6YkTKofP7RRls4dqt6aM7/1\neLbFg4Jdh9DXS4zU1EFeiZQZ+drSQYAmAgAtTzpmtmUoy+miwtiSBomu3CSUe6Yr\nVvWb+Oirmvw2x3BCTJW2Xjhy5y6tDPVRRyhg0nh5wm/UxZv4jo7AZuJV8ztZKwCE\nAA==\n-----END EC PRIVATE KEY-----" = Stdlib.Result.Result.Error - "No certificates" + Stdlib.X509.pemCertificatePublicKey + "-----BEGIN EC PRIVATE KEY-----\nMIHuAgEBBEgBH3PwaVkfMDZwbwQB0FlKTYFTObjkNxRo++SRg8XOIpNCJk118Z26\npjVLS9UadaisLopUMsZ+f/pQITUhbPl//0rRBfM2KtigBwYFK4EEACehgZUDgZIA\nBAIZ0Rc0Y3jsqPqqptRz3tiSAuvTHA9vUigM2gUjM6YkTKofP7RRls4dqt6aM7/1\neLbFg4Jdh9DXS4zU1EFeiZQZ+drSQYAmAgAtTzpmtmUoy+miwtiSBomu3CSUe6Yr\nVvWb+Oirmvw2x3BCTJW2Xjhy5y6tDPVRRyhg0nh5wm/UxZv4jo7AZuJV8ztZKwCE\nAA==\n-----END EC PRIVATE KEY-----" + == Stdlib.Result.Result.Error("No certificates") // ECC 570B CSR PEM - Stdlib.X509.pemCertificatePublicKey_v0 - "-----BEGIN CERTIFICATE REQUEST-----\nMIIBpDCB+wIBADBKMQswCQYDVQQGEwJKUDEOMAwGA1UECAwFVG9reW8xETAPBgNV\nBAoMCEZyYW5rNEREMRgwFgYDVQQDDA93d3cuZXhhbXBsZS5jb20wgacwEAYHKoZI\nzj0CAQYFK4EEACcDgZIABAIZ0Rc0Y3jsqPqqptRz3tiSAuvTHA9vUigM2gUjM6Yk\nTKofP7RRls4dqt6aM7/1eLbFg4Jdh9DXS4zU1EFeiZQZ+drSQYAmAgAtTzpmtmUo\ny+miwtiSBomu3CSUe6YrVvWb+Oirmvw2x3BCTJW2Xjhy5y6tDPVRRyhg0nh5wm/U\nxZv4jo7AZuJV8ztZKwCEAKAAMAkGByqGSM49BAEDgZgAMIGUAkgDHvgliw56MDT1\nB0L3VTRKsaqp0xGIUKAPJOOuqn0UxyzuVktk9Rna467bXll0UJwOuUVbEjdL7B13\nvyDpRnafKiUX7oDbsW0CSAP8EY0n79AiJwLYDhghUBAsGMCw4uaLEIOE0sAWqOdT\nWTCAhu/gJh9e+4lAFiKoMpM3XWoplCqKuvvNqenGda6EOMuTk/S4Bw==\n-----END CERTIFICATE REQUEST-----" = Stdlib.Result.Result.Error - "No certificates" + Stdlib.X509.pemCertificatePublicKey + "-----BEGIN CERTIFICATE REQUEST-----\nMIIBpDCB+wIBADBKMQswCQYDVQQGEwJKUDEOMAwGA1UECAwFVG9reW8xETAPBgNV\nBAoMCEZyYW5rNEREMRgwFgYDVQQDDA93d3cuZXhhbXBsZS5jb20wgacwEAYHKoZI\nzj0CAQYFK4EEACcDgZIABAIZ0Rc0Y3jsqPqqptRz3tiSAuvTHA9vUigM2gUjM6Yk\nTKofP7RRls4dqt6aM7/1eLbFg4Jdh9DXS4zU1EFeiZQZ+drSQYAmAgAtTzpmtmUo\ny+miwtiSBomu3CSUe6YrVvWb+Oirmvw2x3BCTJW2Xjhy5y6tDPVRRyhg0nh5wm/U\nxZv4jo7AZuJV8ztZKwCEAKAAMAkGByqGSM49BAEDgZgAMIGUAkgDHvgliw56MDT1\nB0L3VTRKsaqp0xGIUKAPJOOuqn0UxyzuVktk9Rna467bXll0UJwOuUVbEjdL7B13\nvyDpRnafKiUX7oDbsW0CSAP8EY0n79AiJwLYDhghUBAsGMCw4uaLEIOE0sAWqOdT\nWTCAhu/gJh9e+4lAFiKoMpM3XWoplCqKuvvNqenGda6EOMuTk/S4Bw==\n-----END CERTIFICATE REQUEST-----" + == Stdlib.Result.Result.Error("No certificates") module Variations = // RSA 999B Cert PEM - Stdlib.X509.pemCertificatePublicKey_v0 - "-----BEGIN CERTIFICATE-----\nMIICUjCCAbsCAg3+MA0GCSqGSIb3DQEBBQUAMIGbMQswCQYDVQQGEwJKUDEOMAwG\nA1UECBMFVG9reW8xEDAOBgNVBAcTB0NodW8ta3UxETAPBgNVBAoTCEZyYW5rNERE\nMRgwFgYDVQQLEw9XZWJDZXJ0IFN1cHBvcnQxGDAWBgNVBAMTD0ZyYW5rNEREIFdl\nYiBDQTEjMCEGCSqGSIb3DQEJARYUc3VwcG9ydEBmcmFuazRkZC5jb20wHhcNMTMw\nMTExMDQ1MTM5WhcNMTgwMTEwMDQ1MTM5WjBLMQswCQYDVQQGDAJKUDEPMA0GA1UE\nCAwGXFRva3lvMREwDwYDVQQKDAhGcmFuazRERDEYMBYGA1UEAwwPd3d3LmV4YW1w\nbGUuY29tMIGaMA0GCSqGSIb3DQEBAQUAA4GIADCBhAJ9Y8EiHfxxM/nOn2SnI1Xx\nDwOtBDT1JF0Qy9b1YJjuvb7ci10f5MVmTBYj1FSUfM9Moz2CUQYun2DYcWoHpP8e\njHmAPUk5Wyp2Q7P+28unIHBJaTfeCOOzFRPV60GSYe36aRpm8/wUVmzxaK8kB9eZ\nhO7quN7mId1/jVq3J88CAwEAATANBgkqhkiG9w0BAQUFAAOBgQAMfy43xMy8xwA5\nV1vOcR8Kr5cZIwmlXBQO1xQ3k9qHkr4YTcRqMT9Z5JNmkXv1+eRhg0N/V1nMQ4YF\ngYw1nyDJpg97neExW42yue0YGH62WXXQHr9SUDH+FZ0Vt/DflvIUMdcQADf38iOs\n9Plmdov+pM/4+9kXyh8RPI3evz9/MA==\n-----END CERTIFICATE-----" = Stdlib.Result.Result.Ok - "-----BEGIN PUBLIC KEY-----\nMIGaMA0GCSqGSIb3DQEBAQUAA4GIADCBhAJ9Y8EiHfxxM/nOn2SnI1XxDwOtBDT1\nJF0Qy9b1YJjuvb7ci10f5MVmTBYj1FSUfM9Moz2CUQYun2DYcWoHpP8ejHmAPUk5\nWyp2Q7P+28unIHBJaTfeCOOzFRPV60GSYe36aRpm8/wUVmzxaK8kB9eZhO7quN7m\nId1/jVq3J88CAwEAAQ==\n-----END PUBLIC KEY-----\n" + Stdlib.X509.pemCertificatePublicKey + "-----BEGIN CERTIFICATE-----\nMIICUjCCAbsCAg3+MA0GCSqGSIb3DQEBBQUAMIGbMQswCQYDVQQGEwJKUDEOMAwG\nA1UECBMFVG9reW8xEDAOBgNVBAcTB0NodW8ta3UxETAPBgNVBAoTCEZyYW5rNERE\nMRgwFgYDVQQLEw9XZWJDZXJ0IFN1cHBvcnQxGDAWBgNVBAMTD0ZyYW5rNEREIFdl\nYiBDQTEjMCEGCSqGSIb3DQEJARYUc3VwcG9ydEBmcmFuazRkZC5jb20wHhcNMTMw\nMTExMDQ1MTM5WhcNMTgwMTEwMDQ1MTM5WjBLMQswCQYDVQQGDAJKUDEPMA0GA1UE\nCAwGXFRva3lvMREwDwYDVQQKDAhGcmFuazRERDEYMBYGA1UEAwwPd3d3LmV4YW1w\nbGUuY29tMIGaMA0GCSqGSIb3DQEBAQUAA4GIADCBhAJ9Y8EiHfxxM/nOn2SnI1Xx\nDwOtBDT1JF0Qy9b1YJjuvb7ci10f5MVmTBYj1FSUfM9Moz2CUQYun2DYcWoHpP8e\njHmAPUk5Wyp2Q7P+28unIHBJaTfeCOOzFRPV60GSYe36aRpm8/wUVmzxaK8kB9eZ\nhO7quN7mId1/jVq3J88CAwEAATANBgkqhkiG9w0BAQUFAAOBgQAMfy43xMy8xwA5\nV1vOcR8Kr5cZIwmlXBQO1xQ3k9qHkr4YTcRqMT9Z5JNmkXv1+eRhg0N/V1nMQ4YF\ngYw1nyDJpg97neExW42yue0YGH62WXXQHr9SUDH+FZ0Vt/DflvIUMdcQADf38iOs\n9Plmdov+pM/4+9kXyh8RPI3evz9/MA==\n-----END CERTIFICATE-----" + == Stdlib.Result.Result.Ok("-----BEGIN PUBLIC KEY-----\nMIGaMA0GCSqGSIb3DQEBAQUAA4GIADCBhAJ9Y8EiHfxxM/nOn2SnI1XxDwOtBDT1\nJF0Qy9b1YJjuvb7ci10f5MVmTBYj1FSUfM9Moz2CUQYun2DYcWoHpP8ejHmAPUk5\nWyp2Q7P+28unIHBJaTfeCOOzFRPV60GSYe36aRpm8/wUVmzxaK8kB9eZhO7quN7m\nId1/jVq3J88CAwEAAQ==\n-----END PUBLIC KEY-----\n") // RSA start/end time overflow - Stdlib.X509.pemCertificatePublicKey_v0 - "-----BEGIN CERTIFICATE-----\nMIICGjCCAYOgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBmzELMAkGA1UEBhMCSlAx\nDjAMBgNVBAgTBVRva3lvMRAwDgYDVQQHEwdDaHVvLWt1MREwDwYDVQQKEwhGcmFu\nazRERDEYMBYGA1UECxMPV2ViQ2VydCBTdXBwb3J0MRgwFgYDVQQDEw9GcmFuazRE\nRCBXZWIgQ0ExIzAhBgkqhkiG9w0BCQEWFHN1cHBvcnRAZnJhbms0ZGQuY29tMCIY\nDzE5MDExMjEzMjA0NTUyWhgPMjAzODAxMTkwMzE0MDdaMEoxCzAJBgNVBAYTAkpQ\nMQ4wDAYDVQQIDAVUb2t5bzERMA8GA1UECgwIRnJhbms0REQxGDAWBgNVBAMMD3d3\ndy5leGFtcGxlLmNvbTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQCb/GaQeYRCu6sT\n/St7+N4VEuXxk+MGinu4seGeJruVAb/nMO1khQLdFWmoNLAG7D81PB4bK4/6jwAb\n3wfGrFMHAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAnzdeQBG2crXnvZyHgCL9dSnm\nlnaXJITO//+G59uCvDKbnX+BKvXXxXQIa7GmtzYuw3LC/jJJL307r/CECZr6vV9I\nKHn27+yOtrPDOwTDtXyaYOaf8V6fkSVN3iLx7tbEP6R0uEKxaVaqMZ71ed3SO1OL\nwq0j8GkKY/K/zl2Nwzc=\n-----END CERTIFICATE-----\n" = Stdlib.Result.Result.Ok - "-----BEGIN PUBLIC KEY-----\nMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJv8ZpB5hEK7qxP9K3v43hUS5fGT4waK\ne7ix4Z4mu5UBv+cw7WSFAt0Vaag0sAbsPzU8Hhsrj/qPABvfB8asUwcCAwEAAQ==\n-----END PUBLIC KEY-----\n" + Stdlib.X509.pemCertificatePublicKey + "-----BEGIN CERTIFICATE-----\nMIICGjCCAYOgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBmzELMAkGA1UEBhMCSlAx\nDjAMBgNVBAgTBVRva3lvMRAwDgYDVQQHEwdDaHVvLWt1MREwDwYDVQQKEwhGcmFu\nazRERDEYMBYGA1UECxMPV2ViQ2VydCBTdXBwb3J0MRgwFgYDVQQDEw9GcmFuazRE\nRCBXZWIgQ0ExIzAhBgkqhkiG9w0BCQEWFHN1cHBvcnRAZnJhbms0ZGQuY29tMCIY\nDzE5MDExMjEzMjA0NTUyWhgPMjAzODAxMTkwMzE0MDdaMEoxCzAJBgNVBAYTAkpQ\nMQ4wDAYDVQQIDAVUb2t5bzERMA8GA1UECgwIRnJhbms0REQxGDAWBgNVBAMMD3d3\ndy5leGFtcGxlLmNvbTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQCb/GaQeYRCu6sT\n/St7+N4VEuXxk+MGinu4seGeJruVAb/nMO1khQLdFWmoNLAG7D81PB4bK4/6jwAb\n3wfGrFMHAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAnzdeQBG2crXnvZyHgCL9dSnm\nlnaXJITO//+G59uCvDKbnX+BKvXXxXQIa7GmtzYuw3LC/jJJL307r/CECZr6vV9I\nKHn27+yOtrPDOwTDtXyaYOaf8V6fkSVN3iLx7tbEP6R0uEKxaVaqMZ71ed3SO1OL\nwq0j8GkKY/K/zl2Nwzc=\n-----END CERTIFICATE-----\n" + == Stdlib.Result.Result.Ok("-----BEGIN PUBLIC KEY-----\nMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJv8ZpB5hEK7qxP9K3v43hUS5fGT4waK\ne7ix4Z4mu5UBv+cw7WSFAt0Vaag0sAbsPzU8Hhsrj/qPABvfB8asUwcCAwEAAQ==\n-----END PUBLIC KEY-----\n") // RSA Napoleonic time period - Stdlib.X509.pemCertificatePublicKey_v0 - "-----BEGIN CERTIFICATE-----\nMIIDdDCCAt2gAwIBAgIBADANBgkqhkiG9w0BAQUFADCBmzELMAkGA1UEBhMCSlAx\nDjAMBgNVBAgTBVRva3lvMRAwDgYDVQQHEwdDaHVvLWt1MREwDwYDVQQKEwhGcmFu\nazRERDEYMBYGA1UECxMPV2ViQ2VydCBTdXBwb3J0MRgwFgYDVQQDEw9GcmFuazRE\nRCBXZWIgQ0ExIzAhBgkqhkiG9w0BCQEWFHN1cHBvcnRAZnJhbms0ZGQuY29tMCIY\nDzE3NjkwODE1MTU0NjQxWhgPMTgyMTA1MDUxNjUzMjFaMIHbMQswCQYDVQQGEwJG\nUjEXMBUGA1UECBQOw45sZS1kZS1GcmFuY2UxDjAMBgNVBAcTBVBhcmlzMRwwGgYD\nVQQKExNIZXJlZGl0YXJ5IE1vbmFyY2h5MRYwFAYDVQQLEw1IZWFkIG9mIFN0YXRl\nMSkwJwYJKoZIhvcNAQkBFhpuYXBwaUBncmVhdGZyZW5jaGVtcGlyZS5mcjEbMBkG\nA1UEAxMSRW1wZXJvciBOYXBvbGVvbiBJMRIwEAYDVQQEEwlCb25hcGFydGUxETAP\nBgNVBCoTCE5hcG9sZW9uMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA\nvdcwMpsM3EgNmeO/fvcuZsirnBZCh0yJlySGmev792ohOBvfC+v27ZKcXN+H7V+x\nSxEDDAFq9SCEk4MZ8h/ggtw63T6SEYeNGtnfyLv8atienun/6ocDp0+26xvj8Nxm\naKL4MQM9j9aYgt2EOxUTH5kBc7mc621q2RJi0q/y0/SdX2Pp/3MKDirOs81vfc2i\ncEaYAisd5IOF9vpMpLr3b3Qg9T66/4hQS6DgIOkfUurWqe33sA2RRv7ql1gcxL1I\nmBxBtYQGsujn8fCNRK5jtMtICkEi9tks/tYzSaqgby3QGfbA18xl7FLLjnZDLVX3\nZVchhveR78/f7U/xh8C2WQIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFmEiU2vn10f\nXvL+nJdRHJsf0P+f6v8H+vbkomog4gVbagDuFACJfAdKJhnc/gzkCF1fyeowOD68\nk4e0H1vyLuk23BUmjW41nOjdg8LrTAS8fMwkj5FVSKR2mHciHWgY/BU4UypYJtcg\najH1bsqwUI50wfbggW4VzLD842q5LhnW\n-----END CERTIFICATE-----" = Stdlib.Result.Result.Ok - "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvdcwMpsM3EgNmeO/fvcu\nZsirnBZCh0yJlySGmev792ohOBvfC+v27ZKcXN+H7V+xSxEDDAFq9SCEk4MZ8h/g\ngtw63T6SEYeNGtnfyLv8atienun/6ocDp0+26xvj8NxmaKL4MQM9j9aYgt2EOxUT\nH5kBc7mc621q2RJi0q/y0/SdX2Pp/3MKDirOs81vfc2icEaYAisd5IOF9vpMpLr3\nb3Qg9T66/4hQS6DgIOkfUurWqe33sA2RRv7ql1gcxL1ImBxBtYQGsujn8fCNRK5j\ntMtICkEi9tks/tYzSaqgby3QGfbA18xl7FLLjnZDLVX3ZVchhveR78/f7U/xh8C2\nWQIDAQAB\n-----END PUBLIC KEY-----\n" \ No newline at end of file + Stdlib.X509.pemCertificatePublicKey + "-----BEGIN CERTIFICATE-----\nMIIDdDCCAt2gAwIBAgIBADANBgkqhkiG9w0BAQUFADCBmzELMAkGA1UEBhMCSlAx\nDjAMBgNVBAgTBVRva3lvMRAwDgYDVQQHEwdDaHVvLWt1MREwDwYDVQQKEwhGcmFu\nazRERDEYMBYGA1UECxMPV2ViQ2VydCBTdXBwb3J0MRgwFgYDVQQDEw9GcmFuazRE\nRCBXZWIgQ0ExIzAhBgkqhkiG9w0BCQEWFHN1cHBvcnRAZnJhbms0ZGQuY29tMCIY\nDzE3NjkwODE1MTU0NjQxWhgPMTgyMTA1MDUxNjUzMjFaMIHbMQswCQYDVQQGEwJG\nUjEXMBUGA1UECBQOw45sZS1kZS1GcmFuY2UxDjAMBgNVBAcTBVBhcmlzMRwwGgYD\nVQQKExNIZXJlZGl0YXJ5IE1vbmFyY2h5MRYwFAYDVQQLEw1IZWFkIG9mIFN0YXRl\nMSkwJwYJKoZIhvcNAQkBFhpuYXBwaUBncmVhdGZyZW5jaGVtcGlyZS5mcjEbMBkG\nA1UEAxMSRW1wZXJvciBOYXBvbGVvbiBJMRIwEAYDVQQEEwlCb25hcGFydGUxETAP\nBgNVBCoTCE5hcG9sZW9uMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA\nvdcwMpsM3EgNmeO/fvcuZsirnBZCh0yJlySGmev792ohOBvfC+v27ZKcXN+H7V+x\nSxEDDAFq9SCEk4MZ8h/ggtw63T6SEYeNGtnfyLv8atienun/6ocDp0+26xvj8Nxm\naKL4MQM9j9aYgt2EOxUTH5kBc7mc621q2RJi0q/y0/SdX2Pp/3MKDirOs81vfc2i\ncEaYAisd5IOF9vpMpLr3b3Qg9T66/4hQS6DgIOkfUurWqe33sA2RRv7ql1gcxL1I\nmBxBtYQGsujn8fCNRK5jtMtICkEi9tks/tYzSaqgby3QGfbA18xl7FLLjnZDLVX3\nZVchhveR78/f7U/xh8C2WQIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFmEiU2vn10f\nXvL+nJdRHJsf0P+f6v8H+vbkomog4gVbagDuFACJfAdKJhnc/gzkCF1fyeowOD68\nk4e0H1vyLuk23BUmjW41nOjdg8LrTAS8fMwkj5FVSKR2mHciHWgY/BU4UypYJtcg\najH1bsqwUI50wfbggW4VzLD842q5LhnW\n-----END CERTIFICATE-----" + == Stdlib.Result.Result.Ok("-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvdcwMpsM3EgNmeO/fvcu\nZsirnBZCh0yJlySGmev792ohOBvfC+v27ZKcXN+H7V+xSxEDDAFq9SCEk4MZ8h/g\ngtw63T6SEYeNGtnfyLv8atienun/6ocDp0+26xvj8NxmaKL4MQM9j9aYgt2EOxUT\nH5kBc7mc621q2RJi0q/y0/SdX2Pp/3MKDirOs81vfc2icEaYAisd5IOF9vpMpLr3\nb3Qg9T66/4hQS6DgIOkfUurWqe33sA2RRv7ql1gcxL1ImBxBtYQGsujn8fCNRK5j\ntMtICkEi9tks/tYzSaqgby3QGfbA18xl7FLLjnZDLVX3ZVchhveR78/f7U/xh8C2\nWQIDAQAB\n-----END PUBLIC KEY-----\n") \ No newline at end of file diff --git a/backend/testfiles/httphandler/_simple-request-headers.test b/backend/testfiles/httphandler/simple-request-headers.test similarity index 92% rename from backend/testfiles/httphandler/_simple-request-headers.test rename to backend/testfiles/httphandler/simple-request-headers.test index 10c62c4a5c..a00b620034 100644 --- a/backend/testfiles/httphandler/_simple-request-headers.test +++ b/backend/testfiles/httphandler/simple-request-headers.test @@ -1,6 +1,5 @@ [http-handler GET /] -(let _ = "CLEANUP: Bring this test back once we can parse `"(\""`" -let body = +(let body = request.headers |> PACKAGE.Darklang.Stdlib.List.map (fun (k,v) -> "(\"" ++ k ++ "\", \"" ++ v ++ "\")") |> PACKAGE.Darklang.Stdlib.String.join ",\n" diff --git a/backend/tests/TestUtils/TestUtils.fs b/backend/tests/TestUtils/TestUtils.fs index 2913e7b1c7..e22d451538 100644 --- a/backend/tests/TestUtils/TestUtils.fs +++ b/backend/tests/TestUtils/TestUtils.fs @@ -1516,3 +1516,49 @@ module Internal = actual = fields |> D.field "actual" |> PT2DT.Expr.fromDT expected = fields |> D.field "expected" |> PT2DT.Expr.fromDT } | _ -> Exception.raiseInternal "Invalid Test" [] + + module TestModule = + type PTModule = + { name : List + types : List + fns : List + constants : List + dbs : List + tests : List } + + let fromDT (d : Dval) : List = + match d with + | DList(_, d)-> + d + |> List.map (fun d -> + match d with + | DRecord(_, _, _, fields) -> + let types = + match Map.tryFind "types" fields with + | Some(DList(_, types)) -> types |> List.map PT2DT.PackageType.fromDT + | _ -> Exception.raiseInternal "missing types field" [] + + let constants = + match Map.tryFind "constants" fields with + | Some(DList(_, constants)) -> constants |> List.map PT2DT.PackageConstant.fromDT + | _ -> Exception.raiseInternal "missing constants field" [] + + let fns = + match Map.tryFind "fns" fields with + | Some(DList(_, fns)) -> fns |> List.map PT2DT.PackageFn.fromDT + | _ -> Exception.raiseInternal "missing fns field" [] + + let tests = + match Map.tryFind "tests" fields with + | Some(DList(_, tests)) -> tests |> List.map Test.fromDT + | _ -> Exception.raiseInternal "missing tests field" [] + + { name = fields |> D.stringListField "name" + types = types + fns = fns + constants = constants + dbs = [] + tests = tests } + + | _ -> Exception.raiseInternal "Invalid PTModule" []) + | _ -> Exception.raiseInternal "Invalid PTModule" [] diff --git a/backend/tests/Tests/LibExecution.Tests.fs b/backend/tests/Tests/LibExecution.Tests.fs index 3cee57e058..1d526b6a19 100644 --- a/backend/tests/Tests/LibExecution.Tests.fs +++ b/backend/tests/Tests/LibExecution.Tests.fs @@ -219,7 +219,7 @@ let fileTests () : Test = // with the 'extra' things defined in the test modules. let pmPT = LibCloud.PackageManager.pt - let parseTestFile fileName = + let parseTestFileOld fileName = LibParser.TestModule.parseTestFile "Tests" (localBuiltIns pmPT) @@ -227,10 +227,61 @@ let fileTests () : Test = NR.OnMissing.Allow fileName + let parseTestFile fileName = + uply { + let! (state : RT.ExecutionState) = + let canvasID = System.Guid.NewGuid() + executionStateFor pmPT canvasID false false Map.empty + + let name = + RT.FQFnName.FQFnName.Package PackageIDs.Fn.Internal.Test.parseTestFile + + let onMissingType = + RT.FQTypeName.FQTypeName.Package + PackageIDs.Type.LanguageTools.NameResolver.nameResolverOnMissing + + let onMissingAllow = + RT.Dval.DEnum(onMissingType, onMissingType, [], "Allow", []) + + let getPmFnName = + RT.FQFnName.FQFnName.Package PackageIDs.Fn.LanguageTools.PackageManager.pm + + let! execResult = + Exe.executeFunction state getPmFnName [] (NEList.singleton RT.Dval.DUnit) + + let! pm = + uply { + match execResult with + | Ok dval -> return dval + | Error(_callStack, rte) -> + let! rteString = (Exe.rteToString state rte) + return + Exception.raiseInternal + "Error executing pm function" + [ "rte", rteString ] + } + + let args = + NEList.ofList + (RT.DString "Tests") + [ pm; onMissingAllow; RT.DString fileName ] + let! execResult = LibExecution.Execution.executeFunction state name [] args + + match execResult with + | Ok dval -> return Internal.TestModule.fromDT dval + | Error(_, rte) -> + let! rteString = Exe.rteToString state rte + return + Exception.raiseInternal + "Error executing parseTestFile function" + [ "error", rteString ] + } + System.IO.Directory.GetDirectories(baseDir, "*") |> Array.map (fun dir -> System.IO.Directory.GetFiles(dir, "*.dark") |> Array.toList + |> List.filter (String.endsWith "derror.dark") |> List.map (fun file -> let filename = System.IO.Path.GetFileName file let testName = System.IO.Path.GetFileNameWithoutExtension file @@ -241,33 +292,118 @@ let fileTests () : Test = testList $"skipped - {testName}" [] else try - let modules = - $"{dir}/{filename}" |> parseTestFile |> (fun ply -> ply.Result) - - let pm = - PT.PackageManager.withExtras - pmPT - (modules |> List.collect _.types) - (modules |> List.collect _.constants) - (modules |> List.collect _.fns) - + let allowList = + [ "internal.dark" + //stdlib + "bool.dark" + "char.dark" + "string.dark" + "strings.dark" + "strings.dark" + "crypto.dark" + "date.dark" + "dict.dark" + "float.dark" + "http.dark" + "httpclient.dark" + "int8.dark" + "uuid.dark" + "math.dark" + "result.dark" + "list.dark" + "tuple.dark" + "result.dark" + "option.dark" + "nomodule.dark" + "html.dark" + "x509.dark" + "alt-json.dark" + "base64.dark" + "bytes.dark" + "semanticTokenization.dark" + "jsons.dark" + + // "html.dark" + // language + "dfloat.dark" + "dlist.dark" + "dtuple.dark" + "edict.dark" + "eand.dark" + "eif.dark" + "einfix.dark" + "eor.dark" + "elet.dark" + "estring.dark" + "evariable.dark" + "econstant.dark" + "efieldaccess.dark" + "ematch.dark" + "epipe.dark" + "eapply.dark" + "derror.dark" + "elambda.dark" + "ematch.dark" + "eapply.dark" + "big.dark" + "type-alias.dark" + "type-enum.dark" + "type-record.dark" + "parser.dark" ] let tests = - modules - |> List.map (fun m -> - m.tests - |> List.map (fun test -> - t - initializeCanvas - test.name - pm - test.actual - test.expected - filename - test.lineNumber - m.dbs - [])) - |> List.concat + if List.contains filename allowList then + let modules = + $"{dir}/{filename}" |> parseTestFile |> (fun ply -> ply.Result) + let pm = + PT.PackageManager.withExtras + pmPT + (modules |> List.collect _.types) + (modules |> List.collect _.constants) + (modules |> List.collect _.fns) + + modules + |> List.map (fun m -> + m.tests + |> List.map (fun test -> + t + initializeCanvas + test.name + pm + test.actual + test.expected + filename + test.lineNumber + m.dbs + [])) + |> List.concat + + else + let modules = + $"{dir}/{filename}" |> parseTestFileOld |> (fun ply -> ply.Result) + + let pm = + PT.PackageManager.withExtras + pmPT + (modules |> List.collect _.types) + (modules |> List.collect _.constants) + (modules |> List.collect _.fns) + + modules + |> List.map (fun m -> + m.tests + |> List.map (fun test -> + t + initializeCanvas + test.name + pm + test.actual + test.expected + filename + test.lineNumber + m.dbs + [])) + |> List.concat testList testName tests with e -> diff --git a/backend/tests/Tests/NewParser.Tests.fs b/backend/tests/Tests/NewParser.Tests.fs index 81b99b810a..cf3285f9eb 100644 --- a/backend/tests/Tests/NewParser.Tests.fs +++ b/backend/tests/Tests/NewParser.Tests.fs @@ -548,11 +548,11 @@ let exprs = - Expected: (b: Int64) +Expected: (b: Int64) - Actual: a Float: 1.0\"\"\"" +Actual: a Float: 1.0\"\"\"" - "\"int64Multiply's 2nd argument (`b`) should be an Int64. However, a Float (1.0) was passed instead.\\n\\n\\n\\n\\t\\tExpected: (b: Int64)\\n\\n\\t\\tActual: a Float: 1.0\"" + "\"int64Multiply's 2nd argument (`b`) should be an Int64. However, a Float (1.0) was passed instead.\n\n\n\nExpected: (b: Int64)\n\nActual: a Float: 1.0\"" [] [] [] @@ -617,7 +617,7 @@ let exprs = t "dict with double_backtick_identifier" "Dict { ``Content-Length`` = 1L }" - "Dict { ``Content-Length`` = 1L }" + "Dict { Content-Length = 1L }" [] [] [] diff --git a/packages/darklang/languageTools/nameResolver.dark b/packages/darklang/languageTools/nameResolver.dark index 53cbfa0d87..f12d5ef07d 100644 --- a/packages/darklang/languageTools/nameResolver.dark +++ b/packages/darklang/languageTools/nameResolver.dark @@ -171,14 +171,14 @@ module Darklang = |> Stdlib.String.join "." if owner == "Builtin" && modules == [] then - if builtinThingExists nameForLookup then + if builtinThingExists name.name then (ProgramTypes.FQConstantName.Builtin { name = name.name version = name.version }) |> ProgramTypes.FQConstantName.FQConstantName.Builtin |> Stdlib.Result.Result.Ok else - Error() + Stdlib.Result.Result.Error() else let find = pm.findConstant diff --git a/packages/darklang/languageTools/parser/core.dark b/packages/darklang/languageTools/parser/core.dark index 4b54e92239..e6214f5416 100644 --- a/packages/darklang/languageTools/parser/core.dark +++ b/packages/darklang/languageTools/parser/core.dark @@ -45,6 +45,9 @@ module Darklang = let getText (node: ParsedNode) : String = node.text let getRange (node: ParsedNode) : Range = node.range + let emptyVar = "___" + let nameOrBlank (v : String) : String = if v == emptyVar then "" else v + let findNodeByFieldName (node: ParsedNode) (fieldName: String) @@ -228,7 +231,12 @@ module Darklang = | [ dictPairNode; _separator ] -> let keyNode = findAndParseRequired dictPairNode "key" (fun node -> - (node.range, Parser.getText node) |> Stdlib.Result.Result.Ok) + match node.typ with + | "double_backtick_identifier" -> + let key = node.text |> Stdlib.String.slice 2L -2L + (node.range, key) |> Stdlib.Result.Result.Ok + | _ -> + (node.range, nameOrBlank(Parser.getText node)) |> Stdlib.Result.Result.Ok) let symbolEqualsNode = findField dictPairNode "symbol_equals" @@ -242,7 +250,12 @@ module Darklang = | [ dictPairNode ] -> let keyNode = findAndParseRequired dictPairNode "key" (fun node -> - (node.range, Parser.getText node) |> Stdlib.Result.Result.Ok) + match node.typ with + | "double_backtick_identifier" -> + let key = node.text |> Stdlib.String.slice 2L -2L + (node.range, key) |> Stdlib.Result.Result.Ok + | _ -> + (node.range, nameOrBlank(Parser.getText node)) |> Stdlib.Result.Result.Ok) let symbolEqualsNode = findField dictPairNode "symbol_equals" diff --git a/packages/darklang/languageTools/parser/expr.dark b/packages/darklang/languageTools/parser/expr.dark index e7477c71fa..225c6e9166 100644 --- a/packages/darklang/languageTools/parser/expr.dark +++ b/packages/darklang/languageTools/parser/expr.dark @@ -490,7 +490,7 @@ module Darklang = (WrittenTypes.Expr.EFieldAccess( node.range, expr, - (field.range, field.text), + (field.range, nameOrBlank (field.text)), symbolDot.range )) |> Stdlib.Result.Result.Ok @@ -597,8 +597,15 @@ module Darklang = )) |> Stdlib.Result.Result.Ok) - | _ -> createUnparseableError child + | _ -> createUnparseableError node + // Helper function for parseLambda + let skipEmptyVar (node: List) : List = + node + |> Stdlib.List.filter (fun c -> + match c.typ with + | "let_pattern" when c.text == "___" -> false + | _ -> true) let parseLambda (node: ParsedNode) @@ -609,6 +616,7 @@ module Darklang = match findField node "pats" with | Ok paramsNode -> paramsNode.children + |> skipEmptyVar |> Stdlib.List.map (fun pat -> parseLetPattern pat) |> Stdlib.Result.collect diff --git a/packages/darklang/languageTools/parser/matchPattern.dark b/packages/darklang/languageTools/parser/matchPattern.dark index e81998c38c..b111c68f2e 100644 --- a/packages/darklang/languageTools/parser/matchPattern.dark +++ b/packages/darklang/languageTools/parser/matchPattern.dark @@ -256,7 +256,12 @@ module Darklang = (findNodeByFieldName node "enum_fields") |> Stdlib.Option.map (fun enumFieldsNode -> enumFieldsNode.children - |> Stdlib.List.map (fun pat -> parseMatchPattern pat) + |> Stdlib.List.chunkBySize 2L + |> Builtin.unwrap + |> Stdlib.List.map (fun contentSymbolPair -> + match contentSymbolPair with + | [ contentNode; symbol ] -> parseMatchPattern contentNode + | [ contentNode ] -> parseMatchPattern contentNode) |> Stdlib.Result.collect) |> Stdlib.Option.withDefault ([] |> Stdlib.Result.Result.Ok) diff --git a/packages/darklang/languageTools/parser/pipeExpr.dark b/packages/darklang/languageTools/parser/pipeExpr.dark index a67b56dbeb..8913db1cad 100644 --- a/packages/darklang/languageTools/parser/pipeExpr.dark +++ b/packages/darklang/languageTools/parser/pipeExpr.dark @@ -105,33 +105,18 @@ module Darklang = let parsePipeEnum (node: ParsedNode) : Stdlib.Result.Result = - let typeNameNode = findField node "type_name" - let symbolDotNode = findField node "symbol_dot" - let caseNameNode = findField node "case_name" - - let enumFieldsNode = - (findNodeByFieldName node "enum_fields") - |> Stdlib.Option.map (fun enumFieldsNode -> - enumFieldsNode.children - |> Stdlib.List.map (fun fieldNode -> Expr.parse fieldNode) - |> Stdlib.Result.collect) - - |> Stdlib.Option.withDefault (Stdlib.Result.Result.Ok []) - - match typeNameNode, symbolDotNode, caseNameNode, enumFieldsNode with - | Ok typeNameNode, Ok symbolDotNode, Ok caseNameNode, Ok enumFieldsNode -> - let typeName = typeNameNode.text |> Stdlib.String.split "." - - (WrittenTypes.PipeExpr.EPipeEnum( - node.range, - (typeNameNode.range, typeName), - (caseNameNode.range, caseNameNode.text), - enumFieldsNode, - symbolDotNode.range - )) - |> Stdlib.Result.Result.Ok - - | _ -> createUnparseableError node + baseParseEnum + Expr.parse + node + (fun (range, typeName, caseName, enumFields, symbolDot) -> + (WrittenTypes.PipeExpr.EPipeEnum( + range, + typeName, + caseName, + enumFields, + symbolDot + )) + |> Stdlib.Result.Result.Ok) let parsePipeFnCall diff --git a/packages/darklang/languageTools/runtimeErrors/execution.dark b/packages/darklang/languageTools/runtimeErrors/execution.dark index 2dd53a6749..6c3bdf332f 100644 --- a/packages/darklang/languageTools/runtimeErrors/execution.dark +++ b/packages/darklang/languageTools/runtimeErrors/execution.dark @@ -47,7 +47,7 @@ module Darklang = | MatchExprUnmatched dv -> let summary = [ ErrorSegment.ErrorSegment.String "No match for " - ErrorSegment.ErrorSegment.InlineValue dv ] + ErrorSegment.ErrorSegment.FullValue dv ] // TODO include patterns in error message let extraExplanation = [] diff --git a/packages/darklang/languageTools/writtenTypes.dark b/packages/darklang/languageTools/writtenTypes.dark index 56ec1fdeda..3f903e26f9 100644 --- a/packages/darklang/languageTools/writtenTypes.dark +++ b/packages/darklang/languageTools/writtenTypes.dark @@ -28,6 +28,7 @@ module Darklang = type QualifiedConstantOrFnIdentifier = { range: Range + /// the range corresponds to the `.` after the module name modules: List constantOrFn: ConstantOrFnIdentifier } diff --git a/packages/darklang/languageTools/writtenTypesToProgramTypes.dark b/packages/darklang/languageTools/writtenTypesToProgramTypes.dark index e06050f17c..88921d82eb 100644 --- a/packages/darklang/languageTools/writtenTypesToProgramTypes.dark +++ b/packages/darklang/languageTools/writtenTypesToProgramTypes.dark @@ -62,12 +62,14 @@ module Darklang = (owner: String) (currentModule: List) (c: WrittenTypes.QualifiedConstantOrFnIdentifier) - : ConstOrFn = + : Stdlib.Result.Result> = let nameToResolve = Stdlib.List.append (Stdlib.List.map c.modules (fun (id, _) -> id.name)) [ c.constantOrFn |> ConstOrFn.toPT ] + // Builtin.debug "nameToResolve" nameToResolve + let isConstant = NameResolver.ConstantName.resolve onMissing @@ -76,6 +78,8 @@ module Darklang = currentModule (WrittenTypes.Name.Unresolved(c.range, nameToResolve)) + // Builtin.debug "isConstant" isConstant + let isFn = NameResolver.FnName.resolve onMissing @@ -85,10 +89,10 @@ module Darklang = (WrittenTypes.Name.Unresolved(c.range, nameToResolve)) match isFn with - | Ok _ -> isFn |> ConstOrFn.Fn + | Ok _ -> isFn |> ConstOrFn.Fn |> Stdlib.Result.Result.Ok | Error _ -> match isConstant with - | Ok _ -> isConstant |> ConstOrFn.Const + | Ok _ -> isConstant |> ConstOrFn.Const |> Stdlib.Result.Result.Ok | Error _ -> isConstant module Fn = @@ -500,9 +504,14 @@ module Darklang = let constantOrFn = Identifiers.QualifiedConstOrFn.toPT onMissing pm owner currentModule id + // match constantOrFn with + // | Const c -> ProgramTypes.Expr.EConstant(gid (), c) + // | Fn f -> ProgramTypes.Expr.EFnName(gid (), f) + match constantOrFn with - | Const c -> ProgramTypes.Expr.EConstant(gid (), c) - | Fn f -> ProgramTypes.Expr.EFnName(gid (), f) + | Ok (Const c) -> ProgramTypes.Expr.EConstant(gid (), c) + | Ok (Fn f) -> ProgramTypes.Expr.EFnName(gid (), f) + | Error _ -> ProgramTypes.Expr.EVariable(gid ()) "TODO" | EFieldAccess(_, expr, (_, fieldName), _) -> ProgramTypes.Expr.EFieldAccess( diff --git a/packages/internal/tests.dark b/packages/internal/tests.dark index 7f9b1f9191..715dbc111a 100644 --- a/packages/internal/tests.dark +++ b/packages/internal/tests.dark @@ -66,4 +66,306 @@ module Darklang = { name = "test" lineNumber = lineNumber actual = actual - expected = expected } \ No newline at end of file + expected = expected } + + type WTModule = + { name: List + types: List + constants: + List + fns: List + // dbs: List // TODO + tests: List } + + type PTModule = + { name: List + types: List + fns: List + constants: List + // dbs : List // TODO + tests: List } + + + let toPT + (owner: String) + (onMissing: LanguageTools.NameResolver.OnMissing) + (pm: LanguageTools.ProgramTypes.PackageManager.PackageManager) + (m: WTModule) + : PTModule = + let types = + m.types + |> Stdlib.List.map (fun t -> + LanguageTools.WrittenTypesToProgramTypes.TypeDeclaration.toPackageTypePT + onMissing + pm + owner + m.name + t) + + let constants = + m.constants + |> Stdlib.List.map (fun c -> + LanguageTools.WrittenTypesToProgramTypes.ConstantDeclaration.toPackageConstPT + onMissing + pm + owner + m.name + c) + + let fns = + m.fns + |> Stdlib.List.map (fun f -> + LanguageTools.WrittenTypesToProgramTypes.FunctionDeclaration.toPackageFnPT + onMissing + pm + owner + m.name + f) + + let tests = + m.tests + |> Stdlib.List.map (fun t -> + let currentModule = Stdlib.List.append m.name [ t.name ] + + PTTest + { name = t.name + lineNumber = t.lineNumber + actual = + LanguageTools.WrittenTypesToProgramTypes.Expr.toPT + onMissing + pm + owner + currentModule + t.actual + expected = + LanguageTools.WrittenTypesToProgramTypes.Expr.toPT + onMissing + pm + owner + currentModule + t.expected }) + + PTModule + { name = m.name + types = types + constants = constants + fns = fns + tests = tests } + + + let parseModule + (currentModule: List) + (m: LanguageTools.WrittenTypes.ModuleDeclaration.ModuleDeclaration) + : List = + let types = + m.declarations + |> Stdlib.List.filterMap (fun d -> + match d with + | Type t -> Stdlib.Option.Option.Some t + | _ -> Stdlib.Option.Option.None) + + let constants = + m.declarations + |> Stdlib.List.filterMap (fun d -> + match d with + | Constant c -> Stdlib.Option.Option.Some c + | _ -> Stdlib.Option.Option.None) + + let fns = + m.declarations + |> Stdlib.List.filterMap (fun d -> + match d with + | Function f -> Stdlib.Option.Option.Some f + | _ -> Stdlib.Option.Option.None) + + let tests = + m.declarations + |> Stdlib.List.filterMap (fun decl -> + match decl with + | Expr e -> + match e with + | EInfix(r, _, actual, expected) -> + let (_, name) = m.name + + Stdlib.Option.Option.Some( + WTTest + { name = name + lineNumber = r.start.row + actual = actual + expected = expected } + ) + | _ -> Stdlib.Option.Option.None + | _ -> Stdlib.Option.Option.None) + + let submodules = + m.declarations + |> Stdlib.List.filterMap (fun decl -> + match decl with + | SubModule m -> + let (_, name) = m.name + let names = Stdlib.List.append currentModule [ name ] + Stdlib.Option.Option.Some(parseModule names m) + | _ -> Stdlib.Option.Option.None) + |> Stdlib.List.flatten + + Stdlib.List.append + [ WTModule + { name = currentModule + types = types + constants = constants + fns = fns + tests = tests } ] + submodules + + + + let parseFile + (parsedFile: LanguageTools.WrittenTypes.ParsedFile) + (owner: String) + : List = + match parsedFile with + | SourceFile source -> + let modules = + source.declarations + |> Stdlib.List.filterMap (fun d -> + match d with + | Module m -> Stdlib.Option.Option.Some m + | _ -> Stdlib.Option.Option.None) + + let parsedModule = + modules + |> Stdlib.List.map (fun m -> + let (_, name) = m.name + parseModule [ name ] m) + |> Stdlib.List.flatten + + let rootTypes = + source.declarations + |> Stdlib.List.filterMap (fun d -> + match d with + | Type t -> Stdlib.Option.Option.Some t + | _ -> Stdlib.Option.Option.None) + + let rootConstants = + source.declarations + |> Stdlib.List.filterMap (fun d -> + match d with + | Constant c -> Stdlib.Option.Option.Some c + | _ -> Stdlib.Option.Option.None) + + let rootFns = + source.declarations + |> Stdlib.List.filterMap (fun d -> + match d with + | Function f -> Stdlib.Option.Option.Some f + | _ -> Stdlib.Option.Option.None) + + let rootTests = + source.exprsToEval + |> Stdlib.List.filterMap (fun e -> + match e with + | EInfix(r, _, actual, expected) -> + (WTTest + { name = "test" + lineNumber = r.start.row + actual = actual + expected = expected }) + |> Stdlib.Option.Option.Some + | _ -> Stdlib.Option.Option.None) + + + let rootModule = + [ WTModule + { name = [] + types = rootTypes + constants = rootConstants + fns = rootFns + tests = rootTests } ] + + Stdlib.List.flatten [ rootModule; parsedModule ] + + let parseTestFile + (owner: String) + (pm: LanguageTools.ProgramTypes.PackageManager.PackageManager) + (onMissing: LanguageTools.NameResolver.OnMissing) + (filename: String) + : List = + let modulesWT = + match Builtin.fileRead filename with + | Ok content -> + content + |> Stdlib.String.fromBytesWithReplacement + |> LanguageTools.Parser.ParserTest.initialParse + |> parseFile owner + | Error _ -> Stdlib.Result.Result.Error $"error reading file {filename}" + + let afterFirstPass = + modulesWT |> Stdlib.List.map (fun m -> toPT owner onMissing pm m) + + let afterFirstPassFns = + (afterFirstPass |> Stdlib.List.map (fun m -> m.fns) |> Stdlib.List.flatten) + + let afterFirstPassConstants = + (afterFirstPass + |> Stdlib.List.map (fun m -> m.constants) + |> Stdlib.List.flatten) + + let afterFirstPassTypes = + (afterFirstPass + |> Stdlib.List.map (fun m -> m.types) + |> Stdlib.List.flatten) + + let afterFirstPassTests = + (afterFirstPass + |> Stdlib.List.map (fun m -> m.tests) + |> Stdlib.List.flatten) + + let pm = + LanguageTools.ProgramTypes.PackageManager.withExtras + pm + afterFirstPassTypes + afterFirstPassConstants + afterFirstPassFns + + let afterSecondPass = + modulesWT |> Stdlib.List.map (fun m -> toPT owner onMissing pm m) + + let adjusted = + afterSecondPass + |> Stdlib.List.map (fun m -> + PTModule + { name = m.name + types = + m.types + |> Stdlib.List.map (fun t -> + { t with + id = + afterFirstPassTypes + |> Stdlib.List.findFirst (fun original -> + original.name == t.name) + |> Stdlib.Option.mapWithDefault t.id (fun original -> + original.id) }) + + constants = + m.constants + |> Stdlib.List.map (fun c -> + { c with + id = + afterFirstPassConstants + |> Stdlib.List.findFirst (fun original -> + original.name == c.name) + |> Stdlib.Option.mapWithDefault c.id (fun original -> + original.id) }) + fns = + m.fns + |> Stdlib.List.map (fun f -> + { f with + id = + afterFirstPassFns + |> Stdlib.List.findFirst (fun original -> + original.name == f.name) + |> Stdlib.Option.mapWithDefault f.id (fun original -> + original.id) }) + tests = m.tests }) + + adjusted \ No newline at end of file diff --git a/tree-sitter-darklang/test/corpus/exhaustive/exprs/char.txt b/tree-sitter-darklang/test/corpus/exhaustive/exprs/char.txt index 8916bd7b58..a81907f7e4 100644 --- a/tree-sitter-darklang/test/corpus/exhaustive/exprs/char.txt +++ b/tree-sitter-darklang/test/corpus/exhaustive/exprs/char.txt @@ -21,4 +21,144 @@ escape sequence (source_file (expression - (simple_expression (char_literal (symbol) (character (char_or_string_escape_sequence)) (symbol))))) \ No newline at end of file + (simple_expression (char_literal (symbol) (character (char_or_string_escape_sequence)) (symbol))))) + + +================== +test +================== +// Stdlib.List.push [] (fun x -> -4.611686018e+18) +// == [ (fun x -> -4.611686018e+18) ] + +// Test that empty parameters are removed +(let y = (fun x ___ -> x + 1L) + Stdlib.List.map [ 1L; 2L; 3L; 4L ] y) +== [ 2L; 3L; 4L; 5L ] + +(let y = (fun x -> x + 1L) + Stdlib.List.map [ 1L; 2L; 3L; 4L ] y) +== [ 2L; 3L; 4L; 5L ] + +(let y = (fun msg -> Builtin.testRuntimeError msg) + Stdlib.List.map [ "1"; "2"; "3"; "4" ] y) +== Builtin.testDerrorMessage "1" + +(let y = (fun msg -> Builtin.testRuntimeError msg) + Stdlib.List.map [] y) +== [] +// (let y = (fun a b -> a + b) in y 2 3) = 5 // TODO: allow +(let y = (fun a b -> a * b) + Stdlib.List.fold [ 1L; 2L; 3L; 4L ] 1L y) +== 24L + +(Stdlib.List.fold [ 4L ] 1L (Builtin.testRuntimeError "test")) +== Builtin.testDerrorMessage "test" + +(let x = 5L + let y = (fun c -> x + c) + let x = 6L + [ 1L; 2L; 3L; 4L ] |> Stdlib.List.map y) +== [ 6L; 7L; 8L; 9L ] + +(Stdlib.String.join + (Stdlib.List.map + (Stdlib.String.toList "some string") + (fun var -> Stdlib.String.toUppercase (Stdlib.String.fromChar var)) + ) + "" +) +== "SOME STRING" + +(let y = (fun c -> if c > 2L then Builtin.testRuntimeError "err" else 18L) + [ 1L; 2L; 3L; 4L ] |> Stdlib.List.map y) +== Builtin.testDerrorMessage "err" + +(let y = (fun c -> if c > 2L then Builtin.testRuntimeError "err" else 18L) + [ 1L; 2L ] |> Stdlib.List.map y) +== [ 18L; 18L ] + +(let t = true + Stdlib.List.all [ 1L; 2L ] (fun _ -> t)) +== true + +(let f = false + Stdlib.List.all [ 1L; 2L ] (fun _ -> f)) +== false + +(let x = 1L + let f = (fun _ -> x) + let x = 2L + Stdlib.List.map [ 1L; 2L; 3L ] f) +== [ 1L; 1L; 1L ] + + +(let pairs = [ (1L, "one"); (2L, "two"); (3L, "three") ] + + let transformer = fun (num, str) -> $"{Stdlib.Int64.toString num}:{str}" + + Stdlib.List.map pairs transformer) +== [ "1:one"; "2:two"; "3:three" ] + +(let triplets = [ (1L, "one", true); (2L, "two", false) ] + + let transformer = + fun (num, str, flag) -> + if flag then + $"{Stdlib.Int64.toString num}:{str}:TRUE" + else + $"{Stdlib.Int64.toString num}:{str}:FALSE" + + Stdlib.List.map triplets transformer) +== [ "1:one:TRUE"; "2:two:FALSE" ] + +// nested +(let sing = [ (("1"), "2"); (("3"), "4") ] + // CLEANUP: reintroduce parens around str1 in the lambda_pats + let transformer = (fun (str1, str2) -> str1 ++ str2) + Stdlib.List.map sing transformer) +== [ "12"; "34" ] + + +// TODO: +// There is weird parser behavior for nested tuples with more than one member. +// We will need to check the case with a new parser like the Treesitter. +// +(let triplets = [ ((1L, "one"), true); ((2L, "two"), false) ] + + let transformer = + fun ((num, str), flag) -> + if flag then + $"{Stdlib.Int64.toString num}:{str}:TRUE" + else + $"{Stdlib.Int64.toString num}:{str}:FALSE" + + Stdlib.List.map triplets transformer) +== [ "1:one:TRUE"; "2:two:FALSE" ] + +(let triplets = [ (1L, "one", true); (2L, "two", false) ] + + let transformer = fun (num, str) -> $"{Stdlib.Int64.toString num}:{str}" + + Stdlib.List.map triplets transformer) +== Builtin.testDerrorMessage "Tuple pattern has wrong number of elements" + +(Stdlib.Dict.map + (Dict + { key1 = ("val11", "val12") + key2 = ("val21", "val22") }) + (fun x (y, z) -> x ++ y ++ z) +) +== (Dict + { key2 = "key2val21val22" + key1 = "key1val11val12" }) + +Stdlib.Dict.map + (Dict + { key1 = ("val11", "val12") + key2 = ("val21", "val22") }) + (fun x (_, z) -> x ++ z) +== (Dict + { key2 = "key2val22" + key1 = "key1val12" }) + +---