Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
miniaudio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
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
MyCard
miniaudio
Commits
e5aaffc2
Commit
e5aaffc2
authored
Feb 22, 2020
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor restructuring to tests.
parent
479503ec
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
37 deletions
+38
-37
tests/test_common/ma_test_common.c
tests/test_common/ma_test_common.c
+37
-0
tests/test_generation/ma_test_generation.c
tests/test_generation/ma_test_generation.c
+1
-37
No files found.
tests/test_common/ma_test_common.c
0 → 100644
View file @
e5aaffc2
#define MINIAUDIO_IMPLEMENTATION
#include "../../miniaudio.h"
#include <stdio.h>
#define MAX_TESTS 64
typedef
int
(
*
ma_test_entry_proc
)(
int
argc
,
char
**
argv
);
typedef
struct
{
const
char
*
pName
;
ma_test_entry_proc
onEntry
;
}
ma_test
;
struct
{
ma_test
pTests
[
MAX_TESTS
];
size_t
count
;
}
g_Tests
;
ma_result
ma_register_test
(
const
char
*
pName
,
ma_test_entry_proc
onEntry
)
{
MA_ASSERT
(
pName
!=
NULL
);
MA_ASSERT
(
onEntry
!=
NULL
);
if
(
g_Tests
.
count
>=
MAX_TESTS
)
{
printf
(
"Failed to register test %s because there are too many tests already registered. Increase the value of MAX_TESTS
\n
"
,
pName
);
return
MA_INVALID_OPERATION
;
}
g_Tests
.
pTests
[
g_Tests
.
count
].
pName
=
pName
;
g_Tests
.
pTests
[
g_Tests
.
count
].
onEntry
=
onEntry
;
g_Tests
.
count
+=
1
;
return
MA_SUCCESS
;
}
\ No newline at end of file
tests/test_generation/ma_test_generation.c
View file @
e5aaffc2
#define MINIAUDIO_IMPLEMENTATION
#include "../../miniaudio.h"
#include "../test_common/ma_test_common.c"
#define DR_WAV_IMPLEMENTATION
#include "../../extras/dr_wav.h"
#include <stdio.h>
static
drwav_data_format
drwav_data_format_from_minaudio_format
(
ma_format
format
,
ma_uint32
channels
,
ma_uint32
sampleRate
)
{
drwav_data_format
wavFormat
;
...
...
@@ -27,39 +24,6 @@ static drwav_data_format drwav_data_format_from_minaudio_format(ma_format format
#include "ma_test_generation_noise.c"
#include "ma_test_generation_waveform.c"
#define MAX_TESTS 64
typedef
int
(
*
ma_test_entry_proc
)(
int
argc
,
char
**
argv
);
typedef
struct
{
const
char
*
pName
;
ma_test_entry_proc
onEntry
;
}
ma_test
;
struct
{
ma_test
pTests
[
MAX_TESTS
];
size_t
count
;
}
g_Tests
;
ma_result
ma_register_test
(
const
char
*
pName
,
ma_test_entry_proc
onEntry
)
{
MA_ASSERT
(
pName
!=
NULL
);
MA_ASSERT
(
onEntry
!=
NULL
);
if
(
g_Tests
.
count
>=
MAX_TESTS
)
{
printf
(
"Failed to register test %s because there are too many tests already registered. Increase the value of MAX_TESTS
\n
"
,
pName
);
return
MA_INVALID_OPERATION
;
}
g_Tests
.
pTests
[
g_Tests
.
count
].
pName
=
pName
;
g_Tests
.
pTests
[
g_Tests
.
count
].
onEntry
=
onEntry
;
g_Tests
.
count
+=
1
;
return
MA_SUCCESS
;
}
int
main
(
int
argc
,
char
**
argv
)
{
ma_result
result
;
...
...
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