-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidator-vat-examples.red
More file actions
46 lines (38 loc) · 1.08 KB
/
validator-vat-examples.red
File metadata and controls
46 lines (38 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Red [
Title: "VAT validator examples"
Description: "Usage of Value Added Tax (VAT) validator"
Author: "Mateusz Palichleb"
File: %validator-vat-examples.red
]
do %../src/validator.red
; ------------------------------------------------------
; Example 1: Valid VAT numbers for several countries
; ------------------------------------------------------
probe valid/vat "PL8567346215" ; Poland
probe valid/vat "CHE162856788TVA" ; Switzerland
probe valid/vat "NL004495445B01" ; Netherlands
probe valid/vat "CL21472149-5" ; Chile
probe valid/vat "ALJ52263223X" ; Australia
; Output:
; true
; true
; true
; true
; true
; ------------------------------------------------------
; Example 2: Invalid VAT numbers
; ------------------------------------------------------
probe valid/vat "PL1234567890" ; Poland
probe valid/vat "CHE123456788" ; Switzerland
probe valid/vat "NL123456789X90" ; Netherlands
probe valid/vat "CL214721495X" ; Chile
; "Unknown values and countries"
probe valid/vat "xy987654321"
probe valid/vat "123456789"
; Output:
; false
; false
; false
; false
; false
; false