# A pretty general pattern matching test program

**URL:** <https://community.wolfram.com/t/a-pretty-general-pattern-matching-test-program/19864>\
**Category:** Ideas\
**Created:** [April 9, 2022, 6:35pm UTC](https://community.wolfram.com/t/a-pretty-general-pattern-matching-test-program/19864 "2022-04-09T18:35:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wernergg](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/wernergg/32/6481_2.png) [@wernergg](https://community.wolfram.com/u/wernergg)\
**Post date:** [April 9, 2022, 6:35pm UTC](https://community.wolfram.com/t/a-pretty-general-pattern-matching-test-program/19864/1 "2022-04-09T18:35:21Z")

</div>

This is a pretty general pattern matching test program. Within a Do-Loop It accepts a list do of lists; one list per pattern:

```
do = { {pattern, args, expMatches, description, trace, supp}, ...}.

```

This will define a function

```
f[xs:pattern] := doSomething[xs]

```

which will be called with different arguments xs given in args.

_ **… See the attached Notebook “220406 Pattern Test.nb”…** _

As an example for an entry

```
{{_?(# \[Element] Reals && #[[1]] < #[[2]] &) ...}, {
    {{11, 12}, {\[Pi], 3}}, {{11, 12.}, {\[Pi], 3.2}}, {{11, 
    12.}, {\[Pi], \[Pi] + I}}
  }, 1, "List of Pairs of Reals with x < y, with PatternTest"}

```

in the Do - list it will produce this output:

 ![8941b.png](https://global.discourse-cdn.com/wolfram/original/2X/4/4a33ff22f399866fe7d0dd234a1c33f5b113e351.png)

[220406 Pattern Test.nb](https://community.wolfram.com/uploads/short-url/aFAlBEqtqW2rQbsuHkwgN1zfpTh.nb) (420 KB)
