File: test-gamma-table.c

package info (click to toggle)
phosh 0.53.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 9,868 kB
  • sloc: ansic: 83,377; xml: 3,981; python: 717; sh: 449; makefile: 34; lisp: 22; javascript: 6
file content (37 lines) | stat: -rw-r--r-- 790 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
 * Copyright (C) 2023 Phosh.mobi e.V.
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 *
 * Author: Guido Günther <agx@sigxcpu.org>
 */

#include "monitor/gamma-table.h"

#define RAMP_SIZE 2

static void
test_phosh_gamma_table_fill (void)
{
  guint16 table[RAMP_SIZE * 3];

  phosh_gamma_table_fill (table, RAMP_SIZE, 6500);

  g_assert_cmpint (table[0], ==, 0);
  g_assert_cmpint (table[RAMP_SIZE], ==, 0);
  g_assert_cmpint (table[2 * RAMP_SIZE], ==, 0);

  g_assert_cmpint (table[1], ==, 32768);
  g_assert_cmpint (table[1 + RAMP_SIZE], ==, 32768);
  g_assert_cmpint (table[1 + 2 * RAMP_SIZE], ==, 32768);
}


int
main (int argc, char *argv[])
{
  g_test_init (&argc, &argv, NULL);

  g_test_add_func("/phosh/gamma-table/fill", test_phosh_gamma_table_fill);
  return g_test_run();
}