FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
luaplot/iterable_test.lua at master · thewizardplusplus/luaplot · GitHub
thewizardplusplus
/
luaplot
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Issues
0
Pull requests
0
Actions
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
luaplot
/
iterable_test.lua
Copy path
More file actions
More file actions
Latest commit
History
History
History
49 lines (39 loc) · 1.18 KB
Breadcrumbs
luaplot
/
iterable_test.lua
Copy path
File metadata and controls
49 lines (39 loc) · 1.18 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
local
luaunit
=
require
(
"
luaunit
"
)
local
middleclass
=
require
(
"
middleclass
"
)
local
assertions
=
require
(
"
luatypechecks.assertions
"
)
local
Iterable
=
require
(
"
luaplot.iterable
"
)
--
luacheck: globals TestIterable
TestIterable
=
{}
function
TestIterable
.
test_ipairs_metamethod
()
local
MockClass
=
middleclass
(
"
MockClass
"
)
MockClass
:
include
(
Iterable
)
MockClass
.
__index
=
function
(
_
,
index
)
assertions
.
is_number
(
index
)
return
index
<=
5
and
index
/
10
or
nil
end
local
mock
=
MockClass
:
new
()
local
values
=
{}
for
index
,
value
in
mock
:
__ipairs
()
do
table.insert
(
values
, {
index
=
index
,
value
=
value
})
end
luaunit
.
assert_equals
(
values
, {
{
index
=
1
,
value
=
0.1
},
{
index
=
2
,
value
=
0.2
},
{
index
=
3
,
value
=
0.3
},
{
index
=
4
,
value
=
0.4
},
{
index
=
5
,
value
=
0.5
},
})
end
function
TestIterable
.
test_ipairs_metamethod_empty
()
local
MockClass
=
middleclass
(
"
MockClass
"
)
MockClass
:
include
(
Iterable
)
MockClass
.
__index
=
function
()
return
nil
end
local
mock
=
MockClass
:
new
()
local
values
=
{}
for
index
,
value
in
mock
:
__ipairs
()
do
table.insert
(
values
, {
index
=
index
,
value
=
value
})
end
luaunit
.
assert_equals
(
values
, {})
end
Back
|
FazBrowse Home
|
New Git URL