1
0
mirror of https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git synced 2026-10-28 13:55:08 +03:00
Files
libgpiod/tests/tests-misc.c
Bartosz Golaszewski 6f8700e0bd tests: misc: fix the version string test case
The current development version is v1.6-devel. The '-' character is
there to differentiate between the "main" version part and the extra
suffix.

The existing test case for the version string is now failing because
we used '.' previously for the extra version suffix. Fix it by extending
the regex pattern.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-02-03 11:19:07 +01:00

30 lines
662 B
C

// SPDX-License-Identifier: LGPL-2.1-or-later
/*
* This file is part of libgpiod.
*
* Copyright (C) 2019 Bartosz Golaszewski <bgolaszewski@baylibre.com>
*/
#include <string.h>
#include "gpiod-test.h"
#define GPIOD_TEST_GROUP "misc"
GPIOD_TEST_CASE(version_string, 0, { 1 })
{
g_autoptr(GRegex) regex = NULL;
GError *err = NULL;
const gchar *ver;
ver = gpiod_version_string();
g_assert_nonnull(ver);
gpiod_test_return_if_failed();
g_assert_cmpuint(strlen(ver), >, 0);
regex = g_regex_new("^[0-9]+\\.[0-9]+[0-9a-zA-Z\\.-]*$", 0, 0, &err);
g_assert_null(err);
gpiod_test_return_if_failed();
g_assert_true(g_regex_match(regex, ver, 0, NULL));
}