Vec

Table of Contents

Vec

Description

Typesafe vector definition. This is much like C++ template std::vector

Note

Using this directly like Vec(T) won’t always work, because each time this is used it defines a new type, and two Vec(T)s are different from each other. To deal with this, you must typedef vector for a specific type. Throughout the code, any time that is in plural form is generally a vector. Like Strs is a typedef of Vec(Str).

Usage example (from documentation)

  Vec(int) integers; // Vector of integers
  Vec(CustomStruct) my_data; // Vector of CustomStruct
  Vec(float) real_numbers; // Vector of float values
  Vec(const char*) names; Vector of c-style null-terminated strings

FIELDS:
- length      : Number of items currently in vector (always <= capacity)
- capacity    : Max number of items this vector can hold before doing a resize.
- copy_init   : If provided then is used to create owned copies of items into vector.
- copy_deinit : If provided then is used to deinit data held by vector.
                Caution when dealing with shared ownership.
- data        : Data held by vector. Don't access by direct indexing. Use `VecAt(..)`
- alignment   : Alignment requirement for each item in vector.

Usage example (Cross-references)

    /// TAGS: System, Directory, Container
    ///
    typedef Vec(SysDirEntry) SysDirContents;
    
    ///
    
    #include <Misra/Std/Container/Str.h>
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/Container/BitVec.h>
    #define MISRA_STD_UTILITY_STR_ITER_H
    
    #include <Misra/Std/Container/Vec/Type.h>
    #include <Misra/Std/Utility/Iter.h>
    #include <Misra/Types.h>
    
    typedef Iter(char) StrIter;
    typedef Vec(StrIter) StrIters;
    
    ///
    
    // clang-format off
    #include "Vec/Type.h"
    #include "Vec/Init.h"
    #include "Vec/Insert.h"
    // clang-format off
    #include "Vec/Type.h"
    #include "Vec/Init.h"
    #include "Vec/Insert.h"
    #include "Vec/Remove.h"
    #include "Vec/Type.h"
    #include "Vec/Init.h"
    #include "Vec/Insert.h"
    #include "Vec/Remove.h"
    #include "Vec/Access.h"
    #include "Vec/Init.h"
    #include "Vec/Insert.h"
    #include "Vec/Remove.h"
    #include "Vec/Access.h"
    #include "Vec/Memory.h"
    #include "Vec/Insert.h"
    #include "Vec/Remove.h"
    #include "Vec/Access.h"
    #include "Vec/Memory.h"
    #include "Vec/Foreach.h"
    #include "Vec/Remove.h"
    #include "Vec/Access.h"
    #include "Vec/Memory.h"
    #include "Vec/Foreach.h"
    #include "Vec/Ops.h"
    #include "Vec/Access.h"
    #include "Vec/Memory.h"
    #include "Vec/Foreach.h"
    #include "Vec/Ops.h"
    #include "Vec/Private.h"
    #include "Vec/Memory.h"
    #include "Vec/Foreach.h"
    #include "Vec/Ops.h"
    #include "Vec/Private.h"
    // clang-format on
    #include "Vec/Foreach.h"
    #include "Vec/Ops.h"
    #include "Vec/Private.h"
    // clang-format on
    
    #include <string.h>
    #include <Misra/Std/Container/Vec/Type.h>
    #include <Misra/Std/Utility/Iter/Type.h>
    #include <Misra/Types.h>
    /// The Str type is a specialization of Vec for characters
    ///
    typedef Vec(char) Str;
    
    ///
    /// Vector of strings
    ///
    typedef Vec(Str) Strs;
    
    ///
    #include <Misra/Std/Container/Common.h>
    #include <Misra/Types.h>
    #include <Misra/Std/Container/Vec.h>
    
    ///
    } BitVec;
    
    typedef Vec(BitVec) BitVecs;
    
    ///
    // ct
    #include <Misra/Std/Container/Str.h>
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/Log.h>
    #include <Misra/Sys.h>
    } EnumEntry;
    
    typedef Vec(EnumEntry) EnumEntries;
    
    int main(int argc, char** argv) {
    "date: 2025-05-12T05:00:00Z\n"
    "# image: \"/images/image-placeholder.png\"\n"
    "categories: [\"Vec\", \"Macro\", \"Generic\"]\n"
    "author: \"Siddharth Mishra\"\n"
    "tags: [\"vec\", \"macro\", \"generic\"]\n"
    Str name;
    f64 price;
    Vec(Str) tags;
    } SimpleProduct;
    Str  json    = StrInit();
    
    Vec(Str) languages = VecInitWithDeepCopy(NULL, StrDeinit);
    
    // Create strings and push them properly
    Str name;
    f64 price;
    Vec(Str) tags;
    } SimpleProduct;
    StrIter si      = StrIterFromStr(json);
    
    Vec(Str) languages = VecInitWithDeepCopy(NULL, StrDeinit);
    
    JR_OBJ(si, {
    Str  json    = StrInit();
    
    Vec(i32) empty_numbers = VecInit();
    Vec(Str) empty_strings = VecInitWithDeepCopy(NULL, StrDeinit);
    
    Vec(i32) empty_numbers = VecInit();
    Vec(Str) empty_strings = VecInitWithDeepCopy(NULL, StrDeinit);
    
    JW_OBJ(json, {
    Str  json    = StrInit();
    
    Vec(i32) empty_list = VecInit();
    
    JW_OBJ(json, {
    Str  json    = StrInit();
    
    Vec(i32) empty_arr  = VecInit();
    Vec(i32) filled_arr = VecInit();
    i32 val1 = 1, val2 = 2;
    
    Vec(i32) empty_arr  = VecInit();
    Vec(i32) filled_arr = VecInit();
    i32 val1 = 1, val2 = 2;
    VecPushBack(&filled_arr, val1);
    f64  small_float;
    bool is_valid;
    Vec(Str) empty_array;
    Vec(i64) numbers;
    } EdgeCaseData;
    bool is_valid;
    Vec(Str) empty_array;
    Vec(i64) numbers;
    } EdgeCaseData;
    StrIter si1   = StrIterFromStr(json1);
    
    Vec(i32) items = VecInit();
    
    JR_OBJ(si1, {
    StrIter si2   = StrIterFromStr(json2);
    
    Vec(Str) data = VecInitWithDeepCopy(NULL, StrDeinit);
    
    JR_OBJ(si2, {
    struct {
    i32 x_value;
    Vec(i32) filled_items;
    } obj = {0, VecInit()};
    } AnnSymbol;
    
    typedef Vec(AnnSymbol) AnnSymbols;
    
    typedef struct ApiResponse {
    u64 analysis_id;
    Str sha256;
    Vec(Str) tags;
    Str created_at;
    u64 model_id;
    Str  json    = StrInit();
    
    Vec(FunctionInfo) functions = VecInitWithDeepCopy(NULL, FunctionInfoDeinit);
    
    FunctionInfo func1 = {12345, StrInitFromZstr("test_func"), 1024, 4096};
    Str  json    = StrInit();
    
    Vec(AnnSymbol) symbols = VecInitWithDeepCopy(NULL, AnnSymbolDeinit);
    
    AnnSymbol sym1             = {0};
    Str  json    = StrInit();
    
    Vec(u32) numbers = VecInit();
    u32 num1 = 1, num2 = 2, num3 = 3;
    VecPushBack(&numbers, num1);
    VecPushBack(&numbers, num3);
    
    Vec(Str) strings = VecInitWithDeepCopy(NULL, StrDeinit);
    
    // Create strings and push them properly
    VecPushBack(&strings, str3);
    
    Vec(bool) booleans = VecInit();
    bool bool1 = true, bool2 = false, bool3 = true;
    VecPushBack(&booleans, bool1);
    u32  timeout;
    Str  log_level;
    Vec(Str) features;
    } TestConfig;
    TestPerson user;
    TestConfig config;
    Vec(i32) numbers;
    Vec(bool) flags;
    } ComplexData;
    TestConfig config;
    Vec(i32) numbers;
    Vec(bool) flags;
    } ComplexData;
    
    // Original data
    Vec(i32) original_numbers = VecInit();
    Vec(Str) original_strings = VecInitWithDeepCopy(NULL, StrDeinit);
    // Original data
    Vec(i32) original_numbers = VecInit();
    Vec(Str) original_strings = VecInitWithDeepCopy(NULL, StrDeinit);
    
    // Populate arrays
    
    // Read back from JSON
    Vec(i32) parsed_numbers = VecInit();
    Vec(Str) parsed_strings = VecInitWithDeepCopy(NULL, StrDeinit);
    // Read back from JSON
    Vec(i32) parsed_numbers = VecInit();
    Vec(Str) parsed_strings = VecInitWithDeepCopy(NULL, StrDeinit);
    
    StrIter si = StrIterFromStr(json);
    
    // Original empty data
    Vec(i32) empty_numbers = VecInit();
    Vec(Str) empty_strings = VecInitWithDeepCopy(NULL, StrDeinit);
    Str empty_str          = StrInit();
    // Original empty data
    Vec(i32) empty_numbers = VecInit();
    Vec(Str) empty_strings = VecInitWithDeepCopy(NULL, StrDeinit);
    Str empty_str          = StrInit();
    
    // Read back from JSON
    Vec(i32) parsed_numbers = VecInit();
    Vec(Str) parsed_strings = VecInitWithDeepCopy(NULL, StrDeinit);
    Str  parsed_str         = StrInit();
    // Read back from JSON
    Vec(i32) parsed_numbers = VecInit();
    Vec(Str) parsed_strings = VecInitWithDeepCopy(NULL, StrDeinit);
    Str  parsed_str         = StrInit();
    bool found_empty_object = false;
    } AnnSymbol;
    
    typedef Vec(AnnSymbol) AnnSymbols;
    
    typedef struct ApiResponse {
    } FunctionInfo;
    
    typedef Vec(FunctionInfo) FunctionInfos;
    
    typedef struct ModelInfo {
    } ModelInfo;
    
    typedef Vec(ModelInfo) ModelInfos;
    
    typedef struct SearchResult {
    u64 analysis_id;
    Str sha256;
    Vec(Str) tags;
    Str created_at;
    u64 model_id;
    } SearchResult;
    
    typedef Vec(SearchResult) SearchResults;
    
    void FunctionInfoDeinit(FunctionInfo* info) {
    StrIter si = StrIterFromStr(json);
    
    typedef Vec(AnnSymbol) Symbols;
    Symbols symbols = VecInitWithDeepCopy(NULL, AnnSymbolDeinit);
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/Log.h>
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    // Main function that runs all tests
    int main(void) {
    printf("[INFO] Starting Vec.Foreach.Simple tests\n\n");
    
    // Array of normal test functions
    
    // Run all tests using the centralized test driver
    return run_test_suite(tests, total_tests, NULL, 0, "Vec.Foreach.Simple");
    }
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/Log.h>
    #include <stdio.h>
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Test with a vector with alignment > 1
    typedef Vec(int) AlignedIntVec;
    AlignedIntVec aligned_vec = VecInitAligned(8);
    
    // Create a vector of integers with default alignment (1)
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector with 8-byte alignment
    typedef Vec(int) AlignedIntVec;
    AlignedIntVec aligned_vec = VecInitAligned(8);
    // Main function that runs all tests
    int main(void) {
    printf("[INFO] Starting Vec.Access tests\n\n");
    
    // Array of test functions
    
    // Run all tests using the centralized test driver
    return run_test_suite(tests, total_tests, NULL, 0, "Vec.Access");
    }
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/Log.h>
    #include <stdio.h>
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec1 = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers without copy_init
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    // Main function that runs all tests
    int main(void) {
    printf("[INFO] Starting Vec.Insert tests\n\n");
    
    // Array of test functions
    
    // Run all tests using the centralized test driver
    return run_test_suite(tests, total_tests, NULL, 0, "Vec.Insert");
    }
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/Log.h>
    #include <stdio.h>
    // Test basic Vec type functionality
    bool test_vec_type_basic(void) {
    printf("Testing basic Vec type functionality\n");
    
    // Define a vector of integers
    
    // Define a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Test with a struct type
    typedef Vec(TestItem) TestVec;
    TestVec test_vec = VecInit();
    
    // Create a valid vector
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    // Main function that runs all tests
    int main(void) {
    printf("[INFO] Starting Vec.Type tests\n\n");
    
    // Array of test functions
    
    // Run all tests using the centralized test driver
    return run_test_suite(tests, total_tests, NULL, 0, "Vec.Type");
    }
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/Log.h>
    #include <stdio.h>
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    // Main function that runs all tests
    int main(void) {
    printf("[INFO] Starting Vec.Memory tests\n\n");
    
    // Array of test functions
    
    // Run all tests using the centralized test driver
    return run_test_suite(tests, total_tests, NULL, 0, "Vec.Memory");
    }
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/Memory.h>
    #include <Misra/Std/Log.h>
    
    // Create a vector of ComplexItem with deep copy functions
    typedef Vec(ComplexItem) ComplexVec;
    ComplexVec vec = VecInitWithDeepCopy(ComplexItemCopyInit, ComplexItemDeinit);
    
    // Create a vector of ComplexItem with deep copy functions
    typedef Vec(ComplexItem) ComplexVec;
    ComplexVec vec = VecInitWithDeepCopy(ComplexItemCopyInit, ComplexItemDeinit);
    
    // Create a vector of ComplexItem with deep copy functions
    typedef Vec(ComplexItem) ComplexVec;
    ComplexVec vec = VecInitWithDeepCopy(ComplexItemCopyInit, ComplexItemDeinit);
    
    // Create two vectors of ComplexItem with deep copy functions
    typedef Vec(ComplexItem) ComplexVec;
    ComplexVec vec1 = VecInitWithDeepCopy(ComplexItemCopyInit, ComplexItemDeinit);
    ComplexVec vec2 = VecInitWithDeepCopy(ComplexItemCopyInit, ComplexItemDeinit);
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a temporary vector with no copy_init but with copy_deinit for proper cleanup
    typedef Vec(ComplexItem) ComplexVec;
    ComplexVec temp_vec = VecInitWithDeepCopy(NULL, ComplexItemDeinit);
    
    // Create a vector with no copy_init but with copy_deinit for proper cleanup
    typedef Vec(ComplexItem) ComplexVec;
    ComplexVec vec = VecInitWithDeepCopy(NULL, ComplexItemDeinit);
    
    // Create a vector with no copy_init but with copy_deinit for proper cleanup
    typedef Vec(ComplexItem) ComplexVec;
    ComplexVec vec = VecInitWithDeepCopy(NULL, ComplexItemDeinit);
    
    // Create a vector with no copy_init but with copy_deinit for proper cleanup
    typedef Vec(ComplexItem) ComplexVec;
    ComplexVec vec = VecInitWithDeepCopy(NULL, ComplexItemDeinit);
    
    // Create a vector with no copy_init but with copy_deinit for proper cleanup
    typedef Vec(ComplexItem) ComplexVec;
    ComplexVec vec1 = VecInitWithDeepCopy(NULL, ComplexItemDeinit);
    ComplexVec vec2 = VecInitWithDeepCopy(NULL, ComplexItemDeinit);
    
    // Create a vector with no copy_init but with copy_deinit for proper cleanup
    typedef Vec(ComplexItem) ComplexVec;
    ComplexVec vec = VecInitWithDeepCopy(NULL, ComplexItemDeinit);
    // Main function that runs all tests
    int main(void) {
    printf("[INFO] Starting Vec.Complex tests\n\n");
    
    // Array of test functions
    
    // Run all tests using the centralized test driver
    return run_test_suite(tests, total_tests, NULL, 0, "Vec.Complex");
    }
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/Log.h>
    printf("Testing VecForeach where modification causes out of bounds access (should crash)\n");
    
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    printf("Testing VecForeachIdx where idx goes out of bounds (should crash)\n");
    
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    printf("Testing VecForeachReverseIdx where idx goes out of bounds (should crash)\n");
    
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    printf("Testing VecForeachPtrIdx where idx goes out of bounds (should crash)\n");
    
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    printf("Testing VecForeachPtrReverseIdx where idx goes out of bounds (should crash)\n");
    
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    printf("Testing VecForeachPtrInRangeIdx where idx goes out of bounds (should crash)\n");
    
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    printf("Testing basic VecForeachIdx where idx goes out of bounds (should crash)\n");
    
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    // Main function that runs all deadend tests
    int main(void) {
    printf("[INFO] Starting Vec.Foreach.Deadend tests\n\n");
    
    // Array of deadend test functions (tests that should crash)
    
    // Run all deadend tests using the centralized test driver
    return run_test_suite(NULL, 0, deadend_tests, deadend_count, "Vec.Foreach.Deadend");
    }
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/Log.h>
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Use centralized test driver (no more argc/argv needed)
    return run_test_suite(normal_tests, normal_count, NULL, 0, "Vec.Remove");
    }
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/Log.h>
    
    // Test with int type
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Test with struct type
    typedef Vec(TestItem) TestVec;
    TestVec test_vec = VecInit();
    
    // Test with int type and 4-byte alignment
    typedef Vec(int) IntVec;
    IntVec vec = VecInitAligned(4);
    
    // Test with struct type and 16-byte alignment
    typedef Vec(TestItem) TestVec;
    TestVec test_vec = VecInitAligned(16);
    
    // Test with struct type and custom copy/deinit functions
    typedef Vec(TestItem) TestVec;
    TestVec vec = VecInitWithDeepCopy(TestItemCopyInit, TestItemDeinit);
    
    // Test with struct type, custom copy/deinit functions, and 8-byte alignment
    typedef Vec(TestItem) TestVec;
    TestVec vec = VecInitAlignedWithDeepCopy(TestItemCopyInit, TestItemDeinit, 8);
    
    // Test with basic int type
    typedef Vec(int) IntVec;
    IntVec vec;
    
    // Test with struct type
    typedef Vec(TestItem) TestVec;
    TestVec test_vec;
    
    // Create a source vector
    typedef Vec(int) IntVec;
    IntVec src = VecInit();
    // Main function that runs all tests
    int main(void) {
    printf("[INFO] Starting Vec.Init tests\n\n");
    
    // Array of test functions
    
    // Run all tests using the centralized test driver
    return run_test_suite(tests, total_tests, NULL, 0, "Vec.Init");
    }
    #include <Misra/Std/Container/Vec.h>
    #include <Misra/Std/Log.h>
    #include <stdio.h>
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    
    // Create a vector of integers
    typedef Vec(int) IntVec;
    IntVec vec = VecInit();
    // Main function that runs all tests
    int main(void) {
    printf("[INFO] Starting Vec.Ops tests\n\n");
    
    // Array of test functions
    
    // Run all tests using the centralized test driver
    return run_test_suite(tests, total_tests, NULL, 0, "Vec.Ops");
    }

Share :