FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
lpython/integration_tests/enum_04.py at main · sak-codes/lpython · GitHub
sak-codes
/
lpython
Public
forked from
lcompilers/lpython
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
lpython
/
integration_tests
/
enum_04.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
71 lines (58 loc) · 1.8 KB
Breadcrumbs
lpython
/
integration_tests
/
enum_04.py
Copy path
File metadata and controls
71 lines (58 loc) · 1.8 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
from
ltypes
import
i32
from
enum
import
Enum
,
auto
class
Color
(
Enum
):
RED
:
i32
=
auto
()
GREEN
:
i32
=
auto
()
BLUE
:
i32
=
7
YELLOW
:
i32
=
auto
()
WHITE
:
i32
=
auto
()
PINK
:
i32
=
15
GREY
:
i32
=
auto
()
class
Integers
(
Enum
):
a
:
i32
=
-
5
b
:
i32
=
auto
()
c
:
i32
=
auto
()
d
:
i32
=
0
e
:
i32
=
auto
()
f
:
i32
=
7
g
:
i32
=
auto
()
def
test_color_enum
():
print
(
Color
.
RED
.
value
,
Color
.
RED
.
name
)
print
(
Color
.
GREEN
.
value
,
Color
.
GREEN
.
name
)
print
(
Color
.
BLUE
.
value
,
Color
.
BLUE
.
name
)
print
(
Color
.
YELLOW
.
value
,
Color
.
YELLOW
.
name
)
print
(
Color
.
WHITE
.
value
,
Color
.
WHITE
.
name
)
print
(
Color
.
PINK
.
value
,
Color
.
PINK
.
name
)
print
(
Color
.
GREY
.
value
,
Color
.
GREY
.
name
)
assert
Color
.
RED
.
value
==
1
assert
Color
.
GREEN
.
value
==
2
assert
Color
.
BLUE
.
value
==
7
assert
Color
.
YELLOW
.
value
==
8
assert
Color
.
WHITE
.
value
==
9
assert
Color
.
PINK
.
value
==
15
assert
Color
.
GREY
.
value
==
16
def
test_selected_color
(
selected_color
:
Color
):
color
:
Color
color
=
Color
(
selected_color
)
assert
color
==
Color
.
YELLOW
print
(
color
.
name
,
color
.
value
)
def
test_integer
(
integer
:
Integers
,
value
:
i32
):
assert
integer
.
value
==
value
def
test_integers
():
print
(
Integers
.
a
.
name
,
Integers
.
a
.
value
)
test_integer
(
Integers
.
a
,
-
5
)
print
(
Integers
.
b
.
name
,
Integers
.
b
.
value
)
test_integer
(
Integers
.
b
,
-
4
)
print
(
Integers
.
c
.
name
,
Integers
.
c
.
value
)
test_integer
(
Integers
.
c
,
-
3
)
print
(
Integers
.
d
.
name
,
Integers
.
d
.
value
)
test_integer
(
Integers
.
d
,
0
)
print
(
Integers
.
e
.
name
,
Integers
.
e
.
value
)
test_integer
(
Integers
.
e
,
1
)
print
(
Integers
.
f
.
name
,
Integers
.
f
.
value
)
test_integer
(
Integers
.
f
,
7
)
print
(
Integers
.
g
.
name
,
Integers
.
g
.
value
)
test_integer
(
Integers
.
g
,
8
)
test_color_enum
()
test_selected_color
(
Color
.
YELLOW
)
test_integers
()
Back
|
FazBrowse Home
|
New Git URL