dte test coverage


Directory: ./
File: test/sizes.h
Date: 2025-09-07 23:01:39
Exec Total Coverage
Lines: 0 8 0.0%
Functions: 0 1 0.0%
Branches: 0 4 0.0%

Line Branch Exec Source
1 #ifndef TEST_SIZES_H
2 #define TEST_SIZES_H
3
4 #include "compiler.h"
5 #include "editor.h"
6 #include "editorconfig/editorconfig.h"
7 #include "editorconfig/ini.h"
8 #include "indent.h"
9 #include "load-save.h"
10 #include "selection.h"
11 #include "spawn.h"
12 #include "syntax/syntax.h"
13 #include "terminal/parse.h"
14 #include "terminal/terminal.h"
15 #include "ui.h"
16 #include "util/exitcode.h"
17 #include "util/string.h"
18
19 #define S(type) {#type, sizeof(type)}
20 #define DIVIDER {NULL, 0}
21
22 static const struct {
23 const char *name;
24 unsigned int size;
25 } ssizes[] = {
26 S(EditorState),
27 S(Buffer),
28 S(CommandLine),
29 S(ErrorBuffer),
30 S(FileHistory),
31 S(FileInfo),
32 S(FileLocksContext),
33 S(Frame),
34 S(GlobalOptions),
35 S(History),
36 S(LocalOptions),
37 S(MacroRecorder),
38 S(MessageList),
39 S(ModeHandler),
40 S(SearchState),
41 S(StyleMap),
42 S(SyntaxLoader),
43 S(TagFile),
44 S(TermInputBuffer),
45 S(TermOutputBuffer),
46 S(Terminal),
47 S(View),
48 S(Window),
49 DIVIDER,
50
51 S(Block),
52 S(BlockIter),
53 S(Change),
54 S(Command),
55 S(CommandArgs),
56 S(CommandRunner),
57 S(CommandSet),
58 S(Compiler),
59 S(CompletionState),
60 S(EditorConfigOptions),
61 S(ErrorFormat),
62 S(FileHistoryEntry),
63 S(FileLocation),
64 S(FileSaveContext),
65 S(HistoryEntry),
66 S(IndentInfo),
67 S(IniParser),
68 S(InternedRegexp),
69 S(Message),
70 S(ScreenState),
71 S(SelectionInfo),
72 S(SpawnContext),
73 S(Tag),
74 S(TermControlParams),
75 S(TermCursorStyle),
76 S(TermStyle),
77 DIVIDER,
78
79 S(Syntax),
80 S(State),
81 S(Condition),
82 S(ConditionData),
83 S(HeredocState),
84 S(StringList),
85 DIVIDER,
86 };
87
88 /*
89 For a list of typedef'd struct names, see:
90
91 make tags && readtags -lF '(if
92 (and (eq? $kind "t") (prefix? $typeref "struct"))
93 (list $name #t)
94 #f
95 )'
96 */
97
98 static inline ExitCode print_struct_sizes(void)
99 {
100 puts (
101 "\n"
102 "-----------------------------\n"
103 " Struct Size\n"
104 "-----------------------------"
105 );
106
107 for (size_t i = 0; i < ARRAYLEN(ssizes); i++) {
108 const char *name = ssizes[i].name;
109 if (name) {
110 printf(" %-20s %5u\n", name, ssizes[i].size);
111 } else {
112 putchar('\n');
113 }
114 }
115
116 return EC_OK;
117 }
118
119 #endif
120