Skip to content

Commit 4bff47d

Browse files
committed
Added Range for build arrays
1 parent 6a68bba commit 4bff47d

13 files changed

Lines changed: 473 additions & 145 deletions

File tree

.gitignore

Lines changed: 222 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,222 @@
1+
#################
2+
## IntelliJIdea
3+
#################
4+
5+
.idea
6+
7+
#################
8+
## Eclipse
9+
#################
10+
11+
*.pydevproject
12+
.project
13+
.metadata
14+
bin/
15+
tmp/
16+
*.tmp
17+
*.bak
18+
*.swp
19+
*~.nib
20+
local.properties
21+
.classpath
22+
.settings/
23+
.loadpath
24+
25+
# External tool builders
26+
.externalToolBuilders/
27+
28+
# Locally stored "Eclipse launch configurations"
29+
*.launch
30+
31+
# CDT-specific
32+
.cproject
33+
34+
# PDT-specific
35+
.buildpath
36+
37+
38+
#################
39+
## Visual Studio
40+
#################
41+
42+
## Ignore Visual Studio temporary files, build results, and
43+
## files generated by popular Visual Studio add-ons.
44+
45+
# User-specific files
46+
*.suo
47+
*.user
48+
*.sln.docstates
49+
50+
# Build results
51+
52+
[Dd]ebug/
53+
[Rr]elease/
54+
x64/
55+
build/
56+
[Bb]in/
57+
[Oo]bj/
58+
59+
# MSTest test Results
60+
[Tt]est[Rr]esult*/
61+
[Bb]uild[Ll]og.*
62+
63+
*_i.c
64+
*_p.c
65+
*.ilk
66+
*.meta
67+
*.obj
68+
*.pch
69+
*.pdb
70+
*.pgc
71+
*.pgd
72+
*.rsp
73+
*.sbr
74+
*.tlb
75+
*.tli
76+
*.tlh
77+
*.tmp
78+
*.tmp_proj
79+
*.log
80+
*.vspscc
81+
*.vssscc
82+
.builds
83+
*.pidb
84+
*.log
85+
*.scc
86+
87+
# Visual C++ cache files
88+
ipch/
89+
*.aps
90+
*.ncb
91+
*.opensdf
92+
*.sdf
93+
*.cachefile
94+
95+
# Visual Studio profiler
96+
*.psess
97+
*.vsp
98+
*.vspx
99+
100+
# Guidance Automation Toolkit
101+
*.gpState
102+
103+
# ReSharper is a .NET coding add-in
104+
_ReSharper*/
105+
*.[Rr]e[Ss]harper
106+
107+
# TeamCity is a build add-in
108+
_TeamCity*
109+
110+
# DotCover is a Code Coverage Tool
111+
*.dotCover
112+
113+
# NCrunch
114+
*.ncrunch*
115+
.*crunch*.local.xml
116+
117+
# Installshield output folder
118+
[Ee]xpress/
119+
120+
# DocProject is a documentation generator add-in
121+
DocProject/buildhelp/
122+
DocProject/Help/*.HxT
123+
DocProject/Help/*.HxC
124+
DocProject/Help/*.hhc
125+
DocProject/Help/*.hhk
126+
DocProject/Help/*.hhp
127+
DocProject/Help/Html2
128+
DocProject/Help/html
129+
130+
# Click-Once directory
131+
publish/
132+
133+
# Publish Web Output
134+
*.Publish.xml
135+
*.pubxml
136+
*.publishproj
137+
138+
# NuGet Packages Directory
139+
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
140+
#packages/
141+
142+
# Windows Azure Build Output
143+
csx
144+
*.build.csdef
145+
146+
# Windows Store app package directory
147+
AppPackages/
148+
149+
# Others
150+
sql/
151+
*.Cache
152+
ClientBin/
153+
[Ss]tyle[Cc]op.*
154+
~$*
155+
*~
156+
*.dbmdl
157+
*.[Pp]ublish.xml
158+
*.pfx
159+
*.publishsettings
160+
161+
# RIA/Silverlight projects
162+
Generated_Code/
163+
164+
# Backup & report files from converting an old project file to a newer
165+
# Visual Studio version. Backup files are not needed, because we have git ;-)
166+
_UpgradeReport_Files/
167+
Backup*/
168+
UpgradeLog*.XML
169+
UpgradeLog*.htm
170+
171+
# SQL Server files
172+
App_Data/*.mdf
173+
App_Data/*.ldf
174+
175+
#############
176+
## Windows detritus
177+
#############
178+
179+
# Windows image file caches
180+
Thumbs.db
181+
ehthumbs.db
182+
183+
# Folder config file
184+
Desktop.ini
185+
186+
# Recycle Bin used on file shares
187+
$RECYCLE.BIN/
188+
189+
# Mac crap
190+
.DS_Store
191+
192+
193+
#############
194+
## Python
195+
#############
196+
197+
*.py[cod]
198+
199+
# Packages
200+
*.egg
201+
*.egg-info
202+
dist/
203+
build/
204+
eggs/
205+
parts/
206+
var/
207+
sdist/
208+
develop-eggs/
209+
.installed.cfg
210+
211+
# Installer logs
212+
pip-log.txt
213+
214+
# Unit test / coverage reports
215+
.coverage
216+
.tox
217+
218+
#Translations
219+
*.mo
220+
221+
#Mr Developer
222+
.mr.developer.cfg

Tests/DoubleLinkedList_Test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@
55
test("DoubleLinkedList - Init test", function () {
66
var list = new DoubleLinkedList(0, 1, 2);
77
deepEqual(list.toArray(), [0, 1, 2], "Init list");
8+
list = new DoubleLinkedList(2);
9+
deepEqual(list.toArray(), [2], "Init list");
10+
});
11+
12+
test("DoubleLinkedList - Init range test", function () {
13+
var list = new DoubleLinkedList(Range(0, 2));
14+
deepEqual(list.toArray(), [0, 1, 2], "Init list");
15+
list = new DoubleLinkedList(Range(2, -2, -0.5));
16+
deepEqual(list.toArray(), [2, 1.5, 1, 0.5, 0, -0.5, -1, -1.5, -2], "Init list");
817
});
918

1019
test("DoubleLinkedList - Push test", function () {

Tests/LinkedList_Test.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
test("LinkedList - Init test", function () {
66
var list = new LinkedList(0, 1, 2);
77
deepEqual(list.toArray(), [0, 1, 2], "Init list");
8+
list = new LinkedList(0);
9+
deepEqual(list.toArray(), [0], "Init list");
10+
});
11+
12+
test("LinkedList - Init test with range", function () {
13+
var list = new LinkedList(new Range(0, 5));
14+
deepEqual(list.toArray(), [0, 1, 2, 3, 4, 5], "Init list with range");
815
});
916

1017
test("LinkedList - Push test", function () {

Tests/Queue_Test.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
test("Queue - Init test", function () {
66
var queue = new Queue(0, 2, 4, 6);
77
deepEqual(queue.multiDequeue(4), [0, 2, 4, 6], "Initializing");
8+
queue = new Queue(0);
9+
deepEqual(queue.multiDequeue(4), [0], "Initializing");
10+
});
11+
12+
test("Queue - Init range test", function () {
13+
var queue = new Queue(Range(0, 6, 2));
14+
deepEqual(queue.multiDequeue(4), [0, 2, 4, 6], "Initializing");
815
});
916

1017
test("Queue - Enqueue test", function () {

Tests/Range_Test.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/**
2+
* Created by Stefano on 06/04/14.
3+
*/
4+
5+
test("Range - Create linear test", function () {
6+
var range = Range(0, 5);
7+
for (var j = 0; j < range.length; j++) {
8+
deepEqual(range[j], j, "Check range values");
9+
}
10+
});
11+
12+
test("Range - Create inverse test", function () {
13+
var range = Range(5, 0, -1);
14+
for (var j = 0; j < range.length; j++) {
15+
deepEqual(range[j], 5 - j, "Check range values");
16+
}
17+
});
18+
19+
test("Range - Create step test", function () {
20+
var range = Range(0, 15, 4);
21+
for (var j = 0; j < range.length; j++) {
22+
deepEqual(range[j], j * 4, "Check range values");
23+
}
24+
});
25+
26+
test("Range - Create inverse step test", function () {
27+
var range = Range(15, 4, -2);
28+
for (var j = 0; j < range.length; j++) {
29+
deepEqual(range[j], 15 - j * 2, "Check range values");
30+
}
31+
});

0 commit comments

Comments
 (0)