From 0f69926a232fb1ec6a5dc018e9ef0b18a8baab84 Mon Sep 17 00:00:00 2001 From: Carsten Klee Date: Thu, 16 Nov 2017 13:34:54 +0100 Subject: [PATCH] dropped indicators in favour of indicatorSpec --- invalid/invalidIndicators.json | 14 +- .../wildCombination_invalidCharIndicator.json | 473 ++---------------- .../wildCombination_invalidIndicators.json | 12 +- valid/validIndicators.json | 45 +- .../wildCombination_validIndexIndicator.json | 473 ++---------------- valid/wildCombination_validIndicators.json | 43 +- wild_combination.php | 2 +- 7 files changed, 111 insertions(+), 951 deletions(-) diff --git a/invalid/invalidIndicators.json b/invalid/invalidIndicators.json index 24cb6fd..ecb7118 100644 --- a/invalid/invalidIndicators.json +++ b/invalid/invalidIndicators.json @@ -2,22 +2,22 @@ "description": "indicators are strings and match pattern", "schema": { "type": "string", - "pattern": "(^[_a-z0-9][_a-z0-9]{0,1}$)" + "pattern": "(^[12]$)" }, "tests": [ { - "description": "only three characters allowed", - "data": "12_", + "description": "only one character allowed", + "data": "12", "valid": false }, { - "description": "not allowed character at indicator one", - "data": "$", + "description": "not allowed character", + "data": "3", "valid": false }, { - "description": "not allowed character at indicator two", - "data": "1|", + "description": "empty", + "data": "", "valid": false } ] diff --git a/invalid/wildCombination_invalidCharIndicator.json b/invalid/wildCombination_invalidCharIndicator.json index 87b590b..2c3e546 100644 --- a/invalid/wildCombination_invalidCharIndicator.json +++ b/invalid/wildCombination_invalidCharIndicator.json @@ -5,498 +5,113 @@ }, "tests": [ { - "description": "invalid wild combination: last position && first indicator is null second is omitted\/wildcard", - "data": "...\/#_0", + "description": "invalid wild combination: last position && indicator 1", + "data": "...\/#^1", "valid": false }, { - "description": "invalid wild combination: last position && first indicator is null second is blank\/wildcard", - "data": "...\/#_0_", + "description": "invalid wild combination: last position && indicator 2", + "data": "...\/#^2", "valid": false }, { - "description": "invalid wild combination: last position && first indicator is null second is one", - "data": "...\/#_01", + "description": "invalid wild combination: first position && indicator 1", + "data": "...\/0^1", "valid": false }, { - "description": "invalid wild combination: last position && first indicator is one second is 'z'", - "data": "...\/#_1z", + "description": "invalid wild combination: first position && indicator 2", + "data": "...\/0^2", "valid": false }, { - "description": "invalid wild combination: last position && first indicator is blank\/wildcard second is one", - "data": "...\/#__1", + "description": "invalid wild combination: position ten && indicator 1", + "data": "...\/9^1", "valid": false }, { - "description": "invalid wild combination: last position && first indicator is 'a' second is omitted\/wildcard\/wildcard", - "data": "...\/#_a", + "description": "invalid wild combination: position ten && indicator 2", + "data": "...\/9^2", "valid": false }, { - "description": "invalid wild combination: last position && first indicator is blank\/wildcard second is 'b'", - "data": "...\/#__b", + "description": "invalid wild combination: position eleven && indicator 1", + "data": "...\/10^1", "valid": false }, { - "description": "invalid wild combination: last position && first indicator is 'a' second is blank\/wildcard", - "data": "...\/#_a_", + "description": "invalid wild combination: position eleven && indicator 2", + "data": "...\/10^2", "valid": false }, { - "description": "invalid wild combination: last position && both blank\/wildcard", - "data": "...\/#___", + "description": "invalid wild combination: position 101 && indicator 1", + "data": "...\/100^1", "valid": false }, { - "description": "invalid wild combination: first position && first indicator is null second is omitted\/wildcard", - "data": "...\/0_0", + "description": "invalid wild combination: position 101 && indicator 2", + "data": "...\/100^2", "valid": false }, { - "description": "invalid wild combination: first position && first indicator is null second is blank\/wildcard", - "data": "...\/0_0_", + "description": "invalid wild combination: range from first position to second && indicator 1", + "data": "...\/0-1^1", "valid": false }, { - "description": "invalid wild combination: first position && first indicator is null second is one", - "data": "...\/0_01", + "description": "invalid wild combination: range from first position to second && indicator 2", + "data": "...\/0-1^2", "valid": false }, { - "description": "invalid wild combination: first position && first indicator is one second is 'z'", - "data": "...\/0_1z", + "description": "invalid wild combination: range from first position to last && indicator 1", + "data": "...\/0-#^1", "valid": false }, { - "description": "invalid wild combination: first position && first indicator is blank\/wildcard second is one", - "data": "...\/0__1", + "description": "invalid wild combination: range from first position to last && indicator 2", + "data": "...\/0-#^2", "valid": false }, { - "description": "invalid wild combination: first position && first indicator is 'a' second is omitted\/wildcard\/wildcard", - "data": "...\/0_a", + "description": "invalid wild combination: range from first position to first position, is like first position && indicator 1", + "data": "...\/0-0^1", "valid": false }, { - "description": "invalid wild combination: first position && first indicator is blank\/wildcard second is 'b'", - "data": "...\/0__b", + "description": "invalid wild combination: range from first position to first position, is like first position && indicator 2", + "data": "...\/0-0^2", "valid": false }, { - "description": "invalid wild combination: first position && first indicator is 'a' second is blank\/wildcard", - "data": "...\/0_a_", + "description": "invalid wild combination: range from last position to last position, is like last position && indicator 1", + "data": "...\/#-#^1", "valid": false }, { - "description": "invalid wild combination: first position && both blank\/wildcard", - "data": "...\/0___", + "description": "invalid wild combination: range from last position to last position, is like last position && indicator 2", + "data": "...\/#-#^2", "valid": false }, { - "description": "invalid wild combination: position ten && first indicator is null second is omitted\/wildcard", - "data": "...\/9_0", + "description": "invalid wild combination: range from last position to position one (index reverted), is like last position && indicator 1", + "data": "...\/#-0^1", "valid": false }, { - "description": "invalid wild combination: position ten && first indicator is null second is blank\/wildcard", - "data": "...\/9_0_", + "description": "invalid wild combination: range from last position to position one (index reverted), is like last position && indicator 2", + "data": "...\/#-0^2", "valid": false }, { - "description": "invalid wild combination: position ten && first indicator is null second is one", - "data": "...\/9_01", + "description": "invalid wild combination: range from last position to position two (index reverted) && indicator 1", + "data": "...\/#-1^1", "valid": false }, { - "description": "invalid wild combination: position ten && first indicator is one second is 'z'", - "data": "...\/9_1z", - "valid": false - }, - { - "description": "invalid wild combination: position ten && first indicator is blank\/wildcard second is one", - "data": "...\/9__1", - "valid": false - }, - { - "description": "invalid wild combination: position ten && first indicator is 'a' second is omitted\/wildcard\/wildcard", - "data": "...\/9_a", - "valid": false - }, - { - "description": "invalid wild combination: position ten && first indicator is blank\/wildcard second is 'b'", - "data": "...\/9__b", - "valid": false - }, - { - "description": "invalid wild combination: position ten && first indicator is 'a' second is blank\/wildcard", - "data": "...\/9_a_", - "valid": false - }, - { - "description": "invalid wild combination: position ten && both blank\/wildcard", - "data": "...\/9___", - "valid": false - }, - { - "description": "invalid wild combination: position eleven && first indicator is null second is omitted\/wildcard", - "data": "...\/10_0", - "valid": false - }, - { - "description": "invalid wild combination: position eleven && first indicator is null second is blank\/wildcard", - "data": "...\/10_0_", - "valid": false - }, - { - "description": "invalid wild combination: position eleven && first indicator is null second is one", - "data": "...\/10_01", - "valid": false - }, - { - "description": "invalid wild combination: position eleven && first indicator is one second is 'z'", - "data": "...\/10_1z", - "valid": false - }, - { - "description": "invalid wild combination: position eleven && first indicator is blank\/wildcard second is one", - "data": "...\/10__1", - "valid": false - }, - { - "description": "invalid wild combination: position eleven && first indicator is 'a' second is omitted\/wildcard\/wildcard", - "data": "...\/10_a", - "valid": false - }, - { - "description": "invalid wild combination: position eleven && first indicator is blank\/wildcard second is 'b'", - "data": "...\/10__b", - "valid": false - }, - { - "description": "invalid wild combination: position eleven && first indicator is 'a' second is blank\/wildcard", - "data": "...\/10_a_", - "valid": false - }, - { - "description": "invalid wild combination: position eleven && both blank\/wildcard", - "data": "...\/10___", - "valid": false - }, - { - "description": "invalid wild combination: position 101 && first indicator is null second is omitted\/wildcard", - "data": "...\/100_0", - "valid": false - }, - { - "description": "invalid wild combination: position 101 && first indicator is null second is blank\/wildcard", - "data": "...\/100_0_", - "valid": false - }, - { - "description": "invalid wild combination: position 101 && first indicator is null second is one", - "data": "...\/100_01", - "valid": false - }, - { - "description": "invalid wild combination: position 101 && first indicator is one second is 'z'", - "data": "...\/100_1z", - "valid": false - }, - { - "description": "invalid wild combination: position 101 && first indicator is blank\/wildcard second is one", - "data": "...\/100__1", - "valid": false - }, - { - "description": "invalid wild combination: position 101 && first indicator is 'a' second is omitted\/wildcard\/wildcard", - "data": "...\/100_a", - "valid": false - }, - { - "description": "invalid wild combination: position 101 && first indicator is blank\/wildcard second is 'b'", - "data": "...\/100__b", - "valid": false - }, - { - "description": "invalid wild combination: position 101 && first indicator is 'a' second is blank\/wildcard", - "data": "...\/100_a_", - "valid": false - }, - { - "description": "invalid wild combination: position 101 && both blank\/wildcard", - "data": "...\/100___", - "valid": false - }, - { - "description": "invalid wild combination: range from first position to second && first indicator is null second is omitted\/wildcard", - "data": "...\/0-1_0", - "valid": false - }, - { - "description": "invalid wild combination: range from first position to second && first indicator is null second is blank\/wildcard", - "data": "...\/0-1_0_", - "valid": false - }, - { - "description": "invalid wild combination: range from first position to second && first indicator is null second is one", - "data": "...\/0-1_01", - "valid": false - }, - { - "description": "invalid wild combination: range from first position to second && first indicator is one second is 'z'", - "data": "...\/0-1_1z", - "valid": false - }, - { - "description": "invalid wild combination: range from first position to second && first indicator is blank\/wildcard second is one", - "data": "...\/0-1__1", - "valid": false - }, - { - "description": "invalid wild combination: range from first position to second && first indicator is 'a' second is omitted\/wildcard\/wildcard", - "data": "...\/0-1_a", - "valid": false - }, - { - "description": "invalid wild combination: range from first position to second && first indicator is blank\/wildcard second is 'b'", - "data": "...\/0-1__b", - "valid": false - }, - { - "description": "invalid wild combination: range from first position to second && first indicator is 'a' second is blank\/wildcard", - "data": "...\/0-1_a_", - "valid": false - }, - { - "description": "invalid wild combination: range from first position to second && both blank\/wildcard", - "data": "...\/0-1___", - "valid": false - }, - { - "description": "invalid wild combination: range from first position to last && first indicator is null second is omitted\/wildcard", - "data": "...\/0-#_0", - "valid": false - }, - { - "description": "invalid wild combination: range from first position to last && first indicator is null second is blank\/wildcard", - "data": "...\/0-#_0_", - "valid": false - }, - { - "description": "invalid wild combination: range from first position to last && first indicator is null second is one", - "data": "...\/0-#_01", - "valid": false - }, - { - "description": "invalid wild combination: range from first position to last && first indicator is one second is 'z'", - "data": "...\/0-#_1z", - "valid": false - }, - { - "description": "invalid wild combination: range from first position to last && first indicator is blank\/wildcard second is one", - "data": "...\/0-#__1", - "valid": false - }, - { - "description": "invalid wild combination: range from first position to last && first indicator is 'a' second is omitted\/wildcard\/wildcard", - "data": "...\/0-#_a", - "valid": false - }, - { - "description": "invalid wild combination: range from first position to last && first indicator is blank\/wildcard second is 'b'", - "data": "...\/0-#__b", - "valid": false - }, - { - "description": "invalid wild combination: range from first position to last && first indicator is 'a' second is blank\/wildcard", - "data": "...\/0-#_a_", - "valid": false - }, - { - "description": "invalid wild combination: range from first position to last && both blank\/wildcard", - "data": "...\/0-#___", - "valid": false - }, - { - "description": "invalid wild combination: range from first position to first position, is like first position && first indicator is null second is omitted\/wildcard", - "data": "...\/0-0_0", - "valid": false - }, - { - "description": "invalid wild combination: range from first position to first position, is like first position && first indicator is null second is blank\/wildcard", - "data": "...\/0-0_0_", - "valid": false - }, - { - "description": "invalid wild combination: range from first position to first position, is like first position && first indicator is null second is one", - "data": "...\/0-0_01", - "valid": false - }, - { - "description": "invalid wild combination: range from first position to first position, is like first position && first indicator is one second is 'z'", - "data": "...\/0-0_1z", - "valid": false - }, - { - "description": "invalid wild combination: range from first position to first position, is like first position && first indicator is blank\/wildcard second is one", - "data": "...\/0-0__1", - "valid": false - }, - { - "description": "invalid wild combination: range from first position to first position, is like first position && first indicator is 'a' second is omitted\/wildcard\/wildcard", - "data": "...\/0-0_a", - "valid": false - }, - { - "description": "invalid wild combination: range from first position to first position, is like first position && first indicator is blank\/wildcard second is 'b'", - "data": "...\/0-0__b", - "valid": false - }, - { - "description": "invalid wild combination: range from first position to first position, is like first position && first indicator is 'a' second is blank\/wildcard", - "data": "...\/0-0_a_", - "valid": false - }, - { - "description": "invalid wild combination: range from first position to first position, is like first position && both blank\/wildcard", - "data": "...\/0-0___", - "valid": false - }, - { - "description": "invalid wild combination: range from last position to last position, is like last position && first indicator is null second is omitted\/wildcard", - "data": "...\/#-#_0", - "valid": false - }, - { - "description": "invalid wild combination: range from last position to last position, is like last position && first indicator is null second is blank\/wildcard", - "data": "...\/#-#_0_", - "valid": false - }, - { - "description": "invalid wild combination: range from last position to last position, is like last position && first indicator is null second is one", - "data": "...\/#-#_01", - "valid": false - }, - { - "description": "invalid wild combination: range from last position to last position, is like last position && first indicator is one second is 'z'", - "data": "...\/#-#_1z", - "valid": false - }, - { - "description": "invalid wild combination: range from last position to last position, is like last position && first indicator is blank\/wildcard second is one", - "data": "...\/#-#__1", - "valid": false - }, - { - "description": "invalid wild combination: range from last position to last position, is like last position && first indicator is 'a' second is omitted\/wildcard\/wildcard", - "data": "...\/#-#_a", - "valid": false - }, - { - "description": "invalid wild combination: range from last position to last position, is like last position && first indicator is blank\/wildcard second is 'b'", - "data": "...\/#-#__b", - "valid": false - }, - { - "description": "invalid wild combination: range from last position to last position, is like last position && first indicator is 'a' second is blank\/wildcard", - "data": "...\/#-#_a_", - "valid": false - }, - { - "description": "invalid wild combination: range from last position to last position, is like last position && both blank\/wildcard", - "data": "...\/#-#___", - "valid": false - }, - { - "description": "invalid wild combination: range from last position to position one (index reverted), is like last position && first indicator is null second is omitted\/wildcard", - "data": "...\/#-0_0", - "valid": false - }, - { - "description": "invalid wild combination: range from last position to position one (index reverted), is like last position && first indicator is null second is blank\/wildcard", - "data": "...\/#-0_0_", - "valid": false - }, - { - "description": "invalid wild combination: range from last position to position one (index reverted), is like last position && first indicator is null second is one", - "data": "...\/#-0_01", - "valid": false - }, - { - "description": "invalid wild combination: range from last position to position one (index reverted), is like last position && first indicator is one second is 'z'", - "data": "...\/#-0_1z", - "valid": false - }, - { - "description": "invalid wild combination: range from last position to position one (index reverted), is like last position && first indicator is blank\/wildcard second is one", - "data": "...\/#-0__1", - "valid": false - }, - { - "description": "invalid wild combination: range from last position to position one (index reverted), is like last position && first indicator is 'a' second is omitted\/wildcard\/wildcard", - "data": "...\/#-0_a", - "valid": false - }, - { - "description": "invalid wild combination: range from last position to position one (index reverted), is like last position && first indicator is blank\/wildcard second is 'b'", - "data": "...\/#-0__b", - "valid": false - }, - { - "description": "invalid wild combination: range from last position to position one (index reverted), is like last position && first indicator is 'a' second is blank\/wildcard", - "data": "...\/#-0_a_", - "valid": false - }, - { - "description": "invalid wild combination: range from last position to position one (index reverted), is like last position && both blank\/wildcard", - "data": "...\/#-0___", - "valid": false - }, - { - "description": "invalid wild combination: range from last position to position two (index reverted) && first indicator is null second is omitted\/wildcard", - "data": "...\/#-1_0", - "valid": false - }, - { - "description": "invalid wild combination: range from last position to position two (index reverted) && first indicator is null second is blank\/wildcard", - "data": "...\/#-1_0_", - "valid": false - }, - { - "description": "invalid wild combination: range from last position to position two (index reverted) && first indicator is null second is one", - "data": "...\/#-1_01", - "valid": false - }, - { - "description": "invalid wild combination: range from last position to position two (index reverted) && first indicator is one second is 'z'", - "data": "...\/#-1_1z", - "valid": false - }, - { - "description": "invalid wild combination: range from last position to position two (index reverted) && first indicator is blank\/wildcard second is one", - "data": "...\/#-1__1", - "valid": false - }, - { - "description": "invalid wild combination: range from last position to position two (index reverted) && first indicator is 'a' second is omitted\/wildcard\/wildcard", - "data": "...\/#-1_a", - "valid": false - }, - { - "description": "invalid wild combination: range from last position to position two (index reverted) && first indicator is blank\/wildcard second is 'b'", - "data": "...\/#-1__b", - "valid": false - }, - { - "description": "invalid wild combination: range from last position to position two (index reverted) && first indicator is 'a' second is blank\/wildcard", - "data": "...\/#-1_a_", - "valid": false - }, - { - "description": "invalid wild combination: range from last position to position two (index reverted) && both blank\/wildcard", - "data": "...\/#-1___", + "description": "invalid wild combination: range from last position to position two (index reverted) && indicator 2", + "data": "...\/#-1^2", "valid": false } ] diff --git a/invalid/wildCombination_invalidIndicators.json b/invalid/wildCombination_invalidIndicators.json index a243d8b..9bc17b5 100644 --- a/invalid/wildCombination_invalidIndicators.json +++ b/invalid/wildCombination_invalidIndicators.json @@ -5,18 +5,18 @@ }, "tests": [ { - "description": "invalid wild combination: only three characters allowed", - "data": "..._12_", + "description": "invalid wild combination: only one character allowed", + "data": "...^12", "valid": false }, { - "description": "invalid wild combination: not allowed character at indicator one", - "data": "..._$", + "description": "invalid wild combination: not allowed character", + "data": "...^3", "valid": false }, { - "description": "invalid wild combination: not allowed character at indicator two", - "data": "..._1|", + "description": "invalid wild combination: empty", + "data": "...^", "valid": false } ] diff --git a/valid/validIndicators.json b/valid/validIndicators.json index cd04937..58f0706 100644 --- a/valid/validIndicators.json +++ b/valid/validIndicators.json @@ -2,52 +2,17 @@ "description": "indicators are strings and match pattern", "schema": { "type": "string", - "pattern": "(^[_a-z0-9][_a-z0-9]{0,1}$)" + "pattern": "(^[12]$)" }, "tests": [ { - "description": "first indicator is null second is omitted/wildcard", - "data": "0", + "description": "indicator 1", + "data": "1", "valid": true }, { - "description": "first indicator is null second is blank/wildcard", - "data": "0_", - "valid": true - }, - { - "description": "first indicator is null second is one", - "data": "01", - "valid": true - }, - { - "description": "first indicator is one second is 'z'", - "data": "1z", - "valid": true - }, - { - "description": "first indicator is blank/wildcard second is one", - "data": "_1", - "valid": true - }, - { - "description": "first indicator is 'a' second is omitted/wildcard/wildcard", - "data": "a", - "valid": true - }, - { - "description": "first indicator is blank/wildcard second is 'b'", - "data": "_b", - "valid": true - }, - { - "description": "first indicator is 'a' second is blank/wildcard", - "data": "a_", - "valid": true - }, - { - "description": "both blank/wildcard", - "data": "__", + "description": "indicator 2", + "data": "2", "valid": true } ] diff --git a/valid/wildCombination_validIndexIndicator.json b/valid/wildCombination_validIndexIndicator.json index a54d359..30f2dce 100644 --- a/valid/wildCombination_validIndexIndicator.json +++ b/valid/wildCombination_validIndexIndicator.json @@ -5,498 +5,113 @@ }, "tests": [ { - "description": "valid wild combination: last position && first indicator is null second is omitted\/wildcard", - "data": "...[#]_0", + "description": "valid wild combination: last position && indicator 1", + "data": "...[#]^1", "valid": true }, { - "description": "valid wild combination: last position && first indicator is null second is blank\/wildcard", - "data": "...[#]_0_", + "description": "valid wild combination: last position && indicator 2", + "data": "...[#]^2", "valid": true }, { - "description": "valid wild combination: last position && first indicator is null second is one", - "data": "...[#]_01", + "description": "valid wild combination: first position && indicator 1", + "data": "...[0]^1", "valid": true }, { - "description": "valid wild combination: last position && first indicator is one second is 'z'", - "data": "...[#]_1z", + "description": "valid wild combination: first position && indicator 2", + "data": "...[0]^2", "valid": true }, { - "description": "valid wild combination: last position && first indicator is blank\/wildcard second is one", - "data": "...[#]__1", + "description": "valid wild combination: position ten && indicator 1", + "data": "...[9]^1", "valid": true }, { - "description": "valid wild combination: last position && first indicator is 'a' second is omitted\/wildcard\/wildcard", - "data": "...[#]_a", + "description": "valid wild combination: position ten && indicator 2", + "data": "...[9]^2", "valid": true }, { - "description": "valid wild combination: last position && first indicator is blank\/wildcard second is 'b'", - "data": "...[#]__b", + "description": "valid wild combination: position eleven && indicator 1", + "data": "...[10]^1", "valid": true }, { - "description": "valid wild combination: last position && first indicator is 'a' second is blank\/wildcard", - "data": "...[#]_a_", + "description": "valid wild combination: position eleven && indicator 2", + "data": "...[10]^2", "valid": true }, { - "description": "valid wild combination: last position && both blank\/wildcard", - "data": "...[#]___", + "description": "valid wild combination: position 101 && indicator 1", + "data": "...[100]^1", "valid": true }, { - "description": "valid wild combination: first position && first indicator is null second is omitted\/wildcard", - "data": "...[0]_0", + "description": "valid wild combination: position 101 && indicator 2", + "data": "...[100]^2", "valid": true }, { - "description": "valid wild combination: first position && first indicator is null second is blank\/wildcard", - "data": "...[0]_0_", + "description": "valid wild combination: range from first position to second && indicator 1", + "data": "...[0-1]^1", "valid": true }, { - "description": "valid wild combination: first position && first indicator is null second is one", - "data": "...[0]_01", + "description": "valid wild combination: range from first position to second && indicator 2", + "data": "...[0-1]^2", "valid": true }, { - "description": "valid wild combination: first position && first indicator is one second is 'z'", - "data": "...[0]_1z", + "description": "valid wild combination: range from first position to last && indicator 1", + "data": "...[0-#]^1", "valid": true }, { - "description": "valid wild combination: first position && first indicator is blank\/wildcard second is one", - "data": "...[0]__1", + "description": "valid wild combination: range from first position to last && indicator 2", + "data": "...[0-#]^2", "valid": true }, { - "description": "valid wild combination: first position && first indicator is 'a' second is omitted\/wildcard\/wildcard", - "data": "...[0]_a", + "description": "valid wild combination: range from first position to first position, is like first position && indicator 1", + "data": "...[0-0]^1", "valid": true }, { - "description": "valid wild combination: first position && first indicator is blank\/wildcard second is 'b'", - "data": "...[0]__b", + "description": "valid wild combination: range from first position to first position, is like first position && indicator 2", + "data": "...[0-0]^2", "valid": true }, { - "description": "valid wild combination: first position && first indicator is 'a' second is blank\/wildcard", - "data": "...[0]_a_", + "description": "valid wild combination: range from last position to last position, is like last position && indicator 1", + "data": "...[#-#]^1", "valid": true }, { - "description": "valid wild combination: first position && both blank\/wildcard", - "data": "...[0]___", + "description": "valid wild combination: range from last position to last position, is like last position && indicator 2", + "data": "...[#-#]^2", "valid": true }, { - "description": "valid wild combination: position ten && first indicator is null second is omitted\/wildcard", - "data": "...[9]_0", + "description": "valid wild combination: range from last position to position one (index reverted), is like last position && indicator 1", + "data": "...[#-0]^1", "valid": true }, { - "description": "valid wild combination: position ten && first indicator is null second is blank\/wildcard", - "data": "...[9]_0_", + "description": "valid wild combination: range from last position to position one (index reverted), is like last position && indicator 2", + "data": "...[#-0]^2", "valid": true }, { - "description": "valid wild combination: position ten && first indicator is null second is one", - "data": "...[9]_01", + "description": "valid wild combination: range from last position to position two (index reverted) && indicator 1", + "data": "...[#-1]^1", "valid": true }, { - "description": "valid wild combination: position ten && first indicator is one second is 'z'", - "data": "...[9]_1z", - "valid": true - }, - { - "description": "valid wild combination: position ten && first indicator is blank\/wildcard second is one", - "data": "...[9]__1", - "valid": true - }, - { - "description": "valid wild combination: position ten && first indicator is 'a' second is omitted\/wildcard\/wildcard", - "data": "...[9]_a", - "valid": true - }, - { - "description": "valid wild combination: position ten && first indicator is blank\/wildcard second is 'b'", - "data": "...[9]__b", - "valid": true - }, - { - "description": "valid wild combination: position ten && first indicator is 'a' second is blank\/wildcard", - "data": "...[9]_a_", - "valid": true - }, - { - "description": "valid wild combination: position ten && both blank\/wildcard", - "data": "...[9]___", - "valid": true - }, - { - "description": "valid wild combination: position eleven && first indicator is null second is omitted\/wildcard", - "data": "...[10]_0", - "valid": true - }, - { - "description": "valid wild combination: position eleven && first indicator is null second is blank\/wildcard", - "data": "...[10]_0_", - "valid": true - }, - { - "description": "valid wild combination: position eleven && first indicator is null second is one", - "data": "...[10]_01", - "valid": true - }, - { - "description": "valid wild combination: position eleven && first indicator is one second is 'z'", - "data": "...[10]_1z", - "valid": true - }, - { - "description": "valid wild combination: position eleven && first indicator is blank\/wildcard second is one", - "data": "...[10]__1", - "valid": true - }, - { - "description": "valid wild combination: position eleven && first indicator is 'a' second is omitted\/wildcard\/wildcard", - "data": "...[10]_a", - "valid": true - }, - { - "description": "valid wild combination: position eleven && first indicator is blank\/wildcard second is 'b'", - "data": "...[10]__b", - "valid": true - }, - { - "description": "valid wild combination: position eleven && first indicator is 'a' second is blank\/wildcard", - "data": "...[10]_a_", - "valid": true - }, - { - "description": "valid wild combination: position eleven && both blank\/wildcard", - "data": "...[10]___", - "valid": true - }, - { - "description": "valid wild combination: position 101 && first indicator is null second is omitted\/wildcard", - "data": "...[100]_0", - "valid": true - }, - { - "description": "valid wild combination: position 101 && first indicator is null second is blank\/wildcard", - "data": "...[100]_0_", - "valid": true - }, - { - "description": "valid wild combination: position 101 && first indicator is null second is one", - "data": "...[100]_01", - "valid": true - }, - { - "description": "valid wild combination: position 101 && first indicator is one second is 'z'", - "data": "...[100]_1z", - "valid": true - }, - { - "description": "valid wild combination: position 101 && first indicator is blank\/wildcard second is one", - "data": "...[100]__1", - "valid": true - }, - { - "description": "valid wild combination: position 101 && first indicator is 'a' second is omitted\/wildcard\/wildcard", - "data": "...[100]_a", - "valid": true - }, - { - "description": "valid wild combination: position 101 && first indicator is blank\/wildcard second is 'b'", - "data": "...[100]__b", - "valid": true - }, - { - "description": "valid wild combination: position 101 && first indicator is 'a' second is blank\/wildcard", - "data": "...[100]_a_", - "valid": true - }, - { - "description": "valid wild combination: position 101 && both blank\/wildcard", - "data": "...[100]___", - "valid": true - }, - { - "description": "valid wild combination: range from first position to second && first indicator is null second is omitted\/wildcard", - "data": "...[0-1]_0", - "valid": true - }, - { - "description": "valid wild combination: range from first position to second && first indicator is null second is blank\/wildcard", - "data": "...[0-1]_0_", - "valid": true - }, - { - "description": "valid wild combination: range from first position to second && first indicator is null second is one", - "data": "...[0-1]_01", - "valid": true - }, - { - "description": "valid wild combination: range from first position to second && first indicator is one second is 'z'", - "data": "...[0-1]_1z", - "valid": true - }, - { - "description": "valid wild combination: range from first position to second && first indicator is blank\/wildcard second is one", - "data": "...[0-1]__1", - "valid": true - }, - { - "description": "valid wild combination: range from first position to second && first indicator is 'a' second is omitted\/wildcard\/wildcard", - "data": "...[0-1]_a", - "valid": true - }, - { - "description": "valid wild combination: range from first position to second && first indicator is blank\/wildcard second is 'b'", - "data": "...[0-1]__b", - "valid": true - }, - { - "description": "valid wild combination: range from first position to second && first indicator is 'a' second is blank\/wildcard", - "data": "...[0-1]_a_", - "valid": true - }, - { - "description": "valid wild combination: range from first position to second && both blank\/wildcard", - "data": "...[0-1]___", - "valid": true - }, - { - "description": "valid wild combination: range from first position to last && first indicator is null second is omitted\/wildcard", - "data": "...[0-#]_0", - "valid": true - }, - { - "description": "valid wild combination: range from first position to last && first indicator is null second is blank\/wildcard", - "data": "...[0-#]_0_", - "valid": true - }, - { - "description": "valid wild combination: range from first position to last && first indicator is null second is one", - "data": "...[0-#]_01", - "valid": true - }, - { - "description": "valid wild combination: range from first position to last && first indicator is one second is 'z'", - "data": "...[0-#]_1z", - "valid": true - }, - { - "description": "valid wild combination: range from first position to last && first indicator is blank\/wildcard second is one", - "data": "...[0-#]__1", - "valid": true - }, - { - "description": "valid wild combination: range from first position to last && first indicator is 'a' second is omitted\/wildcard\/wildcard", - "data": "...[0-#]_a", - "valid": true - }, - { - "description": "valid wild combination: range from first position to last && first indicator is blank\/wildcard second is 'b'", - "data": "...[0-#]__b", - "valid": true - }, - { - "description": "valid wild combination: range from first position to last && first indicator is 'a' second is blank\/wildcard", - "data": "...[0-#]_a_", - "valid": true - }, - { - "description": "valid wild combination: range from first position to last && both blank\/wildcard", - "data": "...[0-#]___", - "valid": true - }, - { - "description": "valid wild combination: range from first position to first position, is like first position && first indicator is null second is omitted\/wildcard", - "data": "...[0-0]_0", - "valid": true - }, - { - "description": "valid wild combination: range from first position to first position, is like first position && first indicator is null second is blank\/wildcard", - "data": "...[0-0]_0_", - "valid": true - }, - { - "description": "valid wild combination: range from first position to first position, is like first position && first indicator is null second is one", - "data": "...[0-0]_01", - "valid": true - }, - { - "description": "valid wild combination: range from first position to first position, is like first position && first indicator is one second is 'z'", - "data": "...[0-0]_1z", - "valid": true - }, - { - "description": "valid wild combination: range from first position to first position, is like first position && first indicator is blank\/wildcard second is one", - "data": "...[0-0]__1", - "valid": true - }, - { - "description": "valid wild combination: range from first position to first position, is like first position && first indicator is 'a' second is omitted\/wildcard\/wildcard", - "data": "...[0-0]_a", - "valid": true - }, - { - "description": "valid wild combination: range from first position to first position, is like first position && first indicator is blank\/wildcard second is 'b'", - "data": "...[0-0]__b", - "valid": true - }, - { - "description": "valid wild combination: range from first position to first position, is like first position && first indicator is 'a' second is blank\/wildcard", - "data": "...[0-0]_a_", - "valid": true - }, - { - "description": "valid wild combination: range from first position to first position, is like first position && both blank\/wildcard", - "data": "...[0-0]___", - "valid": true - }, - { - "description": "valid wild combination: range from last position to last position, is like last position && first indicator is null second is omitted\/wildcard", - "data": "...[#-#]_0", - "valid": true - }, - { - "description": "valid wild combination: range from last position to last position, is like last position && first indicator is null second is blank\/wildcard", - "data": "...[#-#]_0_", - "valid": true - }, - { - "description": "valid wild combination: range from last position to last position, is like last position && first indicator is null second is one", - "data": "...[#-#]_01", - "valid": true - }, - { - "description": "valid wild combination: range from last position to last position, is like last position && first indicator is one second is 'z'", - "data": "...[#-#]_1z", - "valid": true - }, - { - "description": "valid wild combination: range from last position to last position, is like last position && first indicator is blank\/wildcard second is one", - "data": "...[#-#]__1", - "valid": true - }, - { - "description": "valid wild combination: range from last position to last position, is like last position && first indicator is 'a' second is omitted\/wildcard\/wildcard", - "data": "...[#-#]_a", - "valid": true - }, - { - "description": "valid wild combination: range from last position to last position, is like last position && first indicator is blank\/wildcard second is 'b'", - "data": "...[#-#]__b", - "valid": true - }, - { - "description": "valid wild combination: range from last position to last position, is like last position && first indicator is 'a' second is blank\/wildcard", - "data": "...[#-#]_a_", - "valid": true - }, - { - "description": "valid wild combination: range from last position to last position, is like last position && both blank\/wildcard", - "data": "...[#-#]___", - "valid": true - }, - { - "description": "valid wild combination: range from last position to position one (index reverted), is like last position && first indicator is null second is omitted\/wildcard", - "data": "...[#-0]_0", - "valid": true - }, - { - "description": "valid wild combination: range from last position to position one (index reverted), is like last position && first indicator is null second is blank\/wildcard", - "data": "...[#-0]_0_", - "valid": true - }, - { - "description": "valid wild combination: range from last position to position one (index reverted), is like last position && first indicator is null second is one", - "data": "...[#-0]_01", - "valid": true - }, - { - "description": "valid wild combination: range from last position to position one (index reverted), is like last position && first indicator is one second is 'z'", - "data": "...[#-0]_1z", - "valid": true - }, - { - "description": "valid wild combination: range from last position to position one (index reverted), is like last position && first indicator is blank\/wildcard second is one", - "data": "...[#-0]__1", - "valid": true - }, - { - "description": "valid wild combination: range from last position to position one (index reverted), is like last position && first indicator is 'a' second is omitted\/wildcard\/wildcard", - "data": "...[#-0]_a", - "valid": true - }, - { - "description": "valid wild combination: range from last position to position one (index reverted), is like last position && first indicator is blank\/wildcard second is 'b'", - "data": "...[#-0]__b", - "valid": true - }, - { - "description": "valid wild combination: range from last position to position one (index reverted), is like last position && first indicator is 'a' second is blank\/wildcard", - "data": "...[#-0]_a_", - "valid": true - }, - { - "description": "valid wild combination: range from last position to position one (index reverted), is like last position && both blank\/wildcard", - "data": "...[#-0]___", - "valid": true - }, - { - "description": "valid wild combination: range from last position to position two (index reverted) && first indicator is null second is omitted\/wildcard", - "data": "...[#-1]_0", - "valid": true - }, - { - "description": "valid wild combination: range from last position to position two (index reverted) && first indicator is null second is blank\/wildcard", - "data": "...[#-1]_0_", - "valid": true - }, - { - "description": "valid wild combination: range from last position to position two (index reverted) && first indicator is null second is one", - "data": "...[#-1]_01", - "valid": true - }, - { - "description": "valid wild combination: range from last position to position two (index reverted) && first indicator is one second is 'z'", - "data": "...[#-1]_1z", - "valid": true - }, - { - "description": "valid wild combination: range from last position to position two (index reverted) && first indicator is blank\/wildcard second is one", - "data": "...[#-1]__1", - "valid": true - }, - { - "description": "valid wild combination: range from last position to position two (index reverted) && first indicator is 'a' second is omitted\/wildcard\/wildcard", - "data": "...[#-1]_a", - "valid": true - }, - { - "description": "valid wild combination: range from last position to position two (index reverted) && first indicator is blank\/wildcard second is 'b'", - "data": "...[#-1]__b", - "valid": true - }, - { - "description": "valid wild combination: range from last position to position two (index reverted) && first indicator is 'a' second is blank\/wildcard", - "data": "...[#-1]_a_", - "valid": true - }, - { - "description": "valid wild combination: range from last position to position two (index reverted) && both blank\/wildcard", - "data": "...[#-1]___", + "description": "valid wild combination: range from last position to position two (index reverted) && indicator 2", + "data": "...[#-1]^2", "valid": true } ] diff --git a/valid/wildCombination_validIndicators.json b/valid/wildCombination_validIndicators.json index 03fdf24..2a87057 100644 --- a/valid/wildCombination_validIndicators.json +++ b/valid/wildCombination_validIndicators.json @@ -5,48 +5,13 @@ }, "tests": [ { - "description": "valid wild combination: first indicator is null second is omitted\/wildcard", - "data": "..._0", + "description": "valid wild combination: indicator 1", + "data": "...^1", "valid": true }, { - "description": "valid wild combination: first indicator is null second is blank\/wildcard", - "data": "..._0_", - "valid": true - }, - { - "description": "valid wild combination: first indicator is null second is one", - "data": "..._01", - "valid": true - }, - { - "description": "valid wild combination: first indicator is one second is 'z'", - "data": "..._1z", - "valid": true - }, - { - "description": "valid wild combination: first indicator is blank\/wildcard second is one", - "data": "...__1", - "valid": true - }, - { - "description": "valid wild combination: first indicator is 'a' second is omitted\/wildcard\/wildcard", - "data": "..._a", - "valid": true - }, - { - "description": "valid wild combination: first indicator is blank\/wildcard second is 'b'", - "data": "...__b", - "valid": true - }, - { - "description": "valid wild combination: first indicator is 'a' second is blank\/wildcard", - "data": "..._a_", - "valid": true - }, - { - "description": "valid wild combination: both blank\/wildcard", - "data": "...___", + "description": "valid wild combination: indicator 2", + "data": "...^2", "valid": true } ] diff --git a/wild_combination.php b/wild_combination.php index 6972d1d..309979e 100644 --- a/wild_combination.php +++ b/wild_combination.php @@ -15,7 +15,7 @@ $indicator = function($ind) { - return "_".$ind; + return "^".$ind; }; $subfield = function($subfieldTagOrRange)