FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
lpython/src/lpython/tests/test_stacktrace2.cpp at main · archiv-nptel/lpython · GitHub
archiv-nptel
/
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
/
src
/
lpython
/
tests
/
test_stacktrace2.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
59 lines (47 loc) · 1.68 KB
Breadcrumbs
lpython
/
src
/
lpython
/
tests
/
test_stacktrace2.cpp
Copy path
File metadata and controls
59 lines (47 loc) · 1.68 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
#
include
<
tests/doctest.h
>
#
include
<
iostream
>
#
include
<
libasr/stacktrace.h
>
#
include
<
lpython/pickle.h
>
TEST_CASE
(
"
Address to line number
"
){
Allocator
al
(
4
*
1024
);
std::vector<std::string> filenames = {
"
foo
"
,
"
foo1
"
,
"
foo2
"
,
"
foo3
"
};
std::vector<
uint64_t
> addresses = {
//
address, line_number, filename_id
123
,
45
,
0
,
456
,
50
,
1
,
789
,
1
,
3
,
1000
,
15
,
2
,
1200
,
20
,
1
};
std::string filename =
"
"
;
int
line_number = -
1
;
LCompilers::address_to_line_number
(filenames, addresses,
100
, filename, line_number);
CHECK
(filename==
"
foo
"
);
CHECK
(line_number==
45
);
LCompilers::address_to_line_number
(filenames, addresses,
140
, filename, line_number);
CHECK
(filename==
"
foo1
"
);
CHECK
(line_number==
50
);
LCompilers::address_to_line_number
(filenames, addresses,
500
, filename, line_number );
CHECK
(filename==
"
foo3
"
);
CHECK
(line_number==
1
);
LCompilers::address_to_line_number
(filenames, addresses,
900
, filename, line_number);
CHECK
(filename==
"
foo2
"
);
CHECK
(line_number==
15
);
LCompilers::address_to_line_number
(filenames, addresses,
1015
, filename, line_number);
CHECK
(filename==
"
foo2
"
);
CHECK
(line_number==
15
);
LCompilers::address_to_line_number
(filenames, addresses,
1016
, filename, line_number);
CHECK
(filename==
"
foo1
"
);
CHECK
(line_number==
20
);
LCompilers::address_to_line_number
(filenames, addresses,
1100
, filename, line_number);
CHECK
(filename==
"
foo1
"
);
CHECK
(line_number==
20
);
LCompilers::address_to_line_number
(filenames, addresses,
1300
, filename, line_number);
CHECK
(filename==
"
"
);
CHECK
(line_number==-
1
);
}
Back
|
FazBrowse Home
|
New Git URL