mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-26 17:37:34 +00:00
976d40f669
https://github.com/catchorg/Catch2/releases/tag/v3.6.0 Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2268>
39 lines
819 B
C++
39 lines
819 B
C++
// Copyright 2022, Collabora, Ltd.
|
|
// SPDX-License-Identifier: BSL-1.0
|
|
/*!
|
|
* @file
|
|
* @brief Test u_vector C interface.
|
|
* @author Mateo de Mayo <mateo.demayo@collabora.com>
|
|
*/
|
|
|
|
#include "catch_amalgamated.hpp"
|
|
#include "util/u_vector.h"
|
|
|
|
TEST_CASE("u_vector")
|
|
{
|
|
SECTION("Test interface generated from macros")
|
|
{
|
|
struct u_vector_float vf = u_vector_float_create();
|
|
CHECK(vf.ptr != NULL);
|
|
|
|
constexpr float A = 2.71f;
|
|
constexpr float B = 1.61f;
|
|
constexpr float C = 3.14f;
|
|
|
|
u_vector_float_push_back(vf, A);
|
|
u_vector_float_push_back(vf, B);
|
|
u_vector_float_push_back(vf, C);
|
|
|
|
float a = u_vector_float_at(vf, 0);
|
|
float b = u_vector_float_at(vf, 1);
|
|
float c = u_vector_float_at(vf, 2);
|
|
|
|
CHECK(a == A);
|
|
CHECK(b == B);
|
|
CHECK(c == C);
|
|
|
|
u_vector_float_destroy(&vf);
|
|
CHECK(vf.ptr == NULL);
|
|
}
|
|
}
|