Skip to content

Strs

Strs

Description

Vector of strings

Usage example (Cross-references)

Usage examples (Cross-references)
    }
    
    Strs StrSplit(Str *s, const char *key) {
        ValidateStr(s);
        ValidateStr(s);
    
        Strs sv     = VecInitWithDeepCopy(NULL, StrDeinit);
        size keylen = ZstrLen(key);
    }
    
    void ValidateStrs(const Strs *vs) {
        ValidateVec(vs);
        VecForeachPtr(vs, sp) {
    typedef struct Project {
        Str  build_dir;
        Strs source_directories;
        Strs test_directories;
    } Project;
        Str  build_dir;
        Strs source_directories;
        Strs test_directories;
    } Project;
    
            // recursively explore directories and get files that need documentation
            Strs file_paths = VecInit();
            Scope(&file_paths, VecDeinit, {
                // temporary vector to store all directory paths to explore files in
            Scope(&file_paths, VecDeinit, {
                // temporary vector to store all directory paths to explore files in
                Strs dir_paths = VecInitWithDeepCopy(NULL, StrDeinit);
                Scope(&dir_paths, VecDeinit, {
                    VecMerge(&dir_paths, &project.source_directories);
        Str file = StrInit();
        if (ReadCompleteFile("Bin/Demangler/CppNameManglingGrammar", &file.data, &file.length, &file.capacity)) {
            Strs lines = StrSplit(&file, "\n");
    
            // Use the fixed VecForeachPtr macro
    // Test Strs type definition
    bool test_strs_type(void) {
        WriteFmt("Testing Strs type definition\n");
    
        // Create a Strs object (vector of strings)
    
        // Create a Strs object (vector of strings)
        Strs sv = VecInitWithDeepCopy(NULL, StrDeinit);
    
        // Add some strings
    
        // Create a valid Strs
        Strs sv = VecInit();
    
        // This should not crash
    // Deadend test: Test ValidateStrs with invalid Strs (should crash/abort)
    bool test_validate_invalid_strs(void) {
        WriteFmt("Testing ValidateStrs with invalid Strs (should abort)\n");
    
        // Create an invalid Strs by corrupting its fields
    
        // Create an invalid Strs by corrupting its fields
        Strs sv = VecInit();
    
        // Corrupt the vector to make it invalid
        // Test StrSplit
        Str  s     = StrInitFromZstr("Hello,World,Test");
        Strs split = StrSplit(&s, ",");
    
        bool result = (split.length == 3);
        /// FAILURE : Strs vector of zero-length
        ///
        Strs StrSplit(Str *s, const char *key);
    
        //
    /// FAILURE: `abort`
    ///
    void ValidateStrs(const Strs *vs);
    
Last updated on