...
Run Format

Text file src/simd/archsimd/_gen/unify/testdata/unify.yaml

Documentation: simd/archsimd/_gen/unify/testdata

     1# Basic tests of unification
     2
     3#
     4# Terminals
     5#
     6
     7unify:
     8- _
     9- _
    10want:
    11  _
    12---
    13unify:
    14- _
    15- test
    16want:
    17  test
    18---
    19unify:
    20- test
    21- t?est
    22want:
    23  test
    24---
    25unify:
    26- 1
    27- 1
    28want:
    29  1
    30---
    31unify:
    32- test
    33- foo
    34want:
    35  _|_
    36
    37#
    38# Tuple
    39#
    40
    41---
    42unify:
    43- [a, b]
    44- [a, b]
    45want:
    46  [a, b]
    47---
    48unify:
    49- [a, _]
    50- [_, b]
    51want:
    52  [a, b]
    53---
    54unify:
    55- ["ab?c", "de?f"]
    56- [ac, def]
    57want:
    58  [ac, def]
    59
    60#
    61# Repeats
    62#
    63
    64---
    65unify:
    66- !repeat [a]
    67- [_]
    68want:
    69  [a]
    70---
    71unify:
    72- !repeat [a]
    73- [_, _]
    74want:
    75  [a, a]
    76---
    77unify:
    78- !repeat [a]
    79- [b]
    80want:
    81  _|_
    82---
    83unify:
    84- !repeat [xy*]
    85- [x, xy, xyy]
    86want:
    87  [x, xy, xyy]
    88---
    89unify:
    90- !repeat [xy*]
    91- !repeat ["xz?y*"]
    92- [x, xy, xyy]
    93want:
    94  [x, xy, xyy]
    95---
    96unify:
    97- !repeat [!sum [a, b]]
    98- [a, b, a]
    99all:
   100- [a, b, a]
   101---
   102unify:
   103- !repeat [!sum [a, b]]
   104- !repeat [!sum [b, c]]
   105- [b, b, b]
   106all:
   107- [b, b, b]
   108---
   109unify:
   110- !repeat [!sum [a, b]]
   111- !repeat [!sum [b, c]]
   112- [a]
   113all: []
   114
   115#
   116# Def
   117#
   118
   119---
   120unify:
   121- {a: a, b: b}
   122- {a: a, b: b}
   123want:
   124  {a: a, b: b}
   125---
   126unify:
   127- {a: a}
   128- {b: b}
   129want:
   130  {a: a, b: b}
   131
   132#
   133# Sum
   134#
   135
   136---
   137unify:
   138- !sum [1, 2]
   139- !sum [2, 3]
   140all:
   141- 2
   142---
   143unify:
   144- !sum [{label: a, value: abc}, {label: b, value: def}]
   145- !sum [{value: "ab?c", extra: d}, {value: "def?", extra: g}]
   146all:
   147- {extra: d, label: a, value: abc}
   148- {extra: g, label: b, value: def}
   149---
   150# A sum of repeats must deal with different dynamically-created variables in
   151# each branch.
   152unify:
   153- !sum [!repeat [a], !repeat [b]]
   154- [a, a, a]
   155all:
   156- [a, a, a]
   157---
   158unify:
   159- !sum [!repeat [a], !repeat [b]]
   160- [a, a, b]
   161all: []
   162---
   163# Exercise sumEnvs with more than one result
   164unify:
   165- !sum
   166  - [a|b, c|d]
   167  - [e, g]
   168- [!sum [a, b, e, f], !sum [c, d, g, h]]
   169all:
   170- [a, c]
   171- [a, d]
   172- [b, c]
   173- [b, d]
   174- [e, g]

View as plain text