Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libloc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
libloc
Commits
8bbddd9a
Commit
8bbddd9a
authored
Oct 17, 2019
by
Michael Tremer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: Add another country for test
Signed-off-by:
Michael Tremer
<
michael.tremer@ipfire.org
>
parent
7c922e9c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
src/test-country.c
src/test-country.c
+10
-2
No files found.
src/test-country.c
View file @
8bbddd9a
...
@@ -67,6 +67,14 @@ int main(int argc, char** argv) {
...
@@ -67,6 +67,14 @@ int main(int argc, char** argv) {
// Free country
// Free country
loc_country_unref
(
country
);
loc_country_unref
(
country
);
// Add another country
err
=
loc_writer_add_country
(
writer
,
&
country
,
"YY"
);
if
(
err
)
{
fprintf
(
stderr
,
"Could not create country: YY
\n
"
);
exit
(
EXIT_FAILURE
);
}
loc_country_unref
(
country
);
FILE
*
f
=
fopen
(
"test.db"
,
"w"
);
FILE
*
f
=
fopen
(
"test.db"
,
"w"
);
if
(
!
f
)
{
if
(
!
f
)
{
fprintf
(
stderr
,
"Could not open file for writing: %s
\n
"
,
strerror
(
errno
));
fprintf
(
stderr
,
"Could not open file for writing: %s
\n
"
,
strerror
(
errno
));
...
@@ -97,9 +105,9 @@ int main(int argc, char** argv) {
...
@@ -97,9 +105,9 @@ int main(int argc, char** argv) {
}
}
// Lookup an address in the subnet
// Lookup an address in the subnet
err
=
loc_database_get_country
(
db
,
&
country
,
"
XX
"
);
err
=
loc_database_get_country
(
db
,
&
country
,
"
YY
"
);
if
(
err
)
{
if
(
err
)
{
fprintf
(
stderr
,
"Could not find country
XX
\n
"
);
fprintf
(
stderr
,
"Could not find country
: YY
\n
"
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
loc_country_unref
(
country
);
loc_country_unref
(
country
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment