tricu

An interpreted language for exploring Tree Calculus
Log | Files | Refs | README | LICENSE

sourceGateExpected.tri (5210B)


      1 !import "prelude" !Local
      2 
      3 -- Independent golden Result Tree Diagnostic values for the restricted gate.
      4 -- These use the documented pair/number/string encodings, but do not import
      5 -- the source compiler, parser, lexer, AST, or diagnostic constructors.
      6 goldenSuccess value = pair (t t) (pair value t)
      7 goldenFailure diagnostic rest = pair t (pair diagnostic rest)
      8 goldenPosition line column offset = pair line (pair column offset)
      9 goldenNode kind payload start end = pair kind (pair payload (pair start end))
     10 goldenDiagnostic code expected found location contexts = pair code (pair expected (pair found (pair location contexts)))
     11 
     12 goldenLeaf = goldenSuccess t
     13 goldenStem = goldenSuccess (t t)
     14 goldenFork = goldenSuccess (t t t)
     15 goldenFortyTwo = goldenSuccess 42
     16 goldenTwo = goldenSuccess 2
     17 goldenHi = goldenSuccess "hi"
     18 -- Fork cells are specified directly, without calling the source compiler.
     19 goldenListTwo = goldenSuccess (t t (t 2 t))
     20 goldenNestedList = goldenSuccess (t (t t t) (t (t t) t))
     21 goldenUnknown = goldenFailure (goldenDiagnostic 20 "u" t (goldenPosition 1 1 0) t) (goldenNode 2 "u" (goldenPosition 1 1 0) (goldenPosition 1 2 1))
     22 goldenUnsupported = goldenFailure (goldenDiagnostic 4 t 35 (goldenPosition 1 1 0) t) "#"
     23 goldenBadEscape = goldenFailure (goldenDiagnostic 6 34 113 (goldenPosition 1 3 2) t) "\\q\""
     24 goldenUnfinishedString = goldenFailure (goldenDiagnostic 5 34 t (goldenPosition 1 1 0) t) t
     25 goldenUnfinishedBlock = goldenFailure (goldenDiagnostic 5 "-|" t (goldenPosition 1 1 0) t) t
     26 goldenUnknownInList = goldenFailure (goldenDiagnostic 20 "u" t (goldenPosition 1 2 1) t) (goldenNode 2 "u" (goldenPosition 1 2 1) (goldenPosition 1 3 2))
     27 goldenMissingListClose = goldenFailure (goldenDiagnostic 2 10 t t t) t
     28 goldenComma = (goldenFailure (goldenDiagnostic 2 10 20 (goldenPosition 1 3 2) t)
     29   [(goldenNode 20 t (goldenPosition 1 3 2) (goldenPosition 1 4 3))
     30    (goldenNode 1 "t" (goldenPosition 1 5 4) (goldenPosition 1 6 5))
     31    (goldenNode 10 t (goldenPosition 1 6 5) (goldenPosition 1 7 6))])
     32 
     33 -- Independent expected outcomes of program compilation and ordering.
     34 goldenProgramList = goldenSuccess (t 2 t)
     35 goldenFileComments = goldenSuccess (t (t t) t)
     36 -- Backend-specific: test/size.tri inspects the generated `size` function tree.
     37 -- The Haskell bootstrap frontend returns 321; the portable star_ski_eta
     38 -- backend returns 301 on this exact fixture. This is a backend-specific
     39 -- backend-specific function-tree measurement.
     40 goldenGateSize = goldenSuccess 301
     41 goldenMissingRoot = goldenFailure (goldenDiagnostic 32 "main" t t t) t
     42 goldenProgramCycle = goldenFailure (goldenDiagnostic 31 "acyclic" "a" (goldenPosition 1 1 0) ["a"]) t
     43 goldenProgramDuplicate = goldenFailure (goldenDiagnostic 30 "f" "f" (goldenPosition 2 1 6) t) (pair (pair 2 (pair "f" (pair (goldenPosition 2 1 6) (goldenPosition 2 2 7)))) (goldenNode 1 t (goldenPosition 2 5 10) (goldenPosition 2 6 11)))
     44 goldenProgramUnknown = goldenFailure (goldenDiagnostic 20 "u" t (goldenPosition 1 8 7) t) (goldenNode 2 "u" (goldenPosition 1 8 7) (goldenPosition 1 9 8))
     45 goldenProgramCycleWrongPosition = goldenFailure (goldenDiagnostic 31 "acyclic" "a" (goldenPosition 1 2 0) ["a"]) t
     46 goldenLocalMissing = goldenFailure (goldenDiagnostic 20 "x" t (goldenPosition 1 16 15) t) (goldenNode 2 "x" (goldenPosition 1 16 15) (goldenPosition 1 17 16))
     47 goldenLetMissingIn = goldenFailure (goldenDiagnostic 2 13 t t t) t
     48 goldenOutputForward = goldenSuccess (pair t [(pair "value" t) (pair "main" t)])
     49 goldenOutputExpression = goldenSuccess (pair 2 t)
     50 goldenOutputHost = goldenSuccess (pair (t t) t)
     51 goldenOutputFork = goldenSuccess (pair (t t t) [(pair "main" (t t t))])
     52 goldenOutputComments = goldenSuccess (pair (t (t t) t) [(pair "main" (t (t t) t))])
     53 goldenOutputString = goldenSuccess (pair "String test!" t)
     54 goldenOutputMap = goldenSuccess (pair (t t) [(pair "x" ["Successfully concatenated two strings!"]) (pair "main" (t t))])
     55 goldenImportUnsupported = goldenFailure (goldenDiagnostic 4 t 33 (goldenPosition 1 1 0) t) "!import \"x\" NS"
     56 goldenMultilineGroup = goldenSuccess (t t)
     57 goldenMultilineList = goldenSuccess (t (t t) t)
     58 goldenMissingDefinitionBody = goldenFailure (goldenDiagnostic 40 "definition body" t t t) t
     59 goldenMissingLocalValue = goldenFailure (goldenDiagnostic 40 "local binding value" t t t) t
     60 goldenMissingLocalBody = goldenFailure (goldenDiagnostic 40 "local binding body" t t t) t
     61 goldenPipeApplication = goldenSuccess (t (t t))
     62 goldenPipeUnknown = goldenFailure (goldenDiagnostic 20 "missing" t (goldenPosition 1 13 12) t) (goldenNode 2 "missing" (goldenPosition 1 13 12) (goldenPosition 1 20 19))
     63 goldenPipeMissingOperand = goldenFailure (goldenDiagnostic 2 7 t t t) t
     64 goldenOne = goldenSuccess 1
     65 goldenDoMissingFinal = goldenFailure (goldenDiagnostic 40 "do final expression" t (goldenPosition 2 3 17) t) t
     66 goldenDoUnboundAction = goldenFailure (goldenDiagnostic 20 "missing" t (goldenPosition 2 8 22) t) (goldenNode 2 "missing" (goldenPosition 2 8 22) (goldenPosition 2 15 29))
     67 
     68 -- Negative control: the wrong position must not compare equal.
     69 goldenUnknownWrongPosition = goldenFailure (goldenDiagnostic 20 "u" t (goldenPosition 1 2 0) t) (goldenNode 2 "u" (goldenPosition 1 1 0) (goldenPosition 1 2 1))