Advent of Code

Check-in [85a490fa64]
Login

Check-in [85a490fa64]

Overview
Comment:added test file
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | TextGrid
Files: files | file ages | folders
SHA3-256: 85a490fa64058d9fc08be9eaaaff8ca86b2b564c4806c5ab9720d29089edf6ab
User & Date: nnz on 2024-12-08 13:53:50
Other Links: branch diff | manifest | tags
Context
2024-12-08
13:54
added test file Leaf check-in: d487b46741 user: nnz tags: TextGrid
13:53
added test file check-in: 85a490fa64 user: nnz tags: TextGrid
13:52
TextGrid looks ok check-in: d59f9c2e2f user: nnz tags: TextGrid
Changes

Added testtg.c version [d61466e43e].



























1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
#include <stdbool.h>
#include <stdio.h>
#include <string.h>

#include "aocutils.h"

int main(void) {
    char *input = NULL;
    size_t ilen = slurp(&input, "test.txt");

    struct TextGrid tg;
    tg.data = input;
    tg.cols = strchr(input, '\n') - input + 1;
    tg.rows = tg.cols - 1; // rows includes the '\n'

    if (*TGcharptr(&tg, 11, 11) == '.') puts("1");
    if (TGcharptr(&tg, 12, 11) == NULL) puts("2");
    if (TGcharptr(&tg, 11, 12) == NULL) puts("3");
    if (*TGcharptr(&tg, 11, 12) == '\n') puts("33");
    if (TGcharptr(&tg, -1, -2) == NULL) puts("4");

    for (int k = 0; k < 12; k++) {
        *TGcharptr(&tg, k, k) = '#';
    }
    printf("\n\n%s\n", tg.data);
}