FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
lpython/tests/constants1.py at main · Smit-create/lpython · GitHub
Smit-create
/
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
/
tests
/
constants1.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
112 lines (94 loc) · 1.8 KB
Breadcrumbs
lpython
/
tests
/
constants1.py
Copy path
File metadata and controls
112 lines (94 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
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
def
test_boz
():
b
:
str
b
=
bin
(
5
)
b
=
bin
(
64
)
b
=
bin
(
-
534
)
b
=
oct
(
8
)
b
=
oct
(
56
)
b
=
oct
(
-
534
)
b
=
hex
(
42
)
b
=
hex
(
12648430
)
b
=
hex
(
-
534
)
def
test_ord_chr
():
s
:
str
a
:
i32
a
=
ord
(
'5'
)
s
=
chr
(
43
)
def
test_abs
():
a
:
i32
a
=
abs
(
5
)
a
=
abs
(
-
500
)
a
=
abs
(
False
)
a
=
abs
(
True
)
b
:
f32
b
=
abs
(
3.45
)
b
=
abs
(
-
5346.34
)
b
=
abs
(
complex
(
3.45
,
5.6
))
def
test_len
():
a
:
i32
a
=
len
(
''
)
a
=
len
(
'test'
)
a
=
len
(
"this is a test"
)
a
=
len
((
1
,
2
,
3
))
a
=
len
(((
"a"
,
"b"
,
3.4
), (
"c"
,
3
,
5.6
)))
a
=
len
([
1
,
2
,
3
])
a
=
len
([[
-
4
,
-
5
,
-
6
], [
-
1
,
-
2
,
-
3
]])
a
=
len
({
1
,
2
,
3
})
a
=
len
({
1
:
"a"
,
2
:
"b"
,
3
:
"c"
})
def
test_bool
():
a
:
bool
a
=
bool
(
0
)
a
=
bool
(
-
1
)
a
=
bool
(
''
)
a
=
bool
(
complex
(
0
,
0
))
assert
a
==
False
a
=
bool
(
't'
)
a
=
bool
(
2.3
)
assert
a
==
True
def
test_str
():
s
:
str
s
=
str
()
s
=
str
(
5
)
s
=
str
(
-
4
)
s
=
str
(
5.6
)
s
=
str
(
True
)
s
=
str
(
False
)
s
=
str
(
"5346"
)
def
test_callable
():
a
:
bool
b
:
i32
b
=
2
a
=
callable
(
test_len
)
assert
a
==
True
a
=
callable
(
b
)
assert
a
==
False
a
=
callable
(
'c'
)
assert
a
==
False
def
test_int
():
a
:
i64
a
=
int
()
a
=
int
(
4.56
)
a
=
int
(
5
)
a
=
int
(
-
5.00001
)
a
=
int
(
True
)
a
=
int
(
False
)
a
=
int
(
"5346"
)
# a = int(complex(3.45, 5.6)) -> semantic error
def
test_float
():
a
:
f64
a
=
float
()
a
=
float
(
4.56
)
a
=
float
(
5
)
a
=
float
(
-
1
)
a
=
float
(
True
)
a
=
float
(
False
)
a
=
float
(
"5346"
)
a
=
float
(
"423.534"
)
# a = float(complex(3.45, 5.6)) -> semantic error
def
test_divmod
():
a
:
i32
a
=
divmod
(
9
,
3
)
a
=
divmod
(
9
,
-
3
)
a
=
divmod
(
3
,
3
)
a
=
divmod
(
4
,
5
)
a
=
divmod
(
0
,
5
)
Back
|
FazBrowse Home
|
New Git URL