summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorDavid Schmitt <david.schmitt@puppet.com>2016-10-25 15:28:40 +0100
committerDavid Schmitt <david.schmitt@puppet.com>2016-10-25 15:28:40 +0100
commitea929418c6c539fe6aa6506e520c5fe8fe68559f (patch)
treeb1492eaf80e23f7e4d8f12894baf6e1b7b171996 /spec/support
parent1e9128ffc890463880041690e508d7ac1d320ea5 (diff)
(MODULES-3980) Fix ipv4 regex validator
This also updates all ipv4 tests to use the same test data for better comparability. Closes #676, #679 Fix-Originally-By: Nate Potter <nathaniel.potter@intel.com>
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/shared_data.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/support/shared_data.rb b/spec/support/shared_data.rb
new file mode 100644
index 0000000..ea9b7a0
--- /dev/null
+++ b/spec/support/shared_data.rb
@@ -0,0 +1,38 @@
+module SharedData
+ IPV4_PATTERNS = [
+ '0.0.0.0',
+ '1.2.3.4',
+ '10.10.10.10',
+ '127.0.0.1',
+ '192.88.99.0',
+ '194.232.104.150',
+ '224.0.0.0',
+ '244.24.24.24',
+ '255.255.255.255',
+ '8.8.8.8',
+ '8.8.8.8/0',
+ '8.8.8.8/16',
+ '8.8.8.8/255.255.0.0',
+ '8.8.8.8/32',
+ ]
+ IPV4_NEGATIVE_PATTERNS = [
+ '',
+ '0000',
+ '0.0.0.0.',
+ '0.0.0.0./0.0.0.0.',
+ '0.0.0.0./1',
+ '0.0.0.0.0',
+ '0.0.0.0/0.0.0.0.',
+ '0.0.0.256',
+ '0.0.0',
+ '1.2.3.4.5',
+ '1.2.3',
+ '10.010.10.10',
+ '2001:0db8:85a3:0000:0000:8a2e:0370:73342001:0db8:85a3:0000:0000:8a2e:0370:7334',
+ '4.4.4',
+ '77',
+ '9999.9999.9999.9999',
+ 'affe::beef',
+ 'nope',
+ ]
+end