<commit_before>/* test_MarkdownParseTest.c
 *
 * This file contains the implementation for the generated interface.
 *
 * Don't mess with the begin and end tags, since these will ensure that modified
 * code in interface functions isn't replaced when code is re-generated.
 */

#include "test.h"

/* $header() */

void test__countTree(cx_object o, size_t* count) {
    *count += 1;
    cx_objectseq oseq = cx_scopeClaim(o);
    // if (oseq.length) { // otherwise it segfaults
        {
            cx_objectseqForeach(oseq, child) {
                test__countTree(child, count);
            }
        }
    // }
    cx_scopeRelease(oseq);
}

size_t test_countTree(cx_object o) {
    size_t count = 0;
    test__countTree(o, &count);
    return count;
}

/* $end */

/* ::test::MarkdownParseTest::testDeeperHierarchy1() */
cx_void _test_MarkdownParseTest_testDeeperHierarchy1(test_MarkdownParseTest this) {
/* $begin(::test::MarkdownParseTest::testDeeperHierarchy1) */
    char text[] =
        "# test::Package3\n"
        "## Class0\n"
        "### method0\n"
        "## Class1\n"
        "### method0\n"
        "# test::Package3::Package0\n"
        "# test::Package3::Package0::Package0\n"
        ;
    md_parse(test_docs_o, text);
    test_assert(test_countTree(test_docs_o) == 9);
    {
        cx_object o;
        test_assert((o = cx_resolve(test_docs_o, "test::Package3")) != NULL);
        test_assert(cx_instanceof(cx_type(md_PackageDoc_o), o));
        test_assert(md_Doc(o)->o == test_Package3_o);
    }<commit_msg>Removed unnecessary comment<commit_after>/* test_MarkdownParseTest.c
 *
 * This file contains the implementation for the generated interface.
 *
 * Don't mess with the begin and end tags, since these will ensure that modified
 * code in interface functions isn't replaced when code is re-generated.
 */

#include "test.h"

/* $header() */

void test__countTree(cx_object o, size_t* count) {
    *count += 1;
    cx_objectseq oseq = cx_scopeClaim(o);
    {
        cx_objectseqForeach(oseq, child) {
            test__countTree(child, count);
        }
    }
    cx_scopeRelease(oseq);
}

size_t test_countTree(cx_object o) {
    size_t count = 0;
    test__countTree(o, &count);
    return count;
}

/* $end */

/* ::test::MarkdownParseTest::testDeeperHierarchy1() */
cx_void _test_MarkdownParseTest_testDeeperHierarchy1(test_MarkdownParseTest this) {
/* $begin(::test::MarkdownParseTest::testDeeperHierarchy1) */
    char text[] =
        "# test::Package3\n"
        "## Class0\n"
        "### method0\n"
        "## Class1\n"
        "### method0\n"
        "# test::Package3::Package0\n"
        "# test::Package3::Package0::Package0\n"
        ;
    md_parse(test_docs_o, text);
    test_assert(test_countTree(test_docs_o) == 9);
    {
        cx_object o;
        test_assert((o = cx_resolve(test_docs_o, "test::Package3")) != NULL);
        test_assert(cx_instanceof(cx_type(md_PackageDoc_o), o));
        test_assert(md_Doc(o)->o == test_Package3_o);
    }
{'fraction_non_alphanumeric': 0.1365609348914858, 'fraction_numerical': 0.012020033388981636, 'mean_word_length': 3.0817438692098094, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6266063', 'n_tokens_mistral': 1041, 'n_tokens_neox': 1027, 'n_words': 191}