Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
f302ae6d
Commit
f302ae6d
authored
5 years ago
by
Peter W. Draper
Browse files
Options
Downloads
Patches
Plain Diff
Exercise the parser code for handling truncation of a list of strings
parent
a060cb1d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/testParser.c
+12
-0
12 additions, 0 deletions
tests/testParser.c
tests/testParserInput.yaml
+1
-0
1 addition, 0 deletions
tests/testParserInput.yaml
with
13 additions
and
0 deletions
tests/testParser.c
+
12
−
0
View file @
f302ae6d
...
@@ -143,6 +143,18 @@ int main(int argc, char *argv[]) {
...
@@ -143,6 +143,18 @@ int main(int argc, char *argv[]) {
assert
(
strcmp
(
"abcdefghijklmnopqrstuvwxyz"
,
alphabet
)
==
0
);
assert
(
strcmp
(
"abcdefghijklmnopqrstuvwxyz"
,
alphabet
)
==
0
);
parser_free_param_string_array
(
nvar_result
,
var_result
);
parser_free_param_string_array
(
nvar_result
,
var_result
);
/* Unfinished list of values. Should read last improperly quoted string.
* Note length should be CHUNK + 1. */
parser_get_param_string_array
(
&
param_file
,
"Words:unfinished"
,
&
nvar_result
,
&
var_result
);
assert
(
nvar_result
==
11
);
printf
(
"
\n
List from Words:unfinished parameter (%d)
\n
"
,
nvar_result
);
for
(
int
i
=
0
;
i
<
nvar_result
;
i
++
)
{
printf
(
" %d: %s
\n
"
,
i
,
var_result
[
i
]);
}
assert
(
strcmp
(
"abcdefg"
,
var_result
[
nvar_result
-
1
])
==
0
);
parser_free_param_string_array
(
nvar_result
,
var_result
);
/* Print the contents of the structure to stdout now used. */
/* Print the contents of the structure to stdout now used. */
printf
(
"
\n
--- Values after being used:
\n
"
);
printf
(
"
\n
--- Values after being used:
\n
"
);
parser_print_params
(
&
param_file
);
parser_print_params
(
&
param_file
);
...
...
This diff is collapsed.
Click to expand it.
tests/testParserInput.yaml
+
1
−
0
View file @
f302ae6d
...
@@ -21,6 +21,7 @@ Words:
...
@@ -21,6 +21,7 @@ Words:
list
:
[
'
xyz'
,
'
ABC'
,
"
ab'c"
,
"
de:f"
,
"
g,hi"
,
"
zzz"
,
Hello World
,
once-again
]
list
:
[
'
xyz'
,
'
ABC'
,
"
ab'c"
,
"
de:f"
,
"
g,hi"
,
"
zzz"
,
Hello World
,
once-again
]
nonstdlist
:
'
xyz'
,
'
ABC'
,
"
ab'c"
,
"
de:f"
,
"
g,hi"
,
"
zzz"
,
Hello World, once-again
nonstdlist
:
'
xyz'
,
'
ABC'
,
"
ab'c"
,
"
de:f"
,
"
g,hi"
,
"
zzz"
,
Hello World, once-again
long
:
[
a
,
b
,
c
,
d
,
e
,
f
,
g
,
h
,
i
,
j
,
k
,
l
,
m
,
n
,
o
,
p
,
q
,
r
,
s
,
t
,
u
,
v
,
w
,
x
,
y
,
z
]
long
:
[
a
,
b
,
c
,
d
,
e
,
f
,
g
,
h
,
i
,
j
,
k
,
l
,
m
,
n
,
o
,
p
,
q
,
r
,
s
,
t
,
u
,
v
,
w
,
x
,
y
,
z
]
unfinished
:
[
a
,
b
,
c
,
d
,
e
,
f
,
g
,
h
,
i
,
j
,
'
abcdefg
#
Spelling
mistake,
should
go
into
unused
list.
#
Spelling
mistake,
should
go
into
unused
list.
Box:
Box:
...
...
This diff is collapsed.
Click to expand it.
Peter W. Draper
@pdraper
mentioned in merge request
!1078 (merged)
·
5 years ago
mentioned in merge request
!1078 (merged)
mentioned in merge request !1078
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment