1 /*
2 * Copyright (C) 2020 Alexandros Theodotou <alex at zrythm dot org>
3 *
4 * This file is part of Zrythm
5 *
6 * Zrythm is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * Zrythm is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
15 *
16 * You should have received a copy of the GNU Affero General Public License
17 * along with Zrythm. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20 #include "zrythm-test-config.h"
21
22 #include <stdlib.h>
23
24 #include "audio/port_identifier.h"
25 #include "utils/general.h"
26
27 #include <glib.h>
28
29 static void
test_uint_from_bitfield()30 test_uint_from_bitfield ()
31 {
32 g_assert_cmpuint (
33 0, ==,
34 utils_get_uint_from_bitfield_val (
35 PORT_FLAG_STEREO_L));
36 g_assert_cmpuint (
37 14, ==,
38 utils_get_uint_from_bitfield_val (
39 PORT_FLAG_NOT_ON_GUI));
40 g_assert_cmpuint (
41 18, ==,
42 utils_get_uint_from_bitfield_val (
43 PORT_FLAG_CHANNEL_FADER));
44 }
45
46 int
main(int argc,char * argv[])47 main (int argc, char *argv[])
48 {
49 g_test_init (&argc, &argv, NULL);
50
51 #define TEST_PREFIX "/utils/general/"
52
53 g_test_add_func (
54 TEST_PREFIX "test uint from bitfield",
55 (GTestFunc) test_uint_from_bitfield);
56
57 return g_test_run ();
58 }
59