Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libSDL
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
libSDL
Commits
e991b026
Commit
e991b026
authored
Jun 28, 2011
by
Markus Kauppila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed a few mistakes from XML logger.
parent
c843c7e8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
9 deletions
+45
-9
xml.c
test/test-automation/xml.c
+13
-8
xml_logger.c
test/test-automation/xml_logger.c
+32
-1
No files found.
test/test-automation/xml.c
View file @
e991b026
...
@@ -197,6 +197,9 @@ XMLOpenDocument(const char *rootTag)
...
@@ -197,6 +197,9 @@ XMLOpenDocument(const char *rootTag)
{
{
const
char
*
doctype
=
"<?xml version=
\"
1.0
\"
encoding=
\"
ISO-8859-1
\"
?>
\n
"
;
const
char
*
doctype
=
"<?xml version=
\"
1.0
\"
encoding=
\"
ISO-8859-1
\"
?>
\n
"
;
//! \todo make this optional (and let the user supply the filename?)
const
char
*
style
=
"<?xml-stylesheet type=
\"
text/xsl
\"
href=
\"
style.xsl
\"
?>
\n
"
;
memset
(
buffer
,
0
,
bufferSize
);
memset
(
buffer
,
0
,
bufferSize
);
snprintf
(
buffer
,
bufferSize
,
"<%s>"
,
rootTag
);
snprintf
(
buffer
,
bufferSize
,
"<%s>"
,
rootTag
);
...
@@ -205,16 +208,18 @@ XMLOpenDocument(const char *rootTag)
...
@@ -205,16 +208,18 @@ XMLOpenDocument(const char *rootTag)
root
=
rootTag
;
// it's fine, as long as rootTag points to static memory?
root
=
rootTag
;
// it's fine, as long as rootTag points to static memory?
const
int
doctypeSize
=
SDL_strlen
(
doctype
);
const
int
doctypeSize
=
SDL_strlen
(
doctype
);
const
int
styleSize
=
SDL_strlen
(
style
);
const
int
tagSize
=
SDL_strlen
(
buffer
);
const
int
tagSize
=
SDL_strlen
(
buffer
);
const
int
size
=
doctypeSize
+
tagSize
+
1
;
// extra byte for '\0'
const
int
size
=
doctypeSize
+
styleSize
+
tagSize
+
1
;
// extra byte for '\0'
char
*
ret
=
SDL_malloc
(
size
);
char
*
retBuf
=
SDL_malloc
(
size
);
// copy doctype
strncpy
(
ret
,
doctype
,
doctypeSize
);
// fill in the previous allocated retBuf
// copy tag
strcat
(
retBuf
,
doctype
);
strncpy
(
ret
+
doctypeSize
,
buffer
,
tagSize
);
strcat
(
retBuf
,
style
);
ret
[
size
]
=
'\0'
;
strcat
(
retBuf
,
buffer
);
return
ret
;
return
retBuf
;
}
}
char
*
char
*
...
...
test/test-automation/xml_logger.c
View file @
e991b026
...
@@ -52,7 +52,7 @@ const char *assertElementName = "assert";
...
@@ -52,7 +52,7 @@ const char *assertElementName = "assert";
const
char
*
messageElementName
=
"message"
;
const
char
*
messageElementName
=
"message"
;
const
char
*
timeElementName
=
"time"
;
const
char
*
timeElementName
=
"time"
;
const
char
*
assertSummaryElementName
=
"assertSummary"
;
const
char
*
assertSummaryElementName
=
"assertSummary"
;
const
char
*
assertCountElementName
=
"assert
Name
"
;
const
char
*
assertCountElementName
=
"assert
Count
"
;
const
char
*
assertsPassedElementName
=
"assertsPassed"
;
const
char
*
assertsPassedElementName
=
"assertsPassed"
;
const
char
*
assertsFailedElementName
=
"assertsFailed"
;
const
char
*
assertsFailedElementName
=
"assertsFailed"
;
const
char
*
logElementName
=
"log"
;
const
char
*
logElementName
=
"log"
;
...
@@ -214,6 +214,15 @@ XMLSuiteStarted(const char *suiteName, time_t eventTime)
...
@@ -214,6 +214,15 @@ XMLSuiteStarted(const char *suiteName, time_t eventTime)
char
*
output
=
XMLOpenElement
(
suiteElementName
);
char
*
output
=
XMLOpenElement
(
suiteElementName
);
XMLOutputter
(
indentLevel
++
,
YES
,
output
);
XMLOutputter
(
indentLevel
++
,
YES
,
output
);
output
=
XMLOpenElement
(
nameElementName
);
XMLOutputter
(
indentLevel
++
,
NO
,
output
);
output
=
XMLAddContent
(
suiteName
);
XMLOutputter
(
indentLevel
,
NO
,
output
);
output
=
XMLCloseElement
(
nameElementName
);
XMLOutputter
(
--
indentLevel
,
YES
,
output
);
output
=
XMLOpenElement
(
startTimeElementName
);
output
=
XMLOpenElement
(
startTimeElementName
);
XMLOutputter
(
indentLevel
++
,
NO
,
output
);
XMLOutputter
(
indentLevel
++
,
NO
,
output
);
...
@@ -373,6 +382,17 @@ XMLAssert(const char *assertName, int assertResult, const char *assertMessage,
...
@@ -373,6 +382,17 @@ XMLAssert(const char *assertName, int assertResult, const char *assertMessage,
char
*
output
=
XMLOpenElement
(
assertElementName
);
char
*
output
=
XMLOpenElement
(
assertElementName
);
XMLOutputter
(
indentLevel
++
,
YES
,
output
);
XMLOutputter
(
indentLevel
++
,
YES
,
output
);
// log assert name
output
=
XMLOpenElement
(
nameElementName
);
XMLOutputter
(
indentLevel
++
,
NO
,
output
);
output
=
XMLAddContent
(
assertName
);
XMLOutputter
(
indentLevel
,
NO
,
output
);
output
=
XMLCloseElement
(
nameElementName
);
XMLOutputter
(
--
indentLevel
,
YES
,
output
);
// log assert result
// log assert result
output
=
XMLOpenElement
(
resultElementName
);
output
=
XMLOpenElement
(
resultElementName
);
XMLOutputter
(
indentLevel
++
,
NO
,
output
);
XMLOutputter
(
indentLevel
++
,
NO
,
output
);
...
@@ -414,6 +434,17 @@ XMLAssertWithValues(const char *assertName, int assertResult, const char *assert
...
@@ -414,6 +434,17 @@ XMLAssertWithValues(const char *assertName, int assertResult, const char *assert
char
*
output
=
XMLOpenElement
(
assertElementName
);
char
*
output
=
XMLOpenElement
(
assertElementName
);
XMLOutputter
(
indentLevel
++
,
YES
,
output
);
XMLOutputter
(
indentLevel
++
,
YES
,
output
);
// log assert name
output
=
XMLOpenElement
(
nameElementName
);
XMLOutputter
(
indentLevel
++
,
NO
,
output
);
output
=
XMLAddContent
(
assertName
);
XMLOutputter
(
indentLevel
,
NO
,
output
);
output
=
XMLCloseElement
(
nameElementName
);
XMLOutputter
(
--
indentLevel
,
YES
,
output
);
// log assert result
// log assert result
output
=
XMLOpenElement
(
resultElementName
);
output
=
XMLOpenElement
(
resultElementName
);
XMLOutputter
(
indentLevel
++
,
NO
,
output
);
XMLOutputter
(
indentLevel
++
,
NO
,
output
);
...
...
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