mirror of
https://github.com/ZDoom/zdoom-macos-deps.git
synced 2024-11-21 11:31:07 +00:00
use expect macro in existing tests
This commit is contained in:
parent
bc866fdd9d
commit
fa1727f8ec
4 changed files with 14 additions and 63 deletions
|
@ -2,22 +2,11 @@
|
|||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
if (mpg123_init() != MPG123_OK)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
AEDI_EXPECT(mpg123_init() == MPG123_OK);
|
||||
|
||||
mpg123_handle* mh = mpg123_new(NULL, NULL);
|
||||
|
||||
if (mh == nullptr)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (mpg123_param(mh, MPG123_VERBOSE, 1, 0.) != MPG123_OK)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
AEDI_EXPECT(mh != nullptr);
|
||||
AEDI_EXPECT(mpg123_param(mh, MPG123_VERBOSE, 1, 0.) == MPG123_OK);
|
||||
|
||||
mpg123_delete(mh);
|
||||
mpg123_exit();
|
||||
|
|
|
@ -2,10 +2,7 @@
|
|||
|
||||
int main()
|
||||
{
|
||||
if (SDL_Init(SDL_INIT_EVERYTHING) != 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
AEDI_EXPECT(SDL_Init(SDL_INIT_EVERYTHING) == 0);
|
||||
|
||||
SDL_Event dummy;
|
||||
|
||||
|
|
18
test/vpx.cpp
18
test/vpx.cpp
|
@ -4,23 +4,11 @@
|
|||
int main()
|
||||
{
|
||||
vpx_codec_ctx_t codec;
|
||||
|
||||
if (vpx_codec_dec_init(&codec, &vpx_codec_vp8_dx_algo, nullptr, 0) != VPX_CODEC_OK)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
AEDI_EXPECT(vpx_codec_dec_init(&codec, &vpx_codec_vp8_dx_algo, nullptr, 0) == VPX_CODEC_OK);
|
||||
|
||||
vp8_postproc_cfg_t pp = { 0, 0, 0 };
|
||||
|
||||
if (vpx_codec_control(&codec, VP8_SET_POSTPROC, &pp) != VPX_CODEC_OK)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (vpx_codec_destroy(&codec) != VPX_CODEC_OK)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
AEDI_EXPECT(vpx_codec_control(&codec, VP8_SET_POSTPROC, &pp) == VPX_CODEC_OK);
|
||||
AEDI_EXPECT(vpx_codec_destroy(&codec) == VPX_CODEC_OK);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -5,10 +5,7 @@ int main()
|
|||
{
|
||||
z_stream stream = {};
|
||||
|
||||
if (deflateInit(&stream, Z_DEFAULT_COMPRESSION) != Z_OK)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
AEDI_EXPECT(deflateInit(&stream, Z_DEFAULT_COMPRESSION) == Z_OK);
|
||||
|
||||
constexpr size_t BUFFER_SIZE = 1024;
|
||||
unsigned char reference[BUFFER_SIZE];
|
||||
|
@ -25,22 +22,12 @@ int main()
|
|||
stream.next_out = deflated;
|
||||
stream.avail_out = BUFFER_SIZE;
|
||||
|
||||
if (deflate(&stream, Z_FINISH) != Z_STREAM_END)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (deflateEnd(&stream) != Z_OK)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
AEDI_EXPECT(deflate(&stream, Z_FINISH) == Z_STREAM_END);
|
||||
AEDI_EXPECT(deflateEnd(&stream) == Z_OK);
|
||||
|
||||
stream = {};
|
||||
|
||||
if (inflateInit(&stream) != Z_OK)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
AEDI_EXPECT(inflateInit(&stream) == Z_OK);
|
||||
|
||||
unsigned char inflated[BUFFER_SIZE] = {};
|
||||
|
||||
|
@ -49,20 +36,10 @@ int main()
|
|||
stream.next_out = inflated;
|
||||
stream.avail_out = BUFFER_SIZE;
|
||||
|
||||
if (inflate(&stream, Z_FINISH) != Z_STREAM_END)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
AEDI_EXPECT(inflate(&stream, Z_FINISH) == Z_STREAM_END);
|
||||
AEDI_EXPECT(inflateEnd(&stream) == Z_OK);
|
||||
|
||||
if (inflateEnd(&stream) != Z_OK)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (memcmp(reference, inflated, BUFFER_SIZE) != 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
AEDI_EXPECT(memcmp(reference, inflated, BUFFER_SIZE) == 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue