add code
This commit is contained in:
@@ -0,0 +1,162 @@
|
||||
// This file was generated by Cpp2Beef
|
||||
|
||||
using System;
|
||||
using System.Interop;
|
||||
using static SDL3.SDL;
|
||||
|
||||
namespace SDL3;
|
||||
|
||||
extension SDLTest
|
||||
{
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2026 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Test suite related functions of SDL test framework.
|
||||
*
|
||||
* This code is a part of the SDL test library, not the main SDL library.
|
||||
*/
|
||||
|
||||
/*
|
||||
Defines types for test case definitions and the test execution harness API.
|
||||
|
||||
Based on original GSOC code by Markus Kauppila <markus.kauppila@gmail.com>
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* SDLTest_CommonState */
|
||||
|
||||
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
|
||||
|
||||
|
||||
|
||||
/* ! Definitions for test case structures */
|
||||
public const let TEST_ENABLED = 1;
|
||||
public const let TEST_DISABLED = 0;
|
||||
|
||||
/* ! Definition of all the possible test return values of the test case method */
|
||||
public const let TEST_ABORTED = -1;
|
||||
public const let TEST_STARTED = 0;
|
||||
public const let TEST_COMPLETED = 1;
|
||||
public const let TEST_SKIPPED = 2;
|
||||
|
||||
/* ! Definition of all the possible test results for the harness */
|
||||
public const let TEST_RESULT_PASSED = 0;
|
||||
public const let TEST_RESULT_FAILED = 1;
|
||||
public const let TEST_RESULT_NO_ASSERT = 2;
|
||||
public const let TEST_RESULT_SKIPPED = 3;
|
||||
public const let TEST_RESULT_SETUP_FAILURE = 4;
|
||||
|
||||
/* !< Function pointer to a test case setup function (run before every test) */
|
||||
public function void TestCaseSetUpFp(void** arg);
|
||||
|
||||
/* !< Function pointer to a test case function */
|
||||
public function c_int TestCaseFp(void* arg);
|
||||
|
||||
/* !< Function pointer to a test case teardown function (run after every test) */
|
||||
public function void TestCaseTearDownFp(void* arg);
|
||||
|
||||
/*
|
||||
* Holds information about a single test case.
|
||||
*/
|
||||
[CRepr] public struct TestCaseReference {
|
||||
/* !< Func2Stress */
|
||||
public TestCaseFp testCase;
|
||||
/* !< Short name (or function name) "Func2Stress" */
|
||||
public c_char* name;
|
||||
/* !< Long name or full description "This test pushes func2() to the limit." */
|
||||
public c_char* description;
|
||||
/* !< Set to TEST_ENABLED or TEST_DISABLED (test won't be run) */
|
||||
public c_int enabled;
|
||||
}
|
||||
|
||||
/*
|
||||
* Holds information about a test suite (multiple test cases).
|
||||
*/
|
||||
[CRepr] public struct TestSuiteReference {
|
||||
/* !< "PlatformSuite" */
|
||||
public c_char* name;
|
||||
/* !< The function that is run before each test. NULL skips. */
|
||||
public TestCaseSetUpFp testSetUp;
|
||||
/* !< The test cases that are run as part of the suite. Last item should be NULL. */
|
||||
public TestCaseReference** testCases;
|
||||
/* !< The function that is run after each test. NULL skips. */
|
||||
public TestCaseTearDownFp testTearDown;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Generates a random run seed string for the harness. The generated seed
|
||||
* will contain alphanumeric characters (0-9A-Z).
|
||||
*
|
||||
* \param buffer Buffer in which to generate the random seed. Must have a capacity of at least length + 1 characters.
|
||||
* \param length Number of alphanumeric characters to write to buffer, must be >0
|
||||
*
|
||||
* \returns A null-terminated seed string and equal to the in put buffer on success, NULL on failure
|
||||
*/
|
||||
[LinkName("SDLTest_GenerateRunSeed")] public static extern c_char* GenerateRunSeed(c_char* buffer, c_int length);
|
||||
|
||||
/*
|
||||
* Holds information about the execution of test suites.
|
||||
* */
|
||||
[CRepr] public struct TestSuiteRunner;
|
||||
|
||||
/*
|
||||
* Create a new test suite runner, that will execute the given test suites.
|
||||
* It will register the harness cli arguments to the common SDL state.
|
||||
*
|
||||
* \param state Common SDL state on which to register CLI arguments.
|
||||
* \param testSuites NULL-terminated test suites containing test cases.
|
||||
*
|
||||
* \returns the test run result: 0 when all tests passed, 1 if any tests failed.
|
||||
*/
|
||||
[LinkName("SDLTest_CreateTestSuiteRunner")] public static extern TestSuiteRunner* CreateTestSuiteRunner(CommonState* state, TestSuiteReference** testSuites);
|
||||
|
||||
/*
|
||||
* Destroy a test suite runner.
|
||||
* It will unregister the harness cli arguments to the common SDL state.
|
||||
*
|
||||
* \param runner The runner that should be destroyed.
|
||||
*/
|
||||
[LinkName("SDLTest_DestroyTestSuiteRunner")] public static extern void DestroyTestSuiteRunner(TestSuiteRunner* runner);
|
||||
|
||||
/*
|
||||
* Execute a test suite, using the configured run seed, execution key, filter, etc.
|
||||
*
|
||||
* \param runner The runner that should be executed.
|
||||
*
|
||||
* \returns the test run result: 0 when all tests passed, 1 if any tests failed.
|
||||
*/
|
||||
[LinkName("SDLTest_ExecuteTestSuiteRunner")] public static extern c_int ExecuteTestSuiteRunner(TestSuiteRunner* runner);
|
||||
}
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* SDL_test_h_arness_h */
|
||||
Reference in New Issue
Block a user