-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtests.js
119 lines (117 loc) · 16 KB
/
tests.js
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
var cpr = require('.')
var res = [
JSON.stringify(cpr('1306729647')) === JSON.stringify({ cpr: '1306729647', valid: true, date: new Date('1972-06-13T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('1005081307')) === JSON.stringify({ cpr: '1005081307', valid: true, date: new Date('1908-05-10T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('3107250254')) === JSON.stringify({ cpr: '3107250254', valid: true, date: new Date('1925-07-31T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('0702982154')) === JSON.stringify({ cpr: '0702982154', valid: true, date: new Date('1998-02-07T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('1406929368')) === JSON.stringify({ cpr: '1406929368', valid: true, date: new Date('1992-06-14T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('2103646750')) === JSON.stringify({ cpr: '2103646750', valid: true, date: new Date('1864-03-21T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('1201010310')) === JSON.stringify({ cpr: '1201010310', valid: true, date: new Date('1901-01-12T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('2812852526')) === JSON.stringify({ cpr: '2812852526', valid: true, date: new Date('1985-12-28T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('2602177311')) === JSON.stringify({ cpr: '2602177311', valid: true, date: new Date('2017-02-26T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('1110105130')) === JSON.stringify({ cpr: '1110105130', valid: true, date: new Date('2010-10-11T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('2207220984')) === JSON.stringify({ cpr: '2207220984', valid: true, date: new Date('1922-07-22T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('3011631060')) === JSON.stringify({ cpr: '3011631060', valid: true, date: new Date('1963-11-30T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('0408592666')) === JSON.stringify({ cpr: '0408592666', valid: true, date: new Date('1959-08-04T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('1110137970')) === JSON.stringify({ cpr: '1110137970', valid: true, date: new Date('2013-10-11T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('2306954558')) === JSON.stringify({ cpr: '2306954558', valid: true, date: new Date('1995-06-23T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('2905400137')) === JSON.stringify({ cpr: '2905400137', valid: true, date: new Date('1940-05-29T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('0903058471')) === JSON.stringify({ cpr: '0903058471', valid: true, date: new Date('2005-03-09T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('2903326975')) === JSON.stringify({ cpr: '2903326975', valid: true, date: new Date('2032-03-29T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('2212988823')) === JSON.stringify({ cpr: '2212988823', valid: true, date: new Date('1898-12-22T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('1306853550')) === JSON.stringify({ cpr: '1306853550', valid: true, date: new Date('1985-06-13T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('1207999772')) === JSON.stringify({ cpr: '1207999772', valid: true, date: new Date('1999-07-12T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('1803089430')) === JSON.stringify({ cpr: '1803089430', valid: true, date: new Date('2008-03-18T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('0104413331')) === JSON.stringify({ cpr: '0104413331', valid: true, date: new Date('1941-04-01T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('2105135591')) === JSON.stringify({ cpr: '2105135591', valid: true, date: new Date('2013-05-21T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('2701757168')) === JSON.stringify({ cpr: '2701757168', valid: true, date: new Date('1875-01-27T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('2311446951')) === JSON.stringify({ cpr: '2311446951', valid: true, date: new Date('2044-11-23T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('0106312303')) === JSON.stringify({ cpr: '0106312303', valid: true, date: new Date('1931-06-01T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('1301648789')) === JSON.stringify({ cpr: '1301648789', valid: true, date: new Date('1864-01-13T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('1803550138')) === JSON.stringify({ cpr: '1803550138', valid: true, date: new Date('1955-03-18T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('2407056798')) === JSON.stringify({ cpr: '2407056798', valid: true, date: new Date('2005-07-24T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('2101860488')) === JSON.stringify({ cpr: '2101860488', valid: true, date: new Date('1986-01-21T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('1003942399')) === JSON.stringify({ cpr: '1003942399', valid: true, date: new Date('1994-03-10T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('0102988256')) === JSON.stringify({ cpr: '0102988256', valid: true, date: new Date('1898-02-01T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('0411323129')) === JSON.stringify({ cpr: '0411323129', valid: true, date: new Date('1932-11-04T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('1202197309')) === JSON.stringify({ cpr: '1202197309', valid: true, date: new Date('2019-02-12T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('0610174434')) === JSON.stringify({ cpr: '0610174434', valid: true, date: new Date('2017-10-06T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('0505753836')) === JSON.stringify({ cpr: '0505753836', valid: true, date: new Date('1975-05-05T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('0402968540')) === JSON.stringify({ cpr: '0402968540', valid: true, date: new Date('1896-02-04T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('1104474272')) === JSON.stringify({ cpr: '1104474272', valid: true, date: new Date('1947-04-11T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('1804887195')) === JSON.stringify({ cpr: '1804887195', valid: true, date: new Date('1888-04-18T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('0405771608')) === JSON.stringify({ cpr: '0405771608', valid: true, date: new Date('1977-05-04T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('2810723850')) === JSON.stringify({ cpr: '2810723850', valid: true, date: new Date('1972-10-28T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('2807750804')) === JSON.stringify({ cpr: '2807750804', valid: true, date: new Date('1975-07-28T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('2505844214')) === JSON.stringify({ cpr: '2505844214', valid: true, date: new Date('1984-05-25T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('1711770794')) === JSON.stringify({ cpr: '1711770794', valid: true, date: new Date('1977-11-17T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('2210539592')) === JSON.stringify({ cpr: '2210539592', valid: true, date: new Date('1953-10-22T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('3112905110')) === JSON.stringify({ cpr: '3112905110', valid: true, date: new Date('1890-12-31T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('0802675801')) === JSON.stringify({ cpr: '0802675801', valid: true, date: new Date('1867-02-08T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('0309966899')) === JSON.stringify({ cpr: '0309966899', valid: true, date: new Date('1896-09-03T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('2101358251')) === JSON.stringify({ cpr: '2101358251', valid: true, date: new Date('2035-01-21T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('0604374499')) === JSON.stringify({ cpr: '0604374499', valid: true, date: new Date('1937-04-06T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('1602111284')) === JSON.stringify({ cpr: '1602111284', valid: true, date: new Date('1911-02-16T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('2902369808')) === JSON.stringify({ cpr: '2902369808', valid: true, date: new Date('2036-02-29T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('2106964893')) === JSON.stringify({ cpr: '2106964893', valid: true, date: new Date('1996-06-21T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('2906728055')) === JSON.stringify({ cpr: '2906728055', valid: true, date: new Date('1872-06-29T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('0304131608')) === JSON.stringify({ cpr: '0304131608', valid: true, date: new Date('1913-04-03T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('0910366858')) === JSON.stringify({ cpr: '0910366858', valid: true, date: new Date('2036-10-09T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('0902762213')) === JSON.stringify({ cpr: '0902762213', valid: true, date: new Date('1976-02-09T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('2007470447')) === JSON.stringify({ cpr: '2007470447', valid: true, date: new Date('1947-07-20T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('0812421034')) === JSON.stringify({ cpr: '0812421034', valid: true, date: new Date('1942-12-08T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('2202101294')) === JSON.stringify({ cpr: '2202101294', valid: true, date: new Date('1910-02-22T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('1607723997')) === JSON.stringify({ cpr: '1607723997', valid: true, date: new Date('1972-07-16T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('2306442352')) === JSON.stringify({ cpr: '2306442352', valid: true, date: new Date('1944-06-23T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('1809739437')) === JSON.stringify({ cpr: '1809739437', valid: true, date: new Date('1973-09-18T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('0906019957')) === JSON.stringify({ cpr: '0906019957', valid: true, date: new Date('2001-06-09T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('0509950598')) === JSON.stringify({ cpr: '0509950598', valid: true, date: new Date('1995-09-05T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('0108296275')) === JSON.stringify({ cpr: '0108296275', valid: true, date: new Date('2029-08-01T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('2202042964')) === JSON.stringify({ cpr: '2202042964', valid: true, date: new Date('1904-02-22T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('1601449214')) === JSON.stringify({ cpr: '1601449214', valid: true, date: new Date('1944-01-16T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('0608524320')) === JSON.stringify({ cpr: '0608524320', valid: true, date: new Date('1952-08-06T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('0110450729')) === JSON.stringify({ cpr: '0110450729', valid: true, date: new Date('1945-10-01T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('1012711316')) === JSON.stringify({ cpr: '1012711316', valid: true, date: new Date('1971-12-10T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('2410404640')) === JSON.stringify({ cpr: '2410404640', valid: true, date: new Date('1940-10-24T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('2207554394')) === JSON.stringify({ cpr: '2207554394', valid: true, date: new Date('1955-07-22T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('0907395332')) === JSON.stringify({ cpr: '0907395332', valid: true, date: new Date('2039-07-09T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('0408159857')) === JSON.stringify({ cpr: '0408159857', valid: true, date: new Date('2015-08-04T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('2203423287')) === JSON.stringify({ cpr: '2203423287', valid: true, date: new Date('1942-03-22T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('2411861433')) === JSON.stringify({ cpr: '2411861433', valid: true, date: new Date('1986-11-24T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('0207056111')) === JSON.stringify({ cpr: '0207056111', valid: true, date: new Date('2005-07-02T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('0809761347')) === JSON.stringify({ cpr: '0809761347', valid: true, date: new Date('1976-09-08T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('0807182846')) === JSON.stringify({ cpr: '0807182846', valid: true, date: new Date('1918-07-08T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('1006027845')) === JSON.stringify({ cpr: '1006027845', valid: true, date: new Date('2002-06-10T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('1510469174')) === JSON.stringify({ cpr: '1510469174', valid: true, date: new Date('1946-10-15T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('0601168448')) === JSON.stringify({ cpr: '0601168448', valid: true, date: new Date('2016-01-06T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('1211040706')) === JSON.stringify({ cpr: '1211040706', valid: true, date: new Date('1904-11-12T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('0201070910')) === JSON.stringify({ cpr: '0201070910', valid: true, date: new Date('1907-01-02T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('0105090587')) === JSON.stringify({ cpr: '0105090587', valid: true, date: new Date('1909-05-01T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('0301145047')) === JSON.stringify({ cpr: '0301145047', valid: true, date: new Date('2014-01-03T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('0104374697')) === JSON.stringify({ cpr: '0104374697', valid: true, date: new Date('1937-04-01T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('2207952756')) === JSON.stringify({ cpr: '2207952756', valid: true, date: new Date('1995-07-22T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('0901955506')) === JSON.stringify({ cpr: '0901955506', valid: true, date: new Date('1895-01-09T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('1709417610')) === JSON.stringify({ cpr: '1709417610', valid: true, date: new Date('2041-09-17T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('2303907311')) === JSON.stringify({ cpr: '2303907311', valid: true, date: new Date('1890-03-23T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('3010007134')) === JSON.stringify({ cpr: '3010007134', valid: true, date: new Date('2000-10-30T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('1409205050')) === JSON.stringify({ cpr: '1409205050', valid: true, date: new Date('2020-09-14T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('0411357627')) === JSON.stringify({ cpr: '0411357627', valid: true, date: new Date('2035-11-04T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('2312799130')) === JSON.stringify({ cpr: '2312799130', valid: true, date: new Date('1979-12-23T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('1508115772')) === JSON.stringify({ cpr: '1508115772', valid: true, date: new Date('2011-08-15T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('0409780725')) === JSON.stringify({ cpr: '0409780725', valid: true, date: new Date('1978-09-04T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('1107819416')) === JSON.stringify({ cpr: '1107819416', valid: true, date: new Date('1981-07-11T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('1812687863')) === JSON.stringify({ cpr: '1812687863', valid: true, date: new Date('1868-12-18T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('2912728911')) === JSON.stringify({ cpr: '2912728911', valid: true, date: new Date('1872-12-29T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('1902458480')) === JSON.stringify({ cpr: '1902458480', valid: true, date: new Date('2045-02-19T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('0301290225')) === JSON.stringify({ cpr: '0301290225', valid: true, date: new Date('1929-01-03T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('0407549864')) === JSON.stringify({ cpr: '0407549864', valid: true, date: new Date('1954-07-04T00:00:00.000Z'), sex: 'Female' }),
JSON.stringify(cpr('0505289315')) === JSON.stringify({ cpr: '0505289315', valid: true, date: new Date('2028-05-05T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('0204588449')) === JSON.stringify({ cpr: '0204588449', valid: true, date: new Date('1858-04-02T00:00:00.000Z'), sex: 'Male' }),
JSON.stringify(cpr('2010642011')) === JSON.stringify({ cpr: '2010642011', valid: true, date: new Date('1964-10-20T00:00:00.000Z'), sex: 'Male' })
]
if (res.every(x => x === true)) {
console.log('ok')
} else {
console.error('fail')
process.exit(1)
}