assassinlike commited on
Commit
9cf6690
·
verified ·
1 Parent(s): 76f9b80

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. data/miniconda3/include/ImageMagick-7/Magick++.h +25 -0
  2. data/miniconda3/include/graphite2/Font.h +389 -0
  3. data/miniconda3/include/graphite2/Log.h +85 -0
  4. data/miniconda3/include/graphite2/Segment.h +461 -0
  5. data/miniconda3/include/graphite2/Types.h +79 -0
  6. data/miniconda3/include/graphviz/arith.h +73 -0
  7. data/miniconda3/include/graphviz/cdt.h +283 -0
  8. data/miniconda3/include/graphviz/cgraph.h +491 -0
  9. data/miniconda3/include/graphviz/color.h +47 -0
  10. data/miniconda3/include/graphviz/geom.h +80 -0
  11. data/miniconda3/include/graphviz/graphviz_version.h +9 -0
  12. data/miniconda3/include/graphviz/gv.cpp +739 -0
  13. data/miniconda3/include/graphviz/gv.i +245 -0
  14. data/miniconda3/include/graphviz/gvc.h +128 -0
  15. data/miniconda3/include/graphviz/gvcext.h +50 -0
  16. data/miniconda3/include/graphviz/gvcjob.h +373 -0
  17. data/miniconda3/include/graphviz/gvcommon.h +35 -0
  18. data/miniconda3/include/graphviz/gvconfig.h +27 -0
  19. data/miniconda3/include/graphviz/gvplugin.h +58 -0
  20. data/miniconda3/include/graphviz/gvplugin_device.h +29 -0
  21. data/miniconda3/include/graphviz/gvplugin_layout.h +28 -0
  22. data/miniconda3/include/graphviz/gvplugin_loadimage.h +45 -0
  23. data/miniconda3/include/graphviz/gvplugin_render.h +59 -0
  24. data/miniconda3/include/graphviz/gvplugin_textlayout.h +29 -0
  25. data/miniconda3/include/graphviz/gvpr.h +74 -0
  26. data/miniconda3/include/graphviz/pack.h +99 -0
  27. data/miniconda3/include/graphviz/pathgeom.h +61 -0
  28. data/miniconda3/include/graphviz/pathplan.h +57 -0
  29. data/miniconda3/include/graphviz/textspan.h +74 -0
  30. data/miniconda3/include/graphviz/types.h +619 -0
  31. data/miniconda3/include/graphviz/usershape.h +65 -0
  32. data/miniconda3/include/graphviz/xdot.h +187 -0
  33. data/miniconda3/include/gtest/gtest-death-test.h +346 -0
  34. data/miniconda3/include/gtest/gtest-matchers.h +930 -0
  35. data/miniconda3/include/gtest/gtest-message.h +219 -0
  36. data/miniconda3/include/gtest/gtest-param-test.h +507 -0
  37. data/miniconda3/include/gtest/gtest-spi.h +238 -0
  38. data/miniconda3/include/gtest/gtest-test-part.h +184 -0
  39. data/miniconda3/include/gtest/gtest-typed-test.h +329 -0
  40. data/miniconda3/include/gtest/gtest.h +2495 -0
  41. data/miniconda3/include/gtest/gtest_pred_impl.h +359 -0
  42. data/miniconda3/include/gtest/gtest_prod.h +61 -0
  43. data/miniconda3/include/nghttp2/nghttp2.h +0 -0
  44. data/miniconda3/include/nghttp2/nghttp2ver.h +42 -0
  45. data/miniconda3/include/reproc++/arguments.hpp +59 -0
  46. data/miniconda3/include/reproc++/drain.hpp +152 -0
  47. data/miniconda3/include/reproc++/env.hpp +76 -0
  48. data/miniconda3/include/reproc++/export.hpp +21 -0
  49. data/miniconda3/include/reproc++/input.hpp +37 -0
  50. data/miniconda3/include/reproc++/reproc.hpp +223 -0
data/miniconda3/include/ImageMagick-7/Magick++.h ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // This may look like C code, but it is really -*- C++ -*-
2
+ //
3
+ // Copyright Bob Friesenhahn, 1999, 2000
4
+ //
5
+ // Copyright @ 2013 ImageMagick Studio LLC, a non-profit organization
6
+ // dedicated to making software imaging solutions freely available.
7
+ //
8
+ // Simplified includes for Magick++.
9
+ // Inclusion of this header is sufficient to use all Magick++ APIs.
10
+ //
11
+ #ifndef MagickPlusPlus_Header
12
+ #include <Magick++/Include.h>
13
+ #include <Magick++/Functions.h>
14
+ #include <Magick++/Image.h>
15
+ #include <Magick++/Pixels.h>
16
+ #include <Magick++/ResourceLimits.h>
17
+ #include <Magick++/STL.h>
18
+
19
+ // Don't leak our definition of the 'restrict' keyword. 'restrict' is a valid
20
+ // identifier in C++, and leaking it could cause extraneous build failures.
21
+ #ifdef restrict
22
+ #undef restrict
23
+ #endif
24
+ #define MagickPlusPlus_Header
25
+ #endif // MagickPlusPlus_Header
data/miniconda3/include/graphite2/Font.h ADDED
@@ -0,0 +1,389 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* GRAPHITE2 LICENSING
2
+
3
+ Copyright 2010, SIL International
4
+ All rights reserved.
5
+
6
+ This library is free software; you can redistribute it and/or modify
7
+ it under the terms of the GNU Lesser General Public License as published
8
+ by the Free Software Foundation; either version 2.1 of License, or
9
+ (at your option) any later version.
10
+
11
+ This program is distributed in the hope that it will be useful,
12
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ Lesser General Public License for more details.
15
+
16
+ You should also have received a copy of the GNU Lesser General Public
17
+ License along with this library in the file named "LICENSE".
18
+ If not, write to the Free Software Foundation, 51 Franklin Street,
19
+ Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
20
+ internet at http://www.fsf.org/licenses/lgpl.html.
21
+
22
+ Alternatively, the contents of this file may be used under the terms
23
+ of the Mozilla Public License (http://mozilla.org/MPL) or the GNU
24
+ General Public License, as published by the Free Software Foundation,
25
+ either version 2 of the License or (at your option) any later version.
26
+ */
27
+ #pragma once
28
+
29
+ #include "graphite2/Types.h"
30
+
31
+ #define GR2_VERSION_MAJOR 1
32
+ #define GR2_VERSION_MINOR 3
33
+ #define GR2_VERSION_BUGFIX 14
34
+
35
+ #ifdef __cplusplus
36
+ extern "C"
37
+ {
38
+ #endif
39
+
40
+ typedef struct gr_face gr_face;
41
+ typedef struct gr_font gr_font;
42
+ typedef struct gr_feature_ref gr_feature_ref;
43
+ typedef struct gr_feature_val gr_feature_val;
44
+
45
+ /**
46
+ * Returns version information on this engine
47
+ */
48
+ GR2_API void gr_engine_version(int *nMajor, int *nMinor, int *nBugFix);
49
+
50
+ /**
51
+ * The Face Options allow the application to require that certain tables are
52
+ * read during face construction. This may be of concern if the appFaceHandle
53
+ * used in the gr_get_table_fn may change.
54
+ * The values can be combined
55
+ */
56
+ enum gr_face_options {
57
+ /** No preload, no cmap caching, fail if the graphite tables are invalid */
58
+ gr_face_default = 0,
59
+ /** Dumb rendering will be enabled if the graphite tables are invalid. @deprecated Since 1.311 */
60
+ gr_face_dumbRendering = 1,
61
+ /** preload glyphs at construction time */
62
+ gr_face_preloadGlyphs = 2,
63
+ /** Cache the lookup from code point to glyph ID at construction time */
64
+ gr_face_cacheCmap = 4,
65
+ /** Preload everything */
66
+ gr_face_preloadAll = gr_face_preloadGlyphs | gr_face_cacheCmap
67
+ };
68
+
69
+ /** Holds information about a particular Graphite silf table that has been loaded */
70
+ struct gr_faceinfo {
71
+ gr_uint16 extra_ascent; /**< The extra_ascent in the GDL, in design units */
72
+ gr_uint16 extra_descent; /**< The extra_descent in the GDL, in design units */
73
+ gr_uint16 upem; /**< The design units for the font */
74
+ enum gr_space_contextuals {
75
+ gr_space_unknown = 0, /**< no information is known. */
76
+ gr_space_none = 1, /**< the space character never occurs in any rules. */
77
+ gr_space_left_only = 2, /**< the space character only occurs as the first element in a rule. */
78
+ gr_space_right_only = 3, /**< the space character only occurs as the last element in a rule. */
79
+ gr_space_either_only = 4, /**< the space character only occurs as the only element in a rule. */
80
+ gr_space_both = 5, /**< the space character may occur as the first or last element of a rule. */
81
+ gr_space_cross = 6 /**< the space character occurs in a rule not as a first or last element. */
82
+ } space_contextuals;
83
+ unsigned int has_bidi_pass : 1; /**< the table specifies that a bidirectional pass should run */
84
+ unsigned int line_ends : 1; /**< there are line end contextuals somewhere */
85
+ unsigned int justifies : 1; /**< there are .justify properties set somewhere on some glyphs */
86
+ };
87
+
88
+ typedef struct gr_faceinfo gr_faceinfo;
89
+
90
+ /** type describing function to retrieve font table information
91
+ *
92
+ * @return a pointer to the table in memory. The pointed to memory must exist as
93
+ * long as the gr_face which makes the call.
94
+ * @param appFaceHandle is the unique information passed to gr_make_face()
95
+ * @param name is a 32bit tag to the table name.
96
+ * @param len returned by this function to say how long the table is in memory.
97
+ */
98
+ typedef const void *(*gr_get_table_fn)(const void* appFaceHandle, unsigned int name, size_t *len);
99
+
100
+ /** type describing function to release any resources allocated by the above get_table table function
101
+ *
102
+ * @param appFaceHandle is the unique information passed to gr_make_face()
103
+ * @param pointer to table memory returned by get_table.
104
+ */
105
+ typedef void (*gr_release_table_fn)(const void* appFaceHandle, const void *table_buffer);
106
+
107
+ /** struct housing function pointers to manage font table buffers for the graphite engine. */
108
+ struct gr_face_ops
109
+ {
110
+ /** size in bytes of this structure */
111
+ size_t size;
112
+ /** a pointer to a function to request a table from the client. */
113
+ gr_get_table_fn get_table;
114
+ /** is a pointer to a function to notify the client the a table can be released.
115
+ * This can be NULL to signify that the client does not wish to do any release handling. */
116
+ gr_release_table_fn release_table;
117
+ };
118
+ typedef struct gr_face_ops gr_face_ops;
119
+
120
+ /** Create a gr_face object given application information and a table functions.
121
+ *
122
+ * @return gr_face or NULL if the font fails to load for some reason.
123
+ * @param appFaceHandle This is application specific information that is passed
124
+ * to the getTable function. The appFaceHandle must stay
125
+ * alive as long as the gr_face is alive.
126
+ * @param face_ops Pointer to face specific callback structure for table
127
+ * management. Must stay alive for the duration of the
128
+ * call only.
129
+ * @param faceOptions Bitfield describing various options. See enum gr_face_options for details.
130
+ */
131
+ GR2_API gr_face* gr_make_face_with_ops(const void* appFaceHandle/*non-NULL*/, const gr_face_ops *face_ops, unsigned int faceOptions);
132
+
133
+ /** @deprecated Since v1.2.0 in favour of gr_make_face_with_ops.
134
+ * Create a gr_face object given application information and a getTable function.
135
+ *
136
+ * @return gr_face or NULL if the font fails to load for some reason.
137
+ * @param appFaceHandle This is application specific information that is passed
138
+ * to the getTable function. The appFaceHandle must stay
139
+ * alive as long as the gr_face is alive.
140
+ * @param getTable Callback function to get table data.
141
+ * @param faceOptions Bitfield describing various options. See enum gr_face_options for details.
142
+ */
143
+ GR2_DEPRECATED_API gr_face* gr_make_face(const void* appFaceHandle/*non-NULL*/, gr_get_table_fn getTable, unsigned int faceOptions);
144
+
145
+ /** @deprecated Since 1.3.7 this function is now an alias for gr_make_face_with_ops().
146
+ *
147
+ * Create a gr_face object given application information, with subsegmental caching support
148
+ *
149
+ * @return gr_face or NULL if the font fails to load.
150
+ * @param appFaceHandle is a pointer to application specific information that is passed to getTable.
151
+ * This may not be NULL and must stay alive as long as the gr_face is alive.
152
+ * @param face_ops Pointer to face specific callback structure for table management. Must stay
153
+ * alive for the duration of the call only.
154
+ * @param segCacheMaxSize Unused.
155
+ * @param faceOptions Bitfield of values from enum gr_face_options
156
+ */
157
+ GR2_DEPRECATED_API gr_face* gr_make_face_with_seg_cache_and_ops(const void* appFaceHandle, const gr_face_ops *face_ops, unsigned int segCacheMaxSize, unsigned int faceOptions);
158
+
159
+ /** @deprecated Since 1.3.7 this function is now an alias for gr_make_face().
160
+ *
161
+ * Create a gr_face object given application information, with subsegmental caching support.
162
+ * This function is deprecated as of v1.2.0 in favour of gr_make_face_with_seg_cache_and_ops.
163
+ *
164
+ * @return gr_face or NULL if the font fails to load.
165
+ * @param appFaceHandle is a pointer to application specific information that is passed to getTable.
166
+ * This may not be NULL and must stay alive as long as the gr_face is alive.
167
+ * @param getTable The function graphite calls to access font table data
168
+ * @param segCacheMaxSize How large the segment cache is.
169
+ * @param faceOptions Bitfield of values from enum gr_face_options
170
+ */
171
+ GR2_DEPRECATED_API gr_face* gr_make_face_with_seg_cache(const void* appFaceHandle, gr_get_table_fn getTable, unsigned int segCacheMaxSize, unsigned int faceOptions);
172
+
173
+ /** Convert a tag in a string into a gr_uint32
174
+ *
175
+ * @return gr_uint32 tag, zero padded
176
+ * @param str a nul terminated string of which at most the first 4 characters are read
177
+ */
178
+ GR2_API gr_uint32 gr_str_to_tag(const char *str);
179
+
180
+ /** Convert a gr_uint32 tag into a string
181
+ *
182
+ * @param tag contains the tag to convert
183
+ * @param str is a pointer to a char array of at least size 4 bytes. The first 4 bytes of this array
184
+ * will be overwritten by this function. No nul is appended.
185
+ */
186
+ GR2_API void gr_tag_to_str(gr_uint32 tag, char *str);
187
+
188
+ /** Get feature values for a given language or default
189
+ *
190
+ * @return a copy of the default feature values for a given language. The application must call
191
+ * gr_featureval_destroy() to free this object when done.
192
+ * @param pFace The font face to get feature values from
193
+ * @param langname The language tag to get feature values for. If there is no such language or
194
+ * langname is 0, the default feature values for the font are returned.
195
+ * langname is right 0 padded and assumes lowercase. Thus the en langauge
196
+ * would be 0x656E0000. Langname may also be space padded, thus 0x656E2020.
197
+ */
198
+ GR2_API gr_feature_val* gr_face_featureval_for_lang(const gr_face* pFace, gr_uint32 langname);
199
+
200
+ /** Get feature reference for a given feature id from a face
201
+ *
202
+ * @return a feature reference corresponding to the given id. This data is part of the gr_face and
203
+ * will be freed when the face is destroyed.
204
+ * @param pFace Font face to get information on.
205
+ * @param featId Feature id tag to get reference to.
206
+ */
207
+ GR2_API const gr_feature_ref* gr_face_find_fref(const gr_face* pFace, gr_uint32 featId);
208
+
209
+ /** Returns number of feature references in a face **/
210
+ GR2_API gr_uint16 gr_face_n_fref(const gr_face* pFace);
211
+
212
+ /** Returns feature reference at given index in face **/
213
+ GR2_API const gr_feature_ref* gr_face_fref(const gr_face* pFace, gr_uint16 i);
214
+
215
+ /** Return number of languages the face knows about **/
216
+ GR2_API unsigned short gr_face_n_languages(const gr_face* pFace);
217
+
218
+ /** Returns a language id corresponding to a language of given index in the face **/
219
+ GR2_API gr_uint32 gr_face_lang_by_index(const gr_face* pFace, gr_uint16 i);
220
+
221
+ /** Destroy the given face and free its memory **/
222
+ GR2_API void gr_face_destroy(gr_face *face);
223
+
224
+ /** Returns the number of glyphs in the face **/
225
+ GR2_API unsigned short gr_face_n_glyphs(const gr_face* pFace);
226
+
227
+ /** Returns a faceinfo for the face and script **/
228
+ GR2_API const gr_faceinfo *gr_face_info(const gr_face *pFace, gr_uint32 script);
229
+
230
+ /** Returns whether the font supports a given Unicode character
231
+ *
232
+ * @return true if the character is supported.
233
+ * @param pFace face to test within
234
+ * @param usv Unicode Scalar Value of character to test
235
+ * @param script Tag of script for selecting which set of pseudo glyphs to test. May be NULL.
236
+ */
237
+ GR2_API int gr_face_is_char_supported(const gr_face *pFace, gr_uint32 usv, gr_uint32 script);
238
+
239
+ #ifndef GRAPHITE2_NFILEFACE
240
+ /** Create gr_face from a font file
241
+ *
242
+ * @return gr_face that accesses a font file directly. Returns NULL on failure.
243
+ * @param filename Full path and filename to font file
244
+ * @param faceOptions Bitfile from enum gr_face_options to control face options.
245
+ */
246
+ GR2_API gr_face* gr_make_file_face(const char *filename, unsigned int faceOptions);
247
+
248
+ /** @deprecated Since 1.3.7. This function is now an alias for gr_make_file_face().
249
+ *
250
+ * Create gr_face from a font file, with subsegment caching support.
251
+ *
252
+ * @return gr_face that accesses a font file directly. Returns NULL on failure.
253
+ * @param filename Full path and filename to font file
254
+ * @param segCacheMaxSize Specifies how big to make the cache in segments.
255
+ * @param faceOptions Bitfield from enum gr_face_options to control face options.
256
+ */
257
+ GR2_DEPRECATED_API gr_face* gr_make_file_face_with_seg_cache(const char *filename, unsigned int segCacheMaxSize, unsigned int faceOptions);
258
+ #endif // !GRAPHITE2_NFILEFACE
259
+
260
+ /** Create a font from a face
261
+ *
262
+ * @return gr_font Call font_destroy to free this font
263
+ * @param ppm Resolution of the font in pixels per em
264
+ * @param face Face this font corresponds to. This must stay alive as long as the font is alive.
265
+ */
266
+ GR2_API gr_font* gr_make_font(float ppm, const gr_face *face);
267
+
268
+ /** query function to find the hinted advance of a glyph
269
+ *
270
+ * @param appFontHandle is the unique information passed to gr_make_font_with_advance()
271
+ * @param glyphid is the glyph to retireve the hinted advance for.
272
+ */
273
+ typedef float (*gr_advance_fn)(const void* appFontHandle, gr_uint16 glyphid);
274
+
275
+ /** struct housing function pointers to manage font hinted metrics for the
276
+ * graphite engine. */
277
+ struct gr_font_ops
278
+ {
279
+ /** size of the structure in bytes to allow for future extensibility */
280
+ size_t size;
281
+ /** a pointer to a function to retrieve the hinted
282
+ * advance width of a glyph which the font cannot
283
+ * provide without client assistance. This can be
284
+ * NULL to signify no horizontal hinted metrics are necessary. */
285
+ gr_advance_fn glyph_advance_x;
286
+ /** a pointer to a function to retrieve the hinted
287
+ * advance height of a glyph which the font cannot
288
+ * provide without client assistance. This can be
289
+ * NULL to signify no horizontal hinted metrics are necessary. */
290
+ gr_advance_fn glyph_advance_y;
291
+ };
292
+ typedef struct gr_font_ops gr_font_ops;
293
+
294
+ /** Creates a font with hinted advance width query functions
295
+ *
296
+ * @return gr_font to be destroyed via font_destroy
297
+ * @param ppm size of font in pixels per em
298
+ * @param appFontHandle font specific information that must stay alive as long
299
+ * as the font does
300
+ * @param font_ops pointer font specific callback structure for hinted metrics.
301
+ * Need only stay alive for the duration of the call.
302
+ * @param face the face this font corresponds to. Must stay alive as long as
303
+ * the font does.
304
+ */
305
+ GR2_API gr_font* gr_make_font_with_ops(float ppm, const void* appFontHandle, const gr_font_ops * font_ops, const gr_face *face);
306
+
307
+ /** Creates a font with hinted advance width query function.
308
+ * This function is deprecated. Use gr_make_font_with_ops instead.
309
+ *
310
+ * @return gr_font to be destroyed via font_destroy
311
+ * @param ppm size of font in pixels per em
312
+ * @param appFontHandle font specific information that must stay alive as long
313
+ * as the font does
314
+ * @param getAdvance callback function reference that returns horizontal advance in pixels for a glyph.
315
+ * @param face the face this font corresponds to. Must stay alive as long as
316
+ * the font does.
317
+ */
318
+ GR2_API gr_font* gr_make_font_with_advance_fn(float ppm, const void* appFontHandle, gr_advance_fn getAdvance, const gr_face *face);
319
+
320
+ /** Free a font **/
321
+ GR2_API void gr_font_destroy(gr_font *font);
322
+
323
+ /** get a feature value
324
+ *
325
+ * @return value of specific feature or 0 if any problems.
326
+ * @param pfeatureref gr_feature_ref to the feature
327
+ * @param feats gr_feature_val containing all the values
328
+ */
329
+ GR2_API gr_uint16 gr_fref_feature_value(const gr_feature_ref* pfeatureref, const gr_feature_val* feats);
330
+
331
+ /** set a feature value
332
+ *
333
+ * @return false if there were any problems (value out of range, etc.)
334
+ * @param pfeatureref gr_feature_ref to the feature
335
+ * @param val value to set the feature to
336
+ * @param pDest the gr_feature_val containing all the values for all the features
337
+ */
338
+ GR2_API int gr_fref_set_feature_value(const gr_feature_ref* pfeatureref, gr_uint16 val, gr_feature_val* pDest);
339
+
340
+ /** Returns the id tag for a gr_feature_ref **/
341
+ GR2_API gr_uint32 gr_fref_id(const gr_feature_ref* pfeatureref);
342
+
343
+ /** Returns number of values a feature may take, given a gr_feature_ref **/
344
+ GR2_API gr_uint16 gr_fref_n_values(const gr_feature_ref* pfeatureref);
345
+
346
+ /** Returns the value associated with a particular value in a feature
347
+ *
348
+ * @return value
349
+ * @param pfeatureref gr_feature_ref of the feature of interest
350
+ * @param settingno Index up to the return value of gr_fref_n_values() of the value
351
+ */
352
+ GR2_API gr_int16 gr_fref_value(const gr_feature_ref* pfeatureref, gr_uint16 settingno);
353
+
354
+ /** Returns a string of the UI name of a feature
355
+ *
356
+ * @return string of the UI name, in the encoding form requested. Call gr_label_destroy() after use.
357
+ * @param pfeatureref gr_feature_ref of the feature
358
+ * @param langId This is a pointer since the face may not support a string in the requested
359
+ * language. The actual language of the string is returned in langId
360
+ * @param utf Encoding form for the string
361
+ * @param length Used to return the length of the string returned in bytes.
362
+ */
363
+ GR2_API void* gr_fref_label(const gr_feature_ref* pfeatureref, gr_uint16 *langId, enum gr_encform utf, gr_uint32 *length);
364
+
365
+ /** Return a UI string for a possible value of a feature
366
+ *
367
+ * @return string of the UI name, in the encoding form requested. nul terminated. Call gr_label_destroy()
368
+ * after use.
369
+ * @param pfeatureref gr_feature_ref of the feature
370
+ * @param settingno Value setting index
371
+ * @param langId This is a pointer to the requested language. The requested language id is
372
+ * replaced by the actual language id of the string returned.
373
+ * @param utf Encoding form for the string
374
+ * @param length Returns the length of the string returned in bytes.
375
+ */
376
+ GR2_API void* gr_fref_value_label(const gr_feature_ref* pfeatureref, gr_uint16 settingno/*rather than a value*/, gr_uint16 *langId, enum gr_encform utf, gr_uint32 *length);
377
+
378
+ /** Destroy a previously returned label string **/
379
+ GR2_API void gr_label_destroy(void * label);
380
+
381
+ /** Copies a gr_feature_val **/
382
+ GR2_API gr_feature_val* gr_featureval_clone(const gr_feature_val* pfeatures);
383
+
384
+ /** Destroys a gr_feature_val **/
385
+ GR2_API void gr_featureval_destroy(gr_feature_val *pfeatures);
386
+
387
+ #ifdef __cplusplus
388
+ }
389
+ #endif
data/miniconda3/include/graphite2/Log.h ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* GRAPHITE2 LICENSING
2
+
3
+ Copyright 2010, SIL International
4
+ All rights reserved.
5
+
6
+ This library is free software; you can redistribute it and/or modify
7
+ it under the terms of the GNU Lesser General Public License as published
8
+ by the Free Software Foundation; either version 2.1 of License, or
9
+ (at your option) any later version.
10
+
11
+ This program is distributed in the hope that it will be useful,
12
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ Lesser General Public License for more details.
15
+
16
+ You should also have received a copy of the GNU Lesser General Public
17
+ License along with this library in the file named "LICENSE".
18
+ If not, write to the Free Software Foundation, 51 Franklin Street,
19
+ Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
20
+ internet at http://www.fsf.org/licenses/lgpl.html.
21
+
22
+ Alternatively, the contents of this file may be used under the terms
23
+ of the Mozilla Public License (http://mozilla.org/MPL) or the GNU
24
+ General Public License, as published by the Free Software Foundation,
25
+ either version 2 of the License or (at your option) any later version.
26
+ */
27
+ #pragma once
28
+
29
+ #include <graphite2/Types.h>
30
+ #include <graphite2/Font.h>
31
+ #include <stdio.h>
32
+
33
+ #ifdef __cplusplus
34
+ extern "C"
35
+ {
36
+ #endif
37
+
38
+ /** deprecated mechanism that doesn't do anything now. */
39
+ typedef enum {
40
+ GRLOG_NONE = 0x0,
41
+ GRLOG_FACE = 0x01,
42
+ GRLOG_SEGMENT = 0x02,
43
+ GRLOG_PASS = 0x04,
44
+ GRLOG_CACHE = 0x08,
45
+
46
+ GRLOG_OPCODE = 0x80,
47
+ GRLOG_ALL = 0xFF
48
+ } GrLogMask;
49
+
50
+ /** Start logging all segment creation and updates on the provided face. This
51
+ * is logged to a JSON file, see "Segment JSON Schema.txt" for a precise
52
+ * definition of the file
53
+ *
54
+ * @return true if the file was successfully created and logging is correctly
55
+ * initialised.
56
+ * @param face the gr_face whose segments you want to log to the given file
57
+ * @param log_path a utf8 encoded file name and path to log to.
58
+ */
59
+ GR2_API bool gr_start_logging(gr_face * face, const char *log_path);
60
+
61
+
62
+ /** Stop logging on the given face. This will close the log file created by
63
+ * gr_start_logging.
64
+ *
65
+ * @param face the gr_face whose segments you want to stop logging
66
+ */
67
+ GR2_API void gr_stop_logging(gr_face * face);
68
+
69
+ /** Start logging to a FILE object.
70
+ * This function is deprecated as of 1.2.0, use the _face versions instead.
71
+ *
72
+ * @return True on success
73
+ * @param logfile FILE reference to output logging to
74
+ * @param mask What aspects of logging to report (ignored)
75
+ */
76
+ GR2_API bool graphite_start_logging(FILE * logFile, GrLogMask mask); //may not do anthing if disabled in the implementation of the engine.
77
+
78
+ /** Stop logging to a FILE object.
79
+ * This function is deprecated as of 1.2.0, use the _face versions instead.
80
+ */
81
+ GR2_API void graphite_stop_logging();
82
+
83
+ #ifdef __cplusplus
84
+ }
85
+ #endif
data/miniconda3/include/graphite2/Segment.h ADDED
@@ -0,0 +1,461 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* GRAPHITE2 LICENSING
2
+
3
+ Copyright 2010, SIL International
4
+ All rights reserved.
5
+
6
+ This library is free software; you can redistribute it and/or modify
7
+ it under the terms of the GNU Lesser General Public License as published
8
+ by the Free Software Foundation; either version 2.1 of License, or
9
+ (at your option) any later version.
10
+
11
+ This program is distributed in the hope that it will be useful,
12
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ Lesser General Public License for more details.
15
+
16
+ You should also have received a copy of the GNU Lesser General Public
17
+ License along with this library in the file named "LICENSE".
18
+ If not, write to the Free Software Foundation, 51 Franklin Street,
19
+ Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
20
+ internet at http://www.fsf.org/licenses/lgpl.html.
21
+
22
+ Alternatively, the contents of this file may be used under the terms
23
+ of the Mozilla Public License (http://mozilla.org/MPL) or the GNU
24
+ General Public License, as published by the Free Software Foundation,
25
+ either version 2 of the License or (at your option) any later version.
26
+ */
27
+ #pragma once
28
+
29
+ #include "graphite2/Types.h"
30
+ #include "graphite2/Font.h"
31
+
32
+ #ifdef __cplusplus
33
+ extern "C"
34
+ {
35
+ #endif
36
+
37
+ enum gr_break_weight {
38
+ gr_breakNone = 0,
39
+ /* after break weights */
40
+ gr_breakWhitespace = 10,
41
+ gr_breakWord = 15,
42
+ gr_breakIntra = 20,
43
+ gr_breakLetter = 30,
44
+ gr_breakClip = 40,
45
+ /* before break weights */
46
+ gr_breakBeforeWhitespace = -10,
47
+ gr_breakBeforeWord = -15,
48
+ gr_breakBeforeIntra = -20,
49
+ gr_breakBeforeLetter = -30,
50
+ gr_breakBeforeClip = -40
51
+ };
52
+
53
+ enum gr_justFlags {
54
+ /// Indicates that this segment is a complete line
55
+ gr_justCompleteLine = 0,
56
+ /// Indicates that the start of the slot list is not at the start of a line
57
+ gr_justStartInline = 1,
58
+ /// Indicates that the end of the slot list is not at the end of a line
59
+ gr_justEndInline = 2
60
+ };
61
+
62
+ /** Used for looking up slot attributes. Most are already available in other functions **/
63
+ enum gr_attrCode {
64
+ /// adjusted glyph advance in x direction in design units
65
+ gr_slatAdvX = 0,
66
+ /// adjusted glyph advance in y direction (usually 0) in design units
67
+ gr_slatAdvY,
68
+ /// returns 0. Deprecated.
69
+ gr_slatAttTo,
70
+ /// This slot attaches to its parent at the given design units in the x direction
71
+ gr_slatAttX,
72
+ /// This slot attaches to its parent at the given design units in the y direction
73
+ gr_slatAttY,
74
+ /// This slot attaches to its parent at the given glyph point (not implemented)
75
+ gr_slatAttGpt,
76
+ /// x-direction adjustment from the given glyph point (not implemented)
77
+ gr_slatAttXOff,
78
+ /// y-direction adjustment from the given glyph point (not implemented)
79
+ gr_slatAttYOff,
80
+ /// Where on this glyph should align with the attachment point on the parent glyph in the x-direction.
81
+ gr_slatAttWithX,
82
+ /// Where on this glyph should align with the attachment point on the parent glyph in the y-direction
83
+ gr_slatAttWithY,
84
+ /// Which glyph point on this glyph should align with the attachment point on the parent glyph (not implemented).
85
+ gr_slatWithGpt,
86
+ /// Adjustment to gr_slatWithGpt in x-direction (not implemented)
87
+ gr_slatAttWithXOff,
88
+ /// Adjustment to gr_slatWithGpt in y-direction (not implemented)
89
+ gr_slatAttWithYOff,
90
+ /// Attach at given nesting level (not implemented)
91
+ gr_slatAttLevel,
92
+ /// Line break breakweight for this glyph
93
+ gr_slatBreak,
94
+ /// Ligature component reference (not implemented)
95
+ gr_slatCompRef,
96
+ /// bidi directionality of this glyph (not implemented)
97
+ gr_slatDir,
98
+ /// Whether insertion is allowed before this glyph
99
+ gr_slatInsert,
100
+ /// Final positioned position of this glyph relative to its parent in x-direction in pixels
101
+ gr_slatPosX,
102
+ /// Final positioned position of this glyph relative to its parent in y-direction in pixels
103
+ gr_slatPosY,
104
+ /// Amount to shift glyph by in x-direction design units
105
+ gr_slatShiftX,
106
+ /// Amount to shift glyph by in y-direction design units
107
+ gr_slatShiftY,
108
+ /// attribute user1
109
+ gr_slatUserDefnV1,
110
+ /// not implemented
111
+ gr_slatMeasureSol,
112
+ /// not implemented
113
+ gr_slatMeasureEol,
114
+ /// Amount this slot can stretch (not implemented)
115
+ gr_slatJStretch,
116
+ /// Amount this slot can shrink (not implemented)
117
+ gr_slatJShrink,
118
+ /// Granularity by which this slot can stretch or shrink (not implemented)
119
+ gr_slatJStep,
120
+ /// Justification weight for this glyph (not implemented)
121
+ gr_slatJWeight,
122
+ /// Amount this slot mush shrink or stretch in design units
123
+ gr_slatJWidth = 29,
124
+ /// SubSegment split point
125
+ gr_slatSegSplit = gr_slatJStretch + 29,
126
+ /// User defined attribute, see subattr for user attr number
127
+ gr_slatUserDefn,
128
+ /// Bidi level
129
+ gr_slatBidiLevel = 56,
130
+ /// Collision flags
131
+ gr_slatColFlags,
132
+ /// Collision constraint rectangle left (bl.x)
133
+ gr_slatColLimitblx,
134
+ /// Collision constraint rectangle lower (bl.y)
135
+ gr_slatColLimitbly,
136
+ /// Collision constraint rectangle right (tr.x)
137
+ gr_slatColLimittrx,
138
+ /// Collision constraint rectangle upper (tr.y)
139
+ gr_slatColLimittry,
140
+ /// Collision shift x
141
+ gr_slatColShiftx,
142
+ /// Collision shift y
143
+ gr_slatColShifty,
144
+ /// Collision margin
145
+ gr_slatColMargin,
146
+ /// Margin cost weight
147
+ gr_slatColMarginWt,
148
+ // Additional glyph that excludes movement near this one:
149
+ gr_slatColExclGlyph,
150
+ gr_slatColExclOffx,
151
+ gr_slatColExclOffy,
152
+ // Collision sequence enforcing attributes:
153
+ gr_slatSeqClass,
154
+ gr_slatSeqProxClass,
155
+ gr_slatSeqOrder,
156
+ gr_slatSeqAboveXoff,
157
+ gr_slatSeqAboveWt,
158
+ gr_slatSeqBelowXlim,
159
+ gr_slatSeqBelowWt,
160
+ gr_slatSeqValignHt,
161
+ gr_slatSeqValignWt,
162
+
163
+ /// not implemented
164
+ gr_slatMax,
165
+ /// not implemented
166
+ gr_slatNoEffect = gr_slatMax + 1
167
+ };
168
+
169
+ enum gr_bidirtl {
170
+ /// Underlying paragraph direction is RTL
171
+ gr_rtl = 1,
172
+ /// Set this to not run the bidi pass internally, even if the font asks for it.
173
+ /// This presumes that the segment is in a single direction. Most of the time
174
+ /// this bit should be set unless you know you are passing full paragraphs of text.
175
+ gr_nobidi = 2,
176
+ /// Disable auto mirroring for rtl text
177
+ gr_nomirror = 4
178
+ };
179
+
180
+ typedef struct gr_char_info gr_char_info;
181
+ typedef struct gr_segment gr_segment;
182
+ typedef struct gr_slot gr_slot;
183
+
184
+ /** Returns Unicode character for a charinfo.
185
+ *
186
+ * @param p Pointer to charinfo to return information on.
187
+ */
188
+ GR2_API unsigned int gr_cinfo_unicode_char(const gr_char_info* p/*not NULL*/);
189
+
190
+ /** Returns breakweight for a charinfo.
191
+ *
192
+ * @return Breakweight is a number between -50 and 50 indicating the cost of a
193
+ * break before or after this character. If the value < 0, the absolute value
194
+ * is this character's contribution to the overall breakweight before it. If the value
195
+ * > 0, then the value is this character's contribution to the overall breakweight after it.
196
+ * The overall breakweight between two characters is the maximum of the breakweight
197
+ * contributions from the characters either side of it. If a character makes no
198
+ * contribution to the breakweight on one side of it, the contribution is considered
199
+ * to be 0.
200
+ * @param p Pointer to charinfo to return information on.
201
+ */
202
+ GR2_API int gr_cinfo_break_weight(const gr_char_info* p/*not NULL*/);
203
+
204
+ /** Returns the slot index that after this character is after in the slot stream
205
+ *
206
+ * In effect each character is associated with a set of slots and this returns
207
+ * the index of the last slot in the segment this character is associated with.
208
+ *
209
+ * @return after slot index between 0 and gr_seg_n_slots()
210
+ * @param p Pointer to charinfo to return information on.
211
+ */
212
+ GR2_API int gr_cinfo_after(const gr_char_info* p/*not NULL*/);
213
+
214
+ /** Returns the slot index that before this character is before in the slot stream
215
+ *
216
+ * In effect each character is associated with a set of slots and this returns
217
+ * the index of the first slot in the segment this character is associated with.
218
+ *
219
+ * @return before slot index between 0 and gr_seg_n_slots()
220
+ * @param p Pointer to charinfo to return information on.
221
+ */
222
+ GR2_API int gr_cinfo_before(const gr_char_info* p/*not NULL*/);
223
+
224
+ /** Returns the code unit index of this character in the input string
225
+ *
226
+ * @return code unit index between 0 and the end of the string
227
+ * @param p Pointer to charinfo to return information on.
228
+ */
229
+ GR2_API size_t gr_cinfo_base(const gr_char_info* p/*not NULL*/);
230
+
231
+ /** Returns the number of unicode characters in a string.
232
+ *
233
+ * @return number of characters in the string
234
+ * @param enc Specifies the type of data in the string: utf8, utf16, utf32
235
+ * @param buffer_begin The start of the string
236
+ * @param buffer_end Measure up to the first nul or when end is reached, whichever is earliest.
237
+ * This parameter may be NULL.
238
+ * @param pError If there is a structural fault in the string, the location is returned
239
+ * in this variable. If no error occurs, pError will contain NULL. NULL
240
+ * may be passed for pError if no such information is required.
241
+ */
242
+ GR2_API size_t gr_count_unicode_characters(enum gr_encform enc, const void* buffer_begin, const void* buffer_end, const void** pError);
243
+
244
+ /** Creates and returns a segment.
245
+ *
246
+ * @return a segment that needs seg_destroy called on it. May return NULL if bad problems
247
+ * in segment processing.
248
+ * @param font Gives the size of the font in pixels per em for final positioning. If
249
+ * NULL, positions are returned in design units, i.e. at a ppm of the upem
250
+ * of the face.
251
+ * @param face The face containing all the non-size dependent information.
252
+ * @param script This is a tag containing a script identifier that is used to choose
253
+ * which graphite table within the font to use. Maybe 0. Tag may be 4 chars
254
+ * NULL padded in LSBs or space padded in LSBs.
255
+ * @param pFeats Pointer to a feature values to be used for the segment. Only one
256
+ * feature values may be used for a segment. If NULL the default features
257
+ * for the font will be used.
258
+ * @param enc Specifies what encoding form the string is in (utf8, utf16, utf32)
259
+ * @param pStart Start of the string
260
+ * @param nChars Number of unicode characters to process in the string. The string will
261
+ * be processed either up to the first NULL or until nChars have been
262
+ * processed. nChars is also used to initialise the internal memory
263
+ * allocations of the segment. So it is wise not to make nChars too much
264
+ * greater than the actual number of characters being processed.
265
+ * @param dir Specifies whether the segment is processed right to left (1) or left to
266
+ * right (0) and whether to run the internal bidi pass, if a font requests it.
267
+ * See enum gr_bidirtl for details.
268
+ */
269
+ GR2_API gr_segment* gr_make_seg(const gr_font* font, const gr_face* face, gr_uint32 script, const gr_feature_val* pFeats, enum gr_encform enc, const void* pStart, size_t nChars, int dir);
270
+
271
+ /** Destroys a segment, freeing the memory.
272
+ *
273
+ * @param p The segment to destroy
274
+ */
275
+ GR2_API void gr_seg_destroy(gr_segment* p);
276
+
277
+ /** Returns the advance for the whole segment.
278
+ *
279
+ * Returns the width of the segment up to the next glyph origin after the segment
280
+ */
281
+ GR2_API float gr_seg_advance_X(const gr_segment* pSeg/*not NULL*/);
282
+
283
+ /** Returns the height advance for the segment. **/
284
+ GR2_API float gr_seg_advance_Y(const gr_segment* pSeg/*not NULL*/);
285
+
286
+ /** Returns the number of gr_char_infos in the segment. **/
287
+ GR2_API unsigned int gr_seg_n_cinfo(const gr_segment* pSeg/*not NULL*/);
288
+
289
+ /** Returns a gr_char_info at a given index in the segment. **/
290
+ GR2_API const gr_char_info* gr_seg_cinfo(const gr_segment* pSeg/*not NULL*/, unsigned int index/*must be <number_of_CharInfo*/);
291
+
292
+ /** Returns the number of glyph gr_slots in the segment. **/
293
+ GR2_API unsigned int gr_seg_n_slots(const gr_segment* pSeg/*not NULL*/); //one slot per glyph
294
+
295
+ /** Returns the first gr_slot in the segment.
296
+ *
297
+ * The first slot in a segment has a gr_slot_prev_in_segment() of NULL. Slots are owned
298
+ * by their segment and are destroyed along with the segment.
299
+ */
300
+ GR2_API const gr_slot* gr_seg_first_slot(gr_segment* pSeg/*not NULL*/); //may give a base slot or a slot which is attached to another
301
+
302
+ /** Returns the last gr_slot in the segment.
303
+ *
304
+ * The last slot in a segment has a gr_slot_next_in_segment() of NULL
305
+ */
306
+ GR2_API const gr_slot* gr_seg_last_slot(gr_segment* pSeg/*not NULL*/); //may give a base slot or a slot which is attached to another
307
+
308
+ /** Justifies a linked list of slots for a line to a given width
309
+ *
310
+ * Passed a pointer to the start of a linked list of slots corresponding to a line, as
311
+ * set up by gr_slot_linebreak_before, this function will position the glyphs in the line
312
+ * to take up the given width. It is possible to specify a subrange within the line to process.
313
+ * This allows skipping of line initial or final whitespace, for example. While this will ensure
314
+ * that the subrange fits width, the line will still be positioned with the first glyph of the
315
+ * line at 0. So the resulting positions may be beyond width.
316
+ *
317
+ * @return float The resulting width of the range of slots justified.
318
+ * @param pSeg Pointer to the segment
319
+ * @param pStart Pointer to the start of the line linked list (including skipped characters)
320
+ * @param pFont Font to use for positioning
321
+ * @param width Width in pixels in which to fit the line. If < 0. don't adjust natural width, just run justification passes
322
+ * to handle line end contextuals, if there are any.
323
+ * @param flags Indicates line ending types. Default is linked list is a full line
324
+ * @param pFirst If not NULL, the first slot in the list to be considered part of the line (so can skip)
325
+ * @param pLast If not NULL, the last slot to process in the line (allow say trailing whitespace to be skipped)
326
+ */
327
+ GR2_API float gr_seg_justify(gr_segment* pSeg/*not NULL*/, const gr_slot* pStart/*not NULL*/, const gr_font *pFont, double width, enum gr_justFlags flags, const gr_slot* pFirst, const gr_slot* pLast);
328
+
329
+ /** Returns the next slot along in the segment.
330
+ *
331
+ * Slots are held in a linked list. This returns the next in the linked list. The slot
332
+ * may or may not be attached to another slot. Returns NULL at the end of the segment.
333
+ */
334
+ GR2_API const gr_slot* gr_slot_next_in_segment(const gr_slot* p);
335
+
336
+ /** Returns the previous slot along in the segment.
337
+ *
338
+ * Slots are held in a doubly linked list. This returns the previos slot in the linked
339
+ * list. This slot may or may not be attached to it. Returns NULL at the start of the
340
+ * segment.
341
+ */
342
+ GR2_API const gr_slot* gr_slot_prev_in_segment(const gr_slot* p);
343
+
344
+ /** Returns the attachment parent slot of this slot.
345
+ *
346
+ * Attached slots form a tree. This returns the parent of this slot in that tree. A
347
+ * base glyph which is not attached to another glyph, always returns NULL.
348
+ */
349
+ GR2_API const gr_slot* gr_slot_attached_to(const gr_slot* p);
350
+
351
+ /** Returns the first slot attached to this slot.
352
+ *
353
+ * Attached slots form a singly linked list from the parent. This returns the first
354
+ * slot in that list. Note that this is a reference to another slot that is also in
355
+ * the main segment doubly linked list.
356
+ *
357
+ * if gr_slot_first_attachment(p) != NULL then gr_slot_attached_to(gr_slot_first_attachment(p)) == p.
358
+ */
359
+ GR2_API const gr_slot* gr_slot_first_attachment(const gr_slot* p);
360
+
361
+ /** Returns the next slot attached to our attachment parent.
362
+ *
363
+ * This returns the next slot in the singly linked list of slots attached to this
364
+ * slot's parent. If there are no more such slots, NULL is returned. If there is
365
+ * no parent, i.e. the passed slot is a cluster base, then the next cluster base
366
+ * in graphical order (ltr, even for rtl text) is returned.
367
+ *
368
+ * if gr_slot_next_sibling_attachment(p) != NULL then gr_slot_attached_to(gr_slot_next_sibling_attachment(p)) == gr_slot_attached_to(p).
369
+ */
370
+ GR2_API const gr_slot* gr_slot_next_sibling_attachment(const gr_slot* p);
371
+
372
+
373
+ /** Returns glyph id of the slot
374
+ *
375
+ * Each slot has a glyphid which is rendered at the position given by the slot. This
376
+ * glyphid is the real glyph to be rendered and never a pseudo glyph.
377
+ */
378
+ GR2_API unsigned short gr_slot_gid(const gr_slot* p);
379
+
380
+ /** Returns X offset of glyph from start of segment **/
381
+ GR2_API float gr_slot_origin_X(const gr_slot* p);
382
+
383
+ /** Returns Y offset of glyph from start of segment **/
384
+ GR2_API float gr_slot_origin_Y(const gr_slot* p);
385
+
386
+ /** Returns the glyph advance for this glyph as adjusted for kerning
387
+ *
388
+ * @param p Slot to give results for
389
+ * @param face gr_face of the glyphs. May be NULL if unhinted advances used
390
+ * @param font gr_font to scale for pixel results. If NULL returns design
391
+ * units advance. If not NULL then returns pixel advance based
392
+ * on hinted or scaled glyph advances in the font. face must be
393
+ * passed for hinted advances to be used.
394
+ */
395
+ GR2_API float gr_slot_advance_X(const gr_slot* p, const gr_face* face, const gr_font *font);
396
+
397
+ /** Returns the vertical advance for the glyph in the slot adjusted for kerning
398
+ *
399
+ * Returns design units unless font is not NULL in which case the pixel value
400
+ * is returned scaled for the given font
401
+ */
402
+ GR2_API float gr_slot_advance_Y(const gr_slot* p, const gr_face* face, const gr_font *font);
403
+
404
+ /** Returns the gr_char_info index before us
405
+ *
406
+ * Returns the index of the gr_char_info that a cursor before this slot, would put
407
+ * an underlying cursor before. This may also be interpretted as each slot holding
408
+ * a set of char_infos that it is associated with and this function returning the
409
+ * index of the char_info with lowest index, from this set.
410
+ */
411
+ GR2_API int gr_slot_before(const gr_slot* p/*not NULL*/);
412
+
413
+ /** Returns the gr_char_info index after us
414
+ *
415
+ * Returns the index of the gr_char_info that a cursor after this slot would put an
416
+ * underlying cursor after. This may also be interpretted as each slot holding a set
417
+ * of char_infos that it is associated with and this function returning the index of
418
+ * the char_info with the highest index, from this set.
419
+ */
420
+ GR2_API int gr_slot_after(const gr_slot* p/*not NULL*/);
421
+
422
+ /** Returns the index of this slot in the segment
423
+ *
424
+ * Returns the index given to this slot during final positioning. This corresponds
425
+ * to the value returned br gr_cinfo_before() and gr_cinfo_after()
426
+ */
427
+ GR2_API unsigned int gr_slot_index(const gr_slot* p/*not NULL*/);
428
+
429
+ /** Return a slot attribute value
430
+ *
431
+ * Given a slot and an attribute along with a possible subattribute, return the
432
+ * corresponding value in the slot. See enum gr_attrCode for details of each attribute.
433
+ */
434
+ GR2_API int gr_slot_attr(const gr_slot* p/*not NULL*/, const gr_segment* pSeg/*not NULL*/, enum gr_attrCode index, gr_uint8 subindex); //tbd - do we need to expose this?
435
+
436
+ /** Returns whether text may be inserted before this glyph.
437
+ *
438
+ * This indicates whether a cursor can be put before this slot. It applies to
439
+ * base glyphs that have no parent as well as attached glyphs that have the
440
+ * .insert attribute explicitly set to true. This is the primary mechanism
441
+ * for identifying contiguous sequences of base plus diacritics.
442
+ */
443
+ GR2_API int gr_slot_can_insert_before(const gr_slot* p);
444
+
445
+ /** Returns the original gr_char_info index this slot refers to.
446
+ *
447
+ * Each Slot has a gr_char_info that it originates from. This is that gr_char_info.
448
+ * The index is passed to gr_seg_cinfo(). This information is useful for testing.
449
+ */
450
+ GR2_API int gr_slot_original(const gr_slot* p/*not NULL*/);
451
+
452
+ /** Breaks a segment into lines.
453
+ *
454
+ * Breaks the slot linked list at the given point in the linked list. It is up
455
+ * to the application to keep track of the first slot on each line.
456
+ */
457
+ GR2_API void gr_slot_linebreak_before(gr_slot *p/*not NULL*/);
458
+
459
+ #ifdef __cplusplus
460
+ }
461
+ #endif
data/miniconda3/include/graphite2/Types.h ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* GRAPHITE2 LICENSING
2
+
3
+ Copyright 2010, SIL International
4
+ All rights reserved.
5
+
6
+ This library is free software; you can redistribute it and/or modify
7
+ it under the terms of the GNU Lesser General Public License as published
8
+ by the Free Software Foundation; either version 2.1 of License, or
9
+ (at your option) any later version.
10
+
11
+ This program is distributed in the hope that it will be useful,
12
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ Lesser General Public License for more details.
15
+
16
+ You should also have received a copy of the GNU Lesser General Public
17
+ License along with this library in the file named "LICENSE".
18
+ If not, write to the Free Software Foundation, 51 Franklin Street,
19
+ Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
20
+ internet at http://www.fsf.org/licenses/lgpl.html.
21
+
22
+ Alternatively, the contents of this file may be used under the terms
23
+ of the Mozilla Public License (http://mozilla.org/MPL) or the GNU
24
+ General Public License, as published by the Free Software Foundation,
25
+ either version 2 of the License or (at your option) any later version.
26
+ */
27
+ #pragma once
28
+
29
+ #include <stddef.h>
30
+
31
+ typedef unsigned char gr_uint8;
32
+ typedef gr_uint8 gr_byte;
33
+ typedef signed char gr_int8;
34
+ typedef unsigned short gr_uint16;
35
+ typedef short gr_int16;
36
+ typedef unsigned int gr_uint32;
37
+ typedef int gr_int32;
38
+
39
+ enum gr_encform {
40
+ gr_utf8 = 1/*sizeof(uint8)*/, gr_utf16 = 2/*sizeof(uint16)*/, gr_utf32 = 4/*sizeof(uint32)*/
41
+ };
42
+
43
+
44
+ // Define API function declspec/attributes and how each supported compiler or OS
45
+ // allows us to specify them.
46
+ #if defined __GNUC__
47
+ #define _gr2_and ,
48
+ #define _gr2_tag_fn(a) __attribute__((a))
49
+ #define _gr2_deprecated_flag deprecated
50
+ #define _gr2_export_flag visibility("default")
51
+ #define _gr2_import_flag visibility("default")
52
+ #define _gr2_static_flag visibility("hidden")
53
+ #endif
54
+
55
+ #if defined _WIN32 || defined __CYGWIN__
56
+ #if defined __GNUC__ // These three will be redefined for Windows
57
+ #undef _gr2_export_flag
58
+ #undef _gr2_import_flag
59
+ #undef _gr2_static_flag
60
+ #else // How MSVC sepcifies function level attributes adn deprecation
61
+ #define _gr2_and
62
+ #define _gr2_tag_fn(a) __declspec(a)
63
+ #define _gr2_deprecated_flag deprecated
64
+ #endif
65
+ #define _gr2_export_flag dllexport
66
+ #define _gr2_import_flag dllimport
67
+ #define _gr2_static_flag
68
+ #endif
69
+
70
+ #if defined GRAPHITE2_STATIC
71
+ #define GR2_API _gr2_tag_fn(_gr2_static_flag)
72
+ #define GR2_DEPRECATED_API _gr2_tag_fn(_gr2_deprecated_flag _gr2_and _gr2_static_flag)
73
+ #elif defined GRAPHITE2_EXPORTING
74
+ #define GR2_API _gr2_tag_fn(_gr2_export_flag)
75
+ #define GR2_DEPRECATED_API _gr2_tag_fn(_gr2_deprecated_flag _gr2_and _gr2_export_flag)
76
+ #else
77
+ #define GR2_API _gr2_tag_fn(_gr2_import_flag)
78
+ #define GR2_DEPRECATED_API _gr2_tag_fn(_gr2_deprecated_flag _gr2_and _gr2_import_flag)
79
+ #endif
data/miniconda3/include/graphviz/arith.h ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*************************************************************************
2
+ * Copyright (c) 2011 AT&T Intellectual Property
3
+ * All rights reserved. This program and the accompanying materials
4
+ * are made available under the terms of the Eclipse Public License v1.0
5
+ * which accompanies this distribution, and is available at
6
+ * http://www.eclipse.org/legal/epl-v10.html
7
+ *
8
+ * Contributors: Details at https://graphviz.org
9
+ *************************************************************************/
10
+
11
+ /* geometric functions (e.g. on points and boxes) with application to, but
12
+ * no specific dependence on graphs */
13
+
14
+ #pragma once
15
+
16
+ /* for sincos */
17
+ #ifndef _GNU_SOURCE
18
+ #define _GNU_SOURCE 1
19
+ #endif
20
+
21
+ #include <limits.h>
22
+ #include <math.h>
23
+
24
+ #ifdef __cplusplus
25
+ extern "C" {
26
+ #endif
27
+
28
+ #ifdef MIN
29
+ #undef MIN
30
+ #endif
31
+ #define MIN(a,b) ((a)<(b)?(a):(b))
32
+
33
+ #ifdef MAX
34
+ #undef MAX
35
+ #endif
36
+ #define MAX(a,b) ((a)>(b)?(a):(b))
37
+
38
+ #define AVG(a,b) ((a + b) / 2)
39
+ #define SGN(a) (((a)<0)? -1 : 1)
40
+ #define CMP(a,b) (((a)<(b)) ? -1 : (((a)>(b)) ? 1 : 0))
41
+
42
+ #ifndef MAXDOUBLE
43
+ #define MAXDOUBLE 1.7976931348623157e+308
44
+ #endif
45
+
46
+ #ifdef BETWEEN
47
+ #undef BETWEEN
48
+ #endif
49
+ #define BETWEEN(a,b,c) (((a) <= (b)) && ((b) <= (c)))
50
+
51
+ #ifndef M_PI
52
+ #define M_PI 3.14159265358979323846
53
+ #endif
54
+
55
+ #ifndef SQRT2
56
+ #define SQRT2 1.41421356237309504880
57
+ #endif
58
+
59
+ #define ROUND(f) ((f>=0)?(int)(f + .5):(int)(f - .5))
60
+ #define RADIANS(deg) ((deg)/180.0 * M_PI)
61
+ #define DEGREES(rad) ((rad)/M_PI * 180.0)
62
+
63
+ #define SQR(a) ((a) * (a))
64
+
65
+ #ifdef HAVE_SINCOS
66
+ extern void sincos(double x, double *s, double *c);
67
+ #else
68
+ # define sincos(x,s,c) *s = sin(x); *c = cos(x)
69
+ #endif
70
+
71
+ #ifdef __cplusplus
72
+ }
73
+ #endif
data/miniconda3/include/graphviz/cdt.h ADDED
@@ -0,0 +1,283 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @file
3
+ * @brief container data types API
4
+ */
5
+
6
+ #pragma once
7
+
8
+ #ifdef __cplusplus
9
+ extern "C" {
10
+ #endif
11
+
12
+ /* Public interface for the dictionary library
13
+ **
14
+ ** Written by Kiem-Phong Vo
15
+ */
16
+
17
+ #define CDT_VERSION 20050420L
18
+
19
+ #include <stddef.h> /* size_t */
20
+ #include <string.h>
21
+
22
+ #ifdef GVDLL
23
+ #ifdef EXPORT_CDT
24
+ #define CDT_API __declspec(dllexport)
25
+ #else
26
+ #define CDT_API __declspec(dllimport)
27
+ #endif
28
+ #endif
29
+
30
+ #ifndef CDT_API
31
+ #define CDT_API /* nothing */
32
+ #endif
33
+
34
+ typedef struct _dtlink_s Dtlink_t;
35
+ typedef struct _dthold_s Dthold_t;
36
+ typedef struct _dtdisc_s Dtdisc_t;
37
+ typedef struct _dtmethod_s Dtmethod_t;
38
+ typedef struct _dtdata_s Dtdata_t;
39
+ typedef struct _dt_s Dt_t;
40
+ typedef struct _dt_s Dict_t; /* for libdict compatibility */
41
+ typedef struct _dtstat_s Dtstat_t;
42
+ typedef void* (*Dtmemory_f)(Dt_t*,void*,size_t,Dtdisc_t*);
43
+ typedef void* (*Dtsearch_f)(Dt_t*,void*,int);
44
+ typedef void* (*Dtmake_f)(Dt_t*,void*,Dtdisc_t*);
45
+ typedef void (*Dtfree_f)(Dt_t*,void*,Dtdisc_t*);
46
+ typedef int (*Dtcompar_f)(Dt_t*,void*,void*,Dtdisc_t*);
47
+ typedef unsigned int (*Dthash_f)(Dt_t*,void*,Dtdisc_t*);
48
+ typedef int (*Dtevent_f)(Dt_t*,int,void*,Dtdisc_t*);
49
+
50
+ struct _dtlink_s
51
+ { Dtlink_t* right; /* right child */
52
+ union
53
+ { unsigned int _hash; /* hash value */
54
+ Dtlink_t* _left; /* left child */
55
+ } hl;
56
+ };
57
+
58
+ /* private structure to hold an object */
59
+ struct _dthold_s
60
+ { Dtlink_t hdr; /* header */
61
+ void* obj; /* user object */
62
+ };
63
+
64
+ /* method to manipulate dictionary structure */
65
+ struct _dtmethod_s
66
+ { Dtsearch_f searchf; /* search function */
67
+ int type; /* type of operation */
68
+ };
69
+
70
+ /* stuff that may be in shared memory */
71
+ struct _dtdata_s
72
+ { int type; /* type of dictionary */
73
+ Dtlink_t* here; /* finger to last search element */
74
+ union
75
+ { Dtlink_t** _htab; /* hash table */
76
+ Dtlink_t* _head; /* linked list */
77
+ } hh;
78
+ int ntab; /* number of hash slots */
79
+ int size; /* number of objects */
80
+ int loop; /* number of nested loops */
81
+ int minp; /* min path before splay, always even */
82
+ /* for hash dt, > 0: fixed table size */
83
+ };
84
+
85
+ /* structure to hold methods that manipulate an object */
86
+ struct _dtdisc_s
87
+ { int key; /* where the key begins in an object */
88
+ int size; /* key size and type */
89
+ int link; /* offset to Dtlink_t field */
90
+ Dtmake_f makef; /* object constructor */
91
+ Dtfree_f freef; /* object destructor */
92
+ Dtcompar_f comparf;/* to compare two objects */
93
+ Dthash_f hashf; /* to compute hash value of an object */
94
+ Dtmemory_f memoryf;/* to allocate/free memory */
95
+ Dtevent_f eventf; /* to process events */
96
+ };
97
+
98
+ #define DTDISC(dc,ky,sz,lk,mkf,frf,cmpf,hshf,memf,evf) \
99
+ ( (dc)->key = (ky), (dc)->size = (sz), (dc)->link = (lk), \
100
+ (dc)->makef = (mkf), (dc)->freef = (frf), \
101
+ (dc)->comparf = (cmpf), (dc)->hashf = (hshf), \
102
+ (dc)->memoryf = (memf), (dc)->eventf = (evf) )
103
+
104
+ /* the dictionary structure itself */
105
+ struct _dt_s
106
+ { Dtsearch_f searchf;/* search function */
107
+ Dtdisc_t* disc; /* method to manipulate objs */
108
+ Dtdata_t* data; /* sharable data */
109
+ Dtmemory_f memoryf;/* function to alloc/free memory */
110
+ Dtmethod_t* meth; /* dictionary method */
111
+ int type; /* type information */
112
+ int nview; /* number of parent view dictionaries */
113
+ Dt_t* view; /* next on viewpath */
114
+ Dt_t* walk; /* dictionary being walked */
115
+ void* user; /* for user's usage */
116
+ };
117
+
118
+ /* structure to get status of a dictionary */
119
+ struct _dtstat_s
120
+ { int dt_meth; /* method type */
121
+ int dt_size; /* number of elements */
122
+ size_t dt_n; // number of chains or levels
123
+ size_t dt_max; // max size of a chain or a level
124
+ size_t* dt_count; // counts of chains or levels by size
125
+ };
126
+
127
+ /* flag set if the last search operation actually found the object */
128
+ #define DT_FOUND 0100000
129
+
130
+ /* supported storage methods */
131
+ #define DT_SET 0000001 /* set with unique elements */
132
+ #define DT_BAG 0000002 /* multiset */
133
+ #define DT_OSET 0000004 /* ordered set (self-adjusting tree) */
134
+ #define DT_OBAG 0000010 /* ordered multiset */
135
+ #define DT_LIST 0000020 /* linked list */
136
+ #define DT_STACK 0000040 /* stack: insert/delete at top */
137
+ #define DT_QUEUE 0000100 /* queue: insert at top, delete at tail */
138
+ #define DT_DEQUE 0000200 /* deque: insert at top, append at tail */
139
+ #define DT_METHODS 0000377 /* all currently supported methods */
140
+
141
+ /* asserts to dtdisc() */
142
+ #define DT_SAMECMP 0000001 /* compare methods equivalent */
143
+ #define DT_SAMEHASH 0000002 /* hash methods equivalent */
144
+
145
+ /* types of search */
146
+ #define DT_INSERT 0000001 /* insert object if not found */
147
+ #define DT_DELETE 0000002 /* delete object if found */
148
+ #define DT_SEARCH 0000004 /* look for an object */
149
+ #define DT_NEXT 0000010 /* look for next element */
150
+ #define DT_PREV 0000020 /* find previous element */
151
+ #define DT_RENEW 0000040 /* renewing an object */
152
+ #define DT_CLEAR 0000100 /* clearing all objects */
153
+ #define DT_FIRST 0000200 /* get first object */
154
+ #define DT_LAST 0000400 /* get last object */
155
+ #define DT_MATCH 0001000 /* find object matching key */
156
+ #define DT_VSEARCH 0002000 /* search using internal representation */
157
+ #define DT_ATTACH 0004000 /* attach an object to the dictionary */
158
+ #define DT_DETACH 0010000 /* detach an object from the dictionary */
159
+ #define DT_APPEND 0020000 /* used on Dtlist to append an object */
160
+
161
+ /* events */
162
+ #define DT_OPEN 1 /* a dictionary is being opened */
163
+ #define DT_CLOSE 2 /* a dictionary is being closed */
164
+ #define DT_DISC 3 /* discipline is about to be changed */
165
+ #define DT_METH 4 /* method is about to be changed */
166
+ #define DT_ENDOPEN 5 /* dtopen() is done */
167
+ #define DT_ENDCLOSE 6 /* dtclose() is done */
168
+ #define DT_HASHSIZE 7 /* setting hash table size */
169
+
170
+ CDT_API extern Dtmethod_t* Dtset; ///< set with unique elements
171
+ CDT_API extern Dtmethod_t* Dtbag; ///< multiset
172
+ CDT_API extern Dtmethod_t* Dtoset; ///< ordered set (self-adjusting tree)
173
+ CDT_API extern Dtmethod_t* Dtobag; ///< ordered multiset
174
+ CDT_API extern Dtmethod_t* Dtlist; ///< linked list
175
+ CDT_API extern Dtmethod_t* Dtstack; ///< stack: insert/delete at top
176
+ CDT_API extern Dtmethod_t* Dtqueue; ///< queue: insert at top, delete at tail
177
+ CDT_API extern Dtmethod_t* Dtdeque; ///< deque: insert at top, append at tail
178
+
179
+ CDT_API extern Dtmethod_t* Dtorder;
180
+ CDT_API extern Dtmethod_t* Dttree;
181
+ CDT_API extern Dtmethod_t* Dthash;
182
+ CDT_API extern Dtmethod_t _Dttree;
183
+ CDT_API extern Dtmethod_t _Dthash;
184
+ CDT_API extern Dtmethod_t _Dtlist;
185
+ CDT_API extern Dtmethod_t _Dtqueue;
186
+ CDT_API extern Dtmethod_t _Dtstack;
187
+
188
+ CDT_API Dt_t* dtopen(Dtdisc_t*, Dtmethod_t*);
189
+ CDT_API int dtclose(Dt_t*);
190
+ CDT_API Dt_t* dtview(Dt_t*, Dt_t*);
191
+ CDT_API Dtdisc_t* dtdisc(Dt_t* dt, Dtdisc_t*, int);
192
+ CDT_API Dtmethod_t* dtmethod(Dt_t*, Dtmethod_t*);
193
+
194
+ CDT_API Dtlink_t* dtflatten(Dt_t*);
195
+ CDT_API Dtlink_t* dtextract(Dt_t*);
196
+ CDT_API int dtrestore(Dt_t*, Dtlink_t*);
197
+
198
+ CDT_API int dtwalk(Dt_t*, int(*)(Dt_t*,void*,void*), void*);
199
+
200
+ CDT_API void* dtrenew(Dt_t*, void*);
201
+
202
+ CDT_API int dtsize(Dt_t*);
203
+ CDT_API int dtstat(Dt_t*, Dtstat_t*, int);
204
+ CDT_API unsigned int dtstrhash(unsigned int, void*, int);
205
+
206
+ /* internal functions for translating among holder, object and key */
207
+ #define _DT(dt) ((Dt_t*)(dt))
208
+ #define _DTDSC(dc,ky,sz,lk,cmpf) \
209
+ (ky = dc->key, sz = dc->size, lk = dc->link, cmpf = dc->comparf)
210
+ #define _DTLNK(o,lk) ((Dtlink_t*)((char*)(o) + lk) )
211
+ #define _DTOBJ(e,lk) (lk < 0 ? ((Dthold_t*)(e))->obj : (void*)((char*)(e) - lk) )
212
+ #define _DTKEY(o,ky,sz) (void*)(sz < 0 ? *((char**)((char*)(o)+ky)) : ((char*)(o)+ky))
213
+
214
+ #define _DTCMP(dt,k1,k2,dc,cmpf,sz) \
215
+ (cmpf ? (*cmpf)(dt,k1,k2,dc) : \
216
+ (sz <= 0 ? strcmp(k1,k2) : memcmp(k1,k2,(size_t)sz)) )
217
+ #define _DTHSH(dt,ky,dc,sz) (dc->hashf ? (*dc->hashf)(dt,ky,dc) : dtstrhash(0,ky,sz) )
218
+
219
+ /* special search function for tree structure only */
220
+ #define _DTMTCH(dt,key,action) \
221
+ do { Dtlink_t* _e; void *_o, *_k, *_key; Dtdisc_t* _dc; \
222
+ int _ky, _sz, _lk, _cmp; Dtcompar_f _cmpf; \
223
+ _dc = (dt)->disc; _DTDSC(_dc, _ky, _sz, _lk, _cmpf); \
224
+ _key = (key); \
225
+ for(_e = (dt)->data->here; _e; _e = _cmp < 0 ? _e->hl._left : _e->right) \
226
+ { _o = _DTOBJ(_e, _lk); _k = _DTKEY(_o, _ky, _sz); \
227
+ if((_cmp = _DTCMP((dt), _key, _k, _dc, _cmpf, _sz)) == 0) \
228
+ break; \
229
+ } \
230
+ action (_e ? _o : (void*)0); \
231
+ } while(0)
232
+
233
+ #define _DTSRCH(dt,obj,action) \
234
+ do { Dtlink_t* _e; void *_o, *_k, *_key; Dtdisc_t* _dc; \
235
+ int _ky, _sz, _lk, _cmp; Dtcompar_f _cmpf; \
236
+ _dc = (dt)->disc; _DTDSC(_dc, _ky, _sz, _lk, _cmpf); \
237
+ _key = _DTKEY(obj, _ky, _sz); \
238
+ for(_e = (dt)->data->here; _e; _e = _cmp < 0 ? _e->hl._left : _e->right) \
239
+ { _o = _DTOBJ(_e, _lk); _k = _DTKEY(_o, _ky, _sz); \
240
+ if((_cmp = _DTCMP((dt), _key, _k, _dc, _cmpf, _sz)) == 0) \
241
+ break; \
242
+ } \
243
+ action (_e ? _o : (void*)0); \
244
+ } while(0)
245
+
246
+ #define DTTREEMATCH(dt,key,action) _DTMTCH(_DT(dt),(void*)(key),action)
247
+ #define DTTREESEARCH(dt,obj,action) _DTSRCH(_DT(dt),(void*)(obj),action)
248
+
249
+ #define dtvnext(d) (_DT(d)->view)
250
+ #define dtvcount(d) (_DT(d)->nview)
251
+ #define dtvhere(d) (_DT(d)->walk)
252
+
253
+ #define dtlink(d,e) (((Dtlink_t*)(e))->right)
254
+ #define dtobj(d,e) _DTOBJ((e), _DT(d)->disc->link)
255
+ #define dtfinger(d) (_DT(d)->data->here ? dtobj((d),_DT(d)->data->here):(void*)(0))
256
+
257
+ #define dtfirst(d) (*(_DT(d)->searchf))((d),(void*)(0),DT_FIRST)
258
+ #define dtnext(d,o) (*(_DT(d)->searchf))((d),(void*)(o),DT_NEXT)
259
+ #define dtleast(d,o) (*(_DT(d)->searchf))((d),(void*)(o),DT_SEARCH|DT_NEXT)
260
+ #define dtlast(d) (*(_DT(d)->searchf))((d),(void*)(0),DT_LAST)
261
+ #define dtprev(d,o) (*(_DT(d)->searchf))((d),(void*)(o),DT_PREV)
262
+ #define dtmost(d,o) (*(_DT(d)->searchf))((d),(void*)(o),DT_SEARCH|DT_PREV)
263
+ #define dtsearch(d,o) (*(_DT(d)->searchf))((d),(void*)(o),DT_SEARCH)
264
+ #define dtmatch(d,o) (*(_DT(d)->searchf))((d),(void*)(o),DT_MATCH)
265
+ #define dtinsert(d,o) (*(_DT(d)->searchf))((d),(void*)(o),DT_INSERT)
266
+ #define dtappend(d,o) (*(_DT(d)->searchf))((d),(void*)(o),DT_INSERT|DT_APPEND)
267
+ #define dtdelete(d,o) (*(_DT(d)->searchf))((d),(void*)(o),DT_DELETE)
268
+ #define dtattach(d,o) (*(_DT(d)->searchf))((d),(void*)(o),DT_ATTACH)
269
+ #define dtdetach(d,o) (*(_DT(d)->searchf))((d),(void*)(o),DT_DETACH)
270
+ #define dtclear(d) (*(_DT(d)->searchf))((d),(void*)(0),DT_CLEAR)
271
+ #define dtfound(d) (_DT(d)->type & DT_FOUND)
272
+
273
+ #define DT_PRIME 17109811 /* 2#00000001 00000101 00010011 00110011 */
274
+ #define dtcharhash(h,c) (((unsigned int)(h) + (unsigned int)(c)) * DT_PRIME )
275
+
276
+ /**
277
+ * @dir lib/cdt
278
+ * @brief container data types, API cdt.h
279
+ */
280
+
281
+ #ifdef __cplusplus
282
+ }
283
+ #endif
data/miniconda3/include/graphviz/cgraph.h ADDED
@@ -0,0 +1,491 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @file
3
+ * @brief abstract graph C library, @ref cgraph_api
4
+ *
5
+ * [man 3 cgraph](https://graphviz.org/pdf/cgraph.3.pdf)
6
+ *
7
+ * @defgroup cgraph_api Cgraph API
8
+ * @brief Abstract graph C library
9
+ *
10
+ * Main types @ref Agraph_t, @ref Agnode_t, @ref Agedge_t.
11
+ * @{
12
+ */
13
+
14
+ /*************************************************************************
15
+ * Copyright (c) 2011 AT&T Intellectual Property
16
+ * All rights reserved. This program and the accompanying materials
17
+ * are made available under the terms of the Eclipse Public License v1.0
18
+ * which accompanies this distribution, and is available at
19
+ * http://www.eclipse.org/legal/epl-v10.html
20
+ *
21
+ * Contributors: Details at https://graphviz.org
22
+ *************************************************************************/
23
+
24
+ #pragma once
25
+
26
+ #include <inttypes.h>
27
+ #include "cdt.h"
28
+
29
+ #ifdef __cplusplus
30
+ extern "C" {
31
+ #endif
32
+
33
+ /// @cond
34
+
35
+ #ifdef GVDLL
36
+ #ifdef EXPORT_CGRAPH
37
+ #define CGRAPH_API __declspec(dllexport)
38
+ #else
39
+ #define CGRAPH_API __declspec(dllimport)
40
+ #endif
41
+ #endif
42
+
43
+ #ifndef CGRAPH_API
44
+ #define CGRAPH_API /* nothing */
45
+ #endif
46
+
47
+ #ifndef FALSE
48
+ #define FALSE (0)
49
+ #endif
50
+ #ifndef TRUE
51
+ #define TRUE (!FALSE)
52
+ #endif
53
+
54
+ /// @endcond
55
+
56
+ typedef uint64_t IDTYPE;
57
+
58
+ /* forward struct type declarations */
59
+ typedef struct Agtag_s Agtag_t;
60
+ typedef struct Agobj_s Agobj_t; ///< generic object header
61
+ typedef struct Agraph_s Agraph_t; ///< graph, subgraph (or hyperedge)
62
+ typedef struct Agnode_s Agnode_t; ///< node (atom)
63
+ typedef struct Agedge_s Agedge_t; ///< node pair
64
+ typedef struct Agdesc_s Agdesc_t; ///< graph descriptor
65
+ typedef struct Agmemdisc_s Agmemdisc_t; ///< memory allocator
66
+ typedef struct Agiddisc_s Agiddisc_t; ///< object ID allocator
67
+ typedef struct Agiodisc_s Agiodisc_t; ///< IO services
68
+ typedef struct Agdisc_s Agdisc_t; ///< union of client discipline methods
69
+ typedef struct Agdstate_s Agdstate_t; ///< client state (closures)
70
+ typedef struct Agsym_s Agsym_t; ///< string attribute descriptors
71
+ typedef struct Agattr_s Agattr_t; ///< string attribute container
72
+ typedef struct Agcbdisc_s Agcbdisc_t; ///< client event callbacks
73
+ typedef struct Agcbstack_s Agcbstack_t; ///< enclosing state for cbdisc
74
+ typedef struct Agclos_s Agclos_t; ///< common fields for graph/subgs
75
+ typedef struct Agrec_s Agrec_t; ///< generic runtime record
76
+ typedef struct Agdatadict_s Agdatadict_t; ///< set of dictionaries per graph
77
+ typedef struct Agedgepair_s Agedgepair_t; ///< the edge object
78
+ typedef struct Agsubnode_s Agsubnode_t;
79
+
80
+ /** @brief Header of a user record.
81
+
82
+ These records are attached by client programs
83
+ dynamically at runtime. A unique string ID must be given to each record
84
+ attached to the same object. Cgraph has functions to create, search for,
85
+ and delete these records. The records are maintained in a circular list,
86
+ with obj->data pointing somewhere in the list. The search function has
87
+ an option to lock this pointer on a given record. The application must
88
+ be written so only one such lock is outstanding at a time. */
89
+
90
+ struct Agrec_s {
91
+ char *name;
92
+ Agrec_t *next;
93
+ /* following this would be any programmer-defined data */
94
+ };
95
+
96
+ /** @brief Object tag for graphs, nodes, and edges.
97
+
98
+ While there may be several structs
99
+ for a given node or edges, there is only one unique ID (per main graph). */
100
+
101
+ struct Agtag_s {
102
+ unsigned objtype:2; /* see literal tags below */
103
+ unsigned mtflock:1; /* move-to-front lock, see above */
104
+ unsigned attrwf:1; /* attrs written (parity, write.c) */
105
+ unsigned seq:(sizeof(unsigned) * 8 - 4); /* sequence no. */
106
+ IDTYPE id; /* client ID */
107
+ };
108
+
109
+ /* object tags */
110
+ #define AGRAPH 0 /* can't exceed 2 bits. see Agtag_t. */
111
+ #define AGNODE 1
112
+ #define AGOUTEDGE 2
113
+ #define AGINEDGE 3 /* (1 << 1) indicates an edge tag. */
114
+ #define AGEDGE AGOUTEDGE /* synonym in object kind args */
115
+
116
+ /// a generic graph/node/edge header
117
+ struct Agobj_s {
118
+ Agtag_t tag;
119
+ Agrec_t *data;
120
+ };
121
+
122
+ #define AGTAG(obj) (((Agobj_t*)(obj))->tag)
123
+ #define AGTYPE(obj) (AGTAG(obj).objtype)
124
+ #define AGID(obj) (AGTAG(obj).id)
125
+ #define AGSEQ(obj) (AGTAG(obj).seq)
126
+ #define AGATTRWF(obj) (AGTAG(obj).attrwf)
127
+ #define AGDATA(obj) (((Agobj_t*)(obj))->data)
128
+
129
+ /** @brief This is the node struct allocated per graph (or subgraph).
130
+
131
+ It resides in the n_dict of the graph.
132
+ The node set is maintained by libdict, but transparently to libgraph callers.
133
+ Every node may be given an optional string name at its time of creation,
134
+ or it is permissible to pass NIL(char*) for the name. */
135
+
136
+ struct Agsubnode_s { /* the node-per-graph-or-subgraph record */
137
+ Dtlink_t seq_link; /* must be first */
138
+ Dtlink_t id_link;
139
+ Agnode_t *node; /* the object */
140
+ Dtlink_t *in_id, *out_id; /* by node/ID for random access */
141
+ Dtlink_t *in_seq, *out_seq; /* by node/sequence for serial access */
142
+ };
143
+
144
+ struct Agnode_s {
145
+ Agobj_t base;
146
+ Agraph_t *root;
147
+ Agsubnode_t mainsub; /* embedded for main graph */
148
+ };
149
+
150
+ struct Agedge_s {
151
+ Agobj_t base;
152
+ Dtlink_t id_link; /* main graph only */
153
+ Dtlink_t seq_link;
154
+ Agnode_t *node; /* the endpoint node */
155
+ };
156
+
157
+ struct Agedgepair_s {
158
+ Agedge_t out, in;
159
+ };
160
+
161
+ struct Agdesc_s { /* graph descriptor */
162
+ unsigned directed:1; /* if edges are asymmetric */
163
+ unsigned strict:1; /* if multi-edges forbidden */
164
+ unsigned no_loop:1; /* if no loops */
165
+ unsigned maingraph:1; /* if this is the top level graph */
166
+ unsigned flatlock:1; /* if sets are flattened into lists in cdt */
167
+ unsigned no_write:1; /* if a temporary subgraph */
168
+ unsigned has_attrs:1; /* if string attr tables should be initialized */
169
+ unsigned has_cmpnd:1; /* if may contain collapsed nodes */
170
+ };
171
+
172
+ /* disciplines for external resources needed by libgraph */
173
+
174
+ /// memory allocator discipline, independent of other resources
175
+
176
+ struct Agmemdisc_s {
177
+ void *(*open) (Agdisc_t*);
178
+ void *(*alloc) (void *state, size_t req);
179
+ void *(*resize) (void *state, void *ptr, size_t old, size_t req);
180
+ void (*free) (void *state, void *ptr);
181
+ void (*close) (void *state);
182
+ };
183
+
184
+ /// object ID allocator discipline
185
+
186
+ struct Agiddisc_s {
187
+ void *(*open) (Agraph_t * g, Agdisc_t*); /* associated with a graph */
188
+ long (*map) (void *state, int objtype, char *str, IDTYPE *id,
189
+ int createflag);
190
+ long (*alloc) (void *state, int objtype, IDTYPE id);
191
+ void (*free) (void *state, int objtype, IDTYPE id);
192
+ char *(*print) (void *state, int objtype, IDTYPE id);
193
+ void (*close) (void *state);
194
+ void (*idregister) (void *state, int objtype, void *obj);
195
+ };
196
+
197
+ struct Agiodisc_s {
198
+ int (*afread) (void *chan, char *buf, int bufsize);
199
+ int (*putstr) (void *chan, const char *str);
200
+ int (*flush) (void *chan); /* sync */
201
+ /* error messages? */
202
+ };
203
+
204
+ /// user's discipline
205
+
206
+ struct Agdisc_s {
207
+ Agmemdisc_t *mem;
208
+ Agiddisc_t *id;
209
+ Agiodisc_t *io;
210
+ };
211
+
212
+ /* default resource disciplines */
213
+
214
+ CGRAPH_API extern Agmemdisc_t AgMemDisc;
215
+ CGRAPH_API extern Agiddisc_t AgIdDisc;
216
+ CGRAPH_API extern Agiodisc_t AgIoDisc;
217
+
218
+ CGRAPH_API extern Agdisc_t AgDefaultDisc;
219
+
220
+ struct Agdstate_s {
221
+ void *mem;
222
+ void *id;
223
+ /* IO must be initialized and finalized outside Cgraph,
224
+ * and channels (FILES) are passed as void* arguments. */
225
+ };
226
+
227
+ typedef void (*agobjfn_t) (Agraph_t * g, Agobj_t * obj, void *arg);
228
+ typedef void (*agobjupdfn_t) (Agraph_t * g, Agobj_t * obj, void *arg,
229
+ Agsym_t * sym);
230
+
231
+ struct Agcbdisc_s {
232
+ struct {
233
+ agobjfn_t ins;
234
+ agobjupdfn_t mod;
235
+ agobjfn_t del;
236
+ } graph, node, edge;
237
+ };
238
+
239
+ /// object event callbacks
240
+
241
+ struct Agcbstack_s {
242
+ Agcbdisc_t *f; /* methods */
243
+ void *state; /* closure */
244
+ Agcbstack_t *prev; /* kept in a stack, unlike other disciplines */
245
+ };
246
+
247
+ struct Agclos_s {
248
+ Agdisc_t disc; /* resource discipline functions */
249
+ Agdstate_t state; /* resource closures */
250
+ Dict_t *strdict; /* shared string dict */
251
+ uint64_t seq[3]; /* local object sequence number counter */
252
+ Agcbstack_t *cb; /* user and system callback function stacks */
253
+ unsigned char callbacks_enabled; /* issue user callbacks or hold them? */
254
+ Dict_t *lookup_by_name[3];
255
+ Dict_t *lookup_by_id[3];
256
+ };
257
+
258
+ struct Agraph_s {
259
+ Agobj_t base;
260
+ Agdesc_t desc;
261
+ Dtlink_t link;
262
+ Dict_t *n_seq; /* the node set in sequence */
263
+ Dict_t *n_id; /* the node set indexed by ID */
264
+ Dict_t *e_seq, *e_id; /* holders for edge sets */
265
+ Dict_t *g_dict; /* subgraphs - descendants */
266
+ Agraph_t *parent, *root; /* subgraphs - ancestors */
267
+ Agclos_t *clos; /* shared resources */
268
+ };
269
+
270
+ CGRAPH_API void agpushdisc(Agraph_t * g, Agcbdisc_t * disc, void *state);
271
+ CGRAPH_API int agpopdisc(Agraph_t * g, Agcbdisc_t * disc);
272
+ CGRAPH_API int agcallbacks(Agraph_t * g, int flag); /* return prev value */
273
+
274
+ /* graphs */
275
+ CGRAPH_API Agraph_t *agopen(char *name, Agdesc_t desc, Agdisc_t * disc);
276
+ CGRAPH_API int agclose(Agraph_t * g);
277
+ CGRAPH_API Agraph_t *agread(void *chan, Agdisc_t * disc);
278
+ CGRAPH_API Agraph_t *agmemread(const char *cp);
279
+ CGRAPH_API Agraph_t *agmemconcat(Agraph_t *g, const char *cp);
280
+ CGRAPH_API void agreadline(int);
281
+ CGRAPH_API void agsetfile(const char *);
282
+ CGRAPH_API Agraph_t *agconcat(Agraph_t * g, void *chan, Agdisc_t * disc);
283
+ CGRAPH_API int agwrite(Agraph_t * g, void *chan);
284
+ CGRAPH_API int agisdirected(Agraph_t * g);
285
+ CGRAPH_API int agisundirected(Agraph_t * g);
286
+ CGRAPH_API int agisstrict(Agraph_t * g);
287
+ CGRAPH_API int agissimple(Agraph_t * g);
288
+
289
+ /* nodes */
290
+ CGRAPH_API Agnode_t *agnode(Agraph_t * g, char *name, int createflag);
291
+ CGRAPH_API Agnode_t *agidnode(Agraph_t * g, IDTYPE id, int createflag);
292
+ CGRAPH_API Agnode_t *agsubnode(Agraph_t * g, Agnode_t * n, int createflag);
293
+ CGRAPH_API Agnode_t *agfstnode(Agraph_t * g);
294
+ CGRAPH_API Agnode_t *agnxtnode(Agraph_t * g, Agnode_t * n);
295
+ CGRAPH_API Agnode_t *aglstnode(Agraph_t * g);
296
+ CGRAPH_API Agnode_t *agprvnode(Agraph_t * g, Agnode_t * n);
297
+
298
+ CGRAPH_API Agsubnode_t *agsubrep(Agraph_t * g, Agnode_t * n);
299
+ CGRAPH_API int agnodebefore(Agnode_t *u, Agnode_t *v); /* we have no shame */
300
+
301
+ /* edges */
302
+ CGRAPH_API Agedge_t *agedge(Agraph_t * g, Agnode_t * t, Agnode_t * h,
303
+ char *name, int createflag);
304
+ CGRAPH_API Agedge_t *agidedge(Agraph_t * g, Agnode_t * t, Agnode_t * h,
305
+ IDTYPE id, int createflag);
306
+ CGRAPH_API Agedge_t *agsubedge(Agraph_t * g, Agedge_t * e, int createflag);
307
+ CGRAPH_API Agedge_t *agfstin(Agraph_t * g, Agnode_t * n);
308
+ CGRAPH_API Agedge_t *agnxtin(Agraph_t * g, Agedge_t * e);
309
+ CGRAPH_API Agedge_t *agfstout(Agraph_t * g, Agnode_t * n);
310
+ CGRAPH_API Agedge_t *agnxtout(Agraph_t * g, Agedge_t * e);
311
+ CGRAPH_API Agedge_t *agfstedge(Agraph_t * g, Agnode_t * n);
312
+ CGRAPH_API Agedge_t *agnxtedge(Agraph_t * g, Agedge_t * e, Agnode_t * n);
313
+
314
+ /* generic */
315
+ CGRAPH_API Agraph_t *agraphof(void* obj);
316
+ CGRAPH_API Agraph_t *agroot(void* obj);
317
+ CGRAPH_API int agcontains(Agraph_t *, void *);
318
+ CGRAPH_API char *agnameof(void *);
319
+ CGRAPH_API int agrelabel_node(Agnode_t * n, char *newname);
320
+ CGRAPH_API int agdelete(Agraph_t * g, void *obj);
321
+ CGRAPH_API int agdelsubg(Agraph_t * g, Agraph_t * sub); /* could be agclose */
322
+ CGRAPH_API int agdelnode(Agraph_t * g, Agnode_t * arg_n);
323
+ CGRAPH_API int agdeledge(Agraph_t * g, Agedge_t * arg_e);
324
+ CGRAPH_API int agobjkind(void *);
325
+
326
+ /* strings */
327
+ CGRAPH_API char *agstrdup(Agraph_t *, const char *);
328
+ CGRAPH_API char *agstrdup_html(Agraph_t *, const char *);
329
+ CGRAPH_API int aghtmlstr(const char *);
330
+ CGRAPH_API char *agstrbind(Agraph_t * g, const char *);
331
+ CGRAPH_API int agstrfree(Agraph_t *, const char *);
332
+ CGRAPH_API char *agcanon(char *, int);
333
+ CGRAPH_API char *agstrcanon(char *, char *);
334
+ CGRAPH_API char *agcanonStr(char *str); /* manages its own buf */
335
+
336
+ /// definitions for dynamic string attributes
337
+
338
+ struct Agattr_s { /* dynamic string attributes */
339
+ Agrec_t h; /* common data header */
340
+ Dict_t *dict; /* shared dict to interpret attr field */
341
+ char **str; /* the attribute string values */
342
+ };
343
+
344
+ /// symbol in one of the above dictionaries
345
+
346
+ struct Agsym_s {
347
+ Dtlink_t link;
348
+ char *name; /* attribute's name */
349
+ char *defval; /* its default value for initialization */
350
+ int id; /* its index in attr[] */
351
+ unsigned char kind; /* referent object type */
352
+ unsigned char fixed; /* immutable value */
353
+ unsigned char print; /* always print */
354
+ };
355
+
356
+ struct Agdatadict_s { /* set of dictionaries per graph */
357
+ Agrec_t h; /* installed in list of graph recs */
358
+ struct {
359
+ Dict_t *n, *e, *g;
360
+ } dict;
361
+ };
362
+
363
+ CGRAPH_API Agsym_t *agattr(Agraph_t * g, int kind, char *name,
364
+ const char *value);
365
+ CGRAPH_API Agsym_t *agattrsym(void *obj, char *name);
366
+ CGRAPH_API Agsym_t *agnxtattr(Agraph_t * g, int kind, Agsym_t * attr);
367
+ CGRAPH_API int agcopyattr(void *oldobj, void *newobj);
368
+
369
+ CGRAPH_API void *agbindrec(void *obj, const char *name, unsigned int recsize,
370
+ int move_to_front);
371
+ CGRAPH_API Agrec_t *aggetrec(void *obj, const char *name, int move_to_front);
372
+ CGRAPH_API int agdelrec(void *obj, const char *name);
373
+ CGRAPH_API void aginit(Agraph_t * g, int kind, const char *rec_name,
374
+ int rec_size, int move_to_front);
375
+ CGRAPH_API void agclean(Agraph_t * g, int kind, char *rec_name);
376
+
377
+ CGRAPH_API char *agget(void *obj, char *name);
378
+ CGRAPH_API char *agxget(void *obj, Agsym_t * sym);
379
+ CGRAPH_API int agset(void *obj, char *name, const char *value);
380
+ CGRAPH_API int agxset(void *obj, Agsym_t * sym, const char *value);
381
+ CGRAPH_API int agsafeset(void* obj, char* name, const char* value,
382
+ const char* def);
383
+
384
+ /* definitions for subgraphs */
385
+ CGRAPH_API Agraph_t *agsubg(Agraph_t * g, char *name, int cflag); /* constructor */
386
+ CGRAPH_API Agraph_t *agidsubg(Agraph_t * g, IDTYPE id, int cflag); /* constructor */
387
+ CGRAPH_API Agraph_t *agfstsubg(Agraph_t * g);
388
+ CGRAPH_API Agraph_t *agnxtsubg(Agraph_t * subg);
389
+ CGRAPH_API Agraph_t *agparent(Agraph_t * g);
390
+
391
+ /* set cardinality */
392
+ CGRAPH_API int agnnodes(Agraph_t * g);
393
+ CGRAPH_API int agnedges(Agraph_t * g);
394
+ CGRAPH_API int agnsubg(Agraph_t * g);
395
+ CGRAPH_API int agdegree(Agraph_t * g, Agnode_t * n, int in, int out);
396
+ CGRAPH_API int agcountuniqedges(Agraph_t * g, Agnode_t * n, int in, int out);
397
+
398
+ /* memory */
399
+ CGRAPH_API void *agalloc(Agraph_t * g, size_t size);
400
+ CGRAPH_API void *agrealloc(Agraph_t * g, void *ptr, size_t oldsize,
401
+ size_t size);
402
+ CGRAPH_API void agfree(Agraph_t * g, void *ptr);
403
+
404
+ /* an engineering compromise is a joy forever */
405
+ CGRAPH_API void aginternalmapclearlocalnames(Agraph_t * g);
406
+
407
+ #define agnew(g,t) ((t*)agalloc(g,sizeof(t)))
408
+ #define agnnew(g,n,t) ((t*)agalloc(g,(n)*sizeof(t)))
409
+
410
+ /// @cond
411
+
412
+ /* support for extra API misuse warnings if available */
413
+ #ifdef __GNUC__
414
+ #define PRINTF_LIKE(index, first) __attribute__((format(printf, index, first)))
415
+ #else
416
+ #define PRINTF_LIKE(index, first) /* nothing */
417
+ #endif
418
+
419
+ /// @endcond
420
+
421
+ /* error handling */
422
+ typedef enum { AGWARN, AGERR, AGMAX, AGPREV } agerrlevel_t;
423
+ typedef int (*agusererrf) (char*);
424
+ CGRAPH_API agerrlevel_t agseterr(agerrlevel_t);
425
+ CGRAPH_API char *aglasterr(void);
426
+ CGRAPH_API int agerr(agerrlevel_t level, const char *fmt, ...)
427
+ PRINTF_LIKE(2, 3);
428
+ CGRAPH_API void agerrorf(const char *fmt, ...) PRINTF_LIKE(1, 2);
429
+ CGRAPH_API void agwarningf(const char *fmt, ...) PRINTF_LIKE(1, 2);
430
+ CGRAPH_API int agerrors(void);
431
+ CGRAPH_API int agreseterrors(void);
432
+ CGRAPH_API agusererrf agseterrf(agusererrf);
433
+
434
+ #undef PRINTF_LIKE
435
+
436
+ /* data access macros */
437
+ /* this assumes that e[0] is out and e[1] is inedge, see edgepair in edge.c */
438
+ #define AGIN2OUT(e) ((e)-1)
439
+ #define AGOUT2IN(e) ((e)+1)
440
+ #define AGOPP(e) ((AGTYPE(e)==AGINEDGE)?AGIN2OUT(e):AGOUT2IN(e))
441
+ #define AGMKOUT(e) (AGTYPE(e) == AGOUTEDGE? (e): AGIN2OUT(e))
442
+ #define AGMKIN(e) (AGTYPE(e) == AGINEDGE? (e): AGOUT2IN(e))
443
+ #define AGTAIL(e) (AGMKIN(e)->node)
444
+ #define AGHEAD(e) (AGMKOUT(e)->node)
445
+ #define AGEQEDGE(e,f) (AGMKOUT(e) == AGMKOUT(f))
446
+ /* These macros are also exposed as functions, so they can be linked against. */
447
+ #define agtail(e) AGTAIL(e)
448
+ #define aghead(e) AGHEAD(e)
449
+ #define agopp(e) AGOPP(e)
450
+ #define ageqedge(e,f) AGEQEDGE(e,f)
451
+
452
+ #define TAILPORT_ID "tailport"
453
+ #define HEADPORT_ID "headport"
454
+
455
+ CGRAPH_API extern Agdesc_t Agdirected;
456
+ CGRAPH_API extern Agdesc_t Agstrictdirected;
457
+ CGRAPH_API extern Agdesc_t Agundirected;
458
+ CGRAPH_API extern Agdesc_t Agstrictundirected;
459
+
460
+ /* fast graphs */
461
+ void agflatten(Agraph_t * g, int flag);
462
+ typedef Agsubnode_t Agnoderef_t;
463
+ typedef Dtlink_t Agedgeref_t;
464
+
465
+ #define AGHEADPOINTER(g) ((Agnoderef_t*)(g->n_seq->data->hh._head))
466
+ #define AGRIGHTPOINTER(rep) ((Agnoderef_t*)((rep)->seq_link.right?((void*)((rep)->seq_link.right) - offsetof(Agsubnode_t,seq_link)):0))
467
+ #define AGLEFTPOINTER(rep) ((Agnoderef_t*)((rep)->seq_link.hl._left?((void*)((rep)->seq_link.hl._left) - offsetof(Agsubnode_t,seq_link)):0))
468
+
469
+ #define FIRSTNREF(g) (agflatten(g,1), AGHEADPOINTER(g))
470
+
471
+ #define NEXTNREF(g,rep) (AGRIGHTPOINTER(rep) == AGHEADPOINTER(g)?0:AGRIGHTPOINTER(rep))
472
+
473
+ #define PREVNREF(g,rep) (((rep)==AGHEADPOINTER(g))?0:(AGLEFTPOINTER(rep)))
474
+
475
+ #define LASTNREF(g) (agflatten(g,1), AGHEADPOINTER(g)?AGLEFTPOINTER(AGHEADPOINTER(g)):0)
476
+ #define NODEOF(rep) ((rep)->node)
477
+
478
+ #define FIRSTOUTREF(g,sn) (agflatten(g,1), (sn)->out_seq)
479
+ #define LASTOUTREF(g,sn) (agflatten(g,1), (Agedgeref_t*)dtlast(sn->out_seq))
480
+ #define FIRSTINREF(g,sn) (agflatten(g,1), (sn)->in_seq)
481
+ #define NEXTEREF(g,rep) ((rep)->right)
482
+ #define PREVEREF(g,rep) ((rep)->hl._left)
483
+ /* this is expedient but a bit slimey because it "knows" that dict entries of both nodes
484
+ and edges are embedded in main graph objects but allocated separately in subgraphs */
485
+ #define AGSNMAIN(sn) ((sn)==(&((sn)->node->mainsub)))
486
+ #define EDGEOF(sn,rep) (AGSNMAIN(sn)?((Agedge_t*)((unsigned char*)(rep) - offsetof(Agedge_t,seq_link))) : ((Dthold_t*)(rep))->obj)
487
+
488
+ #ifdef __cplusplus
489
+ }
490
+ #endif
491
+ /// @}
data/miniconda3/include/graphviz/color.h ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*************************************************************************
2
+ * Copyright (c) 2011 AT&T Intellectual Property
3
+ * All rights reserved. This program and the accompanying materials
4
+ * are made available under the terms of the Eclipse Public License v1.0
5
+ * which accompanies this distribution, and is available at
6
+ * http://www.eclipse.org/legal/epl-v10.html
7
+ *
8
+ * Contributors: Details at https://graphviz.org
9
+ *************************************************************************/
10
+
11
+ #pragma once
12
+
13
+ #ifdef __cplusplus
14
+ extern "C" {
15
+ #endif
16
+
17
+ typedef struct hsvrgbacolor_t {
18
+ char *name;
19
+ unsigned char h, s, v;
20
+ unsigned char r, g, b, a;
21
+ } hsvrgbacolor_t;
22
+
23
+ /* possible representations of color in gvcolor_t */
24
+ typedef enum { HSVA_DOUBLE, RGBA_BYTE, RGBA_WORD, CMYK_BYTE,
25
+ RGBA_DOUBLE, COLOR_STRING, COLOR_INDEX } color_type_t;
26
+
27
+ /* gvcolor_t can hold a color spec in a choice or representations */
28
+ typedef struct color_s {
29
+ union {
30
+ double RGBA[4];
31
+ double HSVA[4];
32
+ unsigned char rgba[4];
33
+ unsigned char cmyk[4];
34
+ int rrggbbaa[4];
35
+ char *string;
36
+ int index;
37
+ } u;
38
+ color_type_t type;
39
+ } gvcolor_t;
40
+
41
+ #define COLOR_MALLOC_FAIL -1
42
+ #define COLOR_UNKNOWN 1
43
+ #define COLOR_OK 0
44
+
45
+ #ifdef __cplusplus
46
+ }
47
+ #endif
data/miniconda3/include/graphviz/geom.h ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @file
3
+ * @brief geometric types and macros (e.g. points and boxes)
4
+ *
5
+ * with application to, but no specific dependence on graphs
6
+ */
7
+
8
+ /*************************************************************************
9
+ * Copyright (c) 2011 AT&T Intellectual Property
10
+ * All rights reserved. This program and the accompanying materials
11
+ * are made available under the terms of the Eclipse Public License v1.0
12
+ * which accompanies this distribution, and is available at
13
+ * http://www.eclipse.org/legal/epl-v10.html
14
+ *
15
+ * Contributors: Details at https://graphviz.org
16
+ *************************************************************************/
17
+ #pragma once
18
+
19
+ #include "arith.h"
20
+
21
+ #ifdef __cplusplus
22
+ extern "C" {
23
+ #endif
24
+
25
+ typedef struct { int x, y; } point;
26
+
27
+ typedef struct pointf_s { double x, y; } pointf;
28
+
29
+ /* tell pathplan/pathgeom.h */
30
+ #define HAVE_POINTF_S
31
+
32
+ typedef struct { point LL, UR; } box;
33
+
34
+ typedef struct { pointf LL, UR; } boxf;
35
+
36
+
37
+ /* true if point p is inside box b */
38
+ #define INSIDE(p,b) (BETWEEN((b).LL.x,(p).x,(b).UR.x) && BETWEEN((b).LL.y,(p).y,(b).UR.y))
39
+
40
+ /* true if boxes b0 and b1 overlap */
41
+ #define OVERLAP(b0,b1) (((b0).UR.x >= (b1).LL.x) && ((b1).UR.x >= (b0).LL.x) && ((b0).UR.y >= (b1).LL.y) && ((b1).UR.y >= (b0).LL.y))
42
+
43
+ /* true if box b0 completely contains b1*/
44
+ #define CONTAINS(b0,b1) (((b0).UR.x >= (b1).UR.x) && ((b0).UR.y >= (b1).UR.y) && ((b0).LL.x <= (b1).LL.x) && ((b0).LL.y <= (b1).LL.y))
45
+
46
+ /* expand box b as needed to enclose point p */
47
+ #define EXPANDBP(b, p) ((b).LL.x = MIN((b).LL.x, (p).x), (b).LL.y = MIN((b).LL.y, (p).y), (b).UR.x = MAX((b).UR.x, (p).x), (b).UR.y = MAX((b).UR.y, (p).y))
48
+
49
+ /* expand box b0 as needed to enclose box b1 */
50
+ #define EXPANDBB(b0, b1) ((b0).LL.x = MIN((b0).LL.x, (b1).LL.x), (b0).LL.y = MIN((b0).LL.y, (b1).LL.y), (b0).UR.x = MAX((b0).UR.x, (b1).UR.x), (b0).UR.y = MAX((b0).UR.y, (b1).UR.y))
51
+
52
+ #define LEN2(a,b) (SQR(a) + SQR(b))
53
+ #define LEN(a,b) (sqrt(LEN2((a),(b))))
54
+
55
+ #define DIST2(p,q) (LEN2(((p).x - (q).x),((p).y - (q).y)))
56
+ #define DIST(p,q) (sqrt(DIST2((p),(q))))
57
+
58
+ #define POINTS_PER_INCH 72
59
+ #define POINTS_PER_PC ((double)POINTS_PER_INCH / 6)
60
+ #define POINTS_PER_CM ((double)POINTS_PER_INCH * 0.393700787)
61
+ #define POINTS_PER_MM ((double)POINTS_PER_INCH * 0.0393700787)
62
+
63
+ #define POINTS(a_inches) (ROUND((a_inches)*POINTS_PER_INCH))
64
+ #define INCH2PS(a_inches) ((a_inches)*(double)POINTS_PER_INCH)
65
+ #define PS2INCH(a_points) ((a_points)/(double)POINTS_PER_INCH)
66
+
67
+ #define P2PF(p,pf) ((pf).x = (p).x,(pf).y = (p).y)
68
+ #define PF2P(pf,p) ((p).x = ROUND((pf).x),(p).y = ROUND((pf).y))
69
+
70
+ #define B2BF(b,bf) (P2PF((b).LL,(bf).LL),P2PF((b).UR,(bf).UR))
71
+ #define BF2B(bf,b) (PF2P((bf).LL,(b).LL),PF2P((bf).UR,(b).UR))
72
+
73
+ #define APPROXEQPT(p,q,tol) (DIST2((p),(q)) < SQR(tol))
74
+
75
+ /* common tolerance value */
76
+ #define MILLIPOINT .001
77
+
78
+ #ifdef __cplusplus
79
+ }
80
+ #endif
data/miniconda3/include/graphviz/graphviz_version.h ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+ #define GVPLUGIN_CONFIG_FILE "config6"
3
+ #define GVPLUGIN_VERSION 6
4
+ #define PACKAGE_BUGREPORT "https://gitlab.com/graphviz/graphviz/-/issues"
5
+ #define PACKAGE_NAME "graphviz"
6
+ #define PACKAGE_STRING "graphviz 7.1.0"
7
+ #define PACKAGE_TARNAME "graphviz"
8
+ #define PACKAGE_URL ""
9
+ #define PACKAGE_VERSION "7.1.0"
data/miniconda3/include/graphviz/gv.cpp ADDED
@@ -0,0 +1,739 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*************************************************************************
2
+ * Copyright (c) 2011 AT&T Intellectual Property
3
+ * All rights reserved. This program and the accompanying materials
4
+ * are made available under the terms of the Eclipse Public License v1.0
5
+ * which accompanies this distribution, and is available at
6
+ * http://www.eclipse.org/legal/epl-v10.html
7
+ *
8
+ * Contributors: Details at https://graphviz.org
9
+ *************************************************************************/
10
+
11
+ #include <cstdlib>
12
+ #include <cstring>
13
+ #include <gvc/gvc.h>
14
+ #include <string>
15
+ #include "gv_channel.h"
16
+
17
+ #define agfindattr(x, s) agattrsym(x, s)
18
+ #define agraphattr(g, n, s) agattr(g, AGRAPH, n, s)
19
+ #define agnodeattr(g, n, s) agattr(g, AGNODE, n, s)
20
+ #define agedgeattr(g, n, s) agattr(g, AGEDGE, n, s)
21
+
22
+ static char emptystring[] = {'\0'};
23
+
24
+ static GVC_t *gvc;
25
+
26
+ static void gv_init(void) {
27
+ // list of builtins, enable demand loading
28
+ gvc = gvContextPlugins(lt_preloaded_symbols, DEMAND_LOADING);
29
+ }
30
+
31
+ Agraph_t *graph(char *name) {
32
+ if (!gvc)
33
+ gv_init();
34
+ return agopen(name, Agundirected, 0);
35
+ }
36
+
37
+ Agraph_t *digraph(char *name) {
38
+ if (!gvc)
39
+ gv_init();
40
+ return agopen(name, Agdirected, 0);
41
+ }
42
+
43
+ Agraph_t *strictgraph(char *name) {
44
+ if (!gvc)
45
+ gv_init();
46
+ return agopen(name, Agstrictundirected, 0);
47
+ }
48
+
49
+ Agraph_t *strictdigraph(char *name) {
50
+ if (!gvc)
51
+ gv_init();
52
+ return agopen(name, Agstrictdirected, 0);
53
+ }
54
+
55
+ Agraph_t *readstring(char *string) {
56
+ if (!gvc)
57
+ gv_init();
58
+ return agmemread(string);
59
+ }
60
+
61
+ Agraph_t *read(FILE *f) {
62
+ if (!gvc)
63
+ gv_init();
64
+ return agread(f, nullptr);
65
+ }
66
+
67
+ Agraph_t *read(const char *filename) {
68
+ FILE *f = fopen(filename, "r");
69
+ if (!f)
70
+ return nullptr;
71
+ if (!gvc)
72
+ gv_init();
73
+ Agraph_t *g = agread(f, nullptr);
74
+ fclose(f);
75
+ return g;
76
+ }
77
+
78
+ //-------------------------------------------------
79
+ Agraph_t *graph(Agraph_t *g, char *name) {
80
+ if (!gvc)
81
+ gv_init();
82
+ return agsubg(g, name, 1);
83
+ }
84
+
85
+ Agnode_t *node(Agraph_t *g, char *name) {
86
+ if (!gvc)
87
+ return nullptr;
88
+ return agnode(g, name, 1);
89
+ }
90
+
91
+ Agedge_t *edge(Agraph_t *g, Agnode_t *t, Agnode_t *h) {
92
+ if (!gvc || !t || !h || !g)
93
+ return nullptr;
94
+ // edges from/to the protonode are not permitted
95
+ if (AGTYPE(t) == AGRAPH || AGTYPE(h) == AGRAPH)
96
+ return nullptr;
97
+ return agedge(g, t, h, nullptr, 1);
98
+ }
99
+
100
+ Agedge_t *edge(Agnode_t *t, Agnode_t *h) { return edge(agraphof(t), t, h); }
101
+
102
+ // induce tail if necessary
103
+ Agedge_t *edge(char *tname, Agnode_t *h) {
104
+ return edge(node(agraphof(h), tname), h);
105
+ }
106
+
107
+ // induce head if necessary
108
+ Agedge_t *edge(Agnode_t *t, char *hname) {
109
+ return edge(t, node(agraphof(t), hname));
110
+ }
111
+
112
+ // induce tail/head if necessary
113
+ Agedge_t *edge(Agraph_t *g, char *tname, char *hname) {
114
+ return edge(g, node(g, tname), node(g, hname));
115
+ }
116
+
117
+ //-------------------------------------------------
118
+ static char *myagxget(void *obj, Agsym_t *a) {
119
+ if (!obj || !a)
120
+ return emptystring;
121
+ char *val = agxget(obj, a);
122
+ if (!val)
123
+ return emptystring;
124
+ if (strcmp(a->name, "label") == 0 && aghtmlstr(val)) {
125
+ size_t len = strlen(val);
126
+ auto hs = reinterpret_cast<char *>(malloc(len + 3));
127
+ hs[0] = '<';
128
+ strcpy(hs + 1, val);
129
+ hs[len + 1] = '>';
130
+ hs[len + 2] = '\0';
131
+ return hs;
132
+ }
133
+ return val;
134
+ }
135
+ char *getv(Agraph_t *g, Agsym_t *a) { return myagxget(g, a); }
136
+ char *getv(Agraph_t *g, char *attr) {
137
+ if (!g || !attr)
138
+ return nullptr;
139
+ Agsym_t *a = agfindattr(agroot(g), attr);
140
+ return myagxget(g, a);
141
+ }
142
+ static void myagxset(void *obj, Agsym_t *a, char *val) {
143
+ if (strcmp(a->name, "label") == 0 && val[0] == '<') {
144
+ size_t len = strlen(val);
145
+ if (val[len - 1] == '>') {
146
+ std::string hs(val + 1, len - 2);
147
+ val = agstrdup_html(agraphof(obj), hs.c_str());
148
+ }
149
+ }
150
+ agxset(obj, a, val);
151
+ }
152
+ char *setv(Agraph_t *g, Agsym_t *a, char *val) {
153
+ if (!g || !a || !val)
154
+ return nullptr;
155
+ myagxset(g, a, val);
156
+ return val;
157
+ }
158
+ char *setv(Agraph_t *g, char *attr, char *val) {
159
+ if (!g || !attr || !val)
160
+ return nullptr;
161
+ Agsym_t *a = agfindattr(agroot(g), attr);
162
+ if (!a)
163
+ a = agraphattr(g->root, attr, emptystring);
164
+ myagxset(g, a, val);
165
+ return val;
166
+ }
167
+ //-------------------------------------------------
168
+ char *getv(Agnode_t *n, Agsym_t *a) {
169
+ if (!n || !a)
170
+ return nullptr;
171
+ if (AGTYPE(n) == AGRAPH) // protonode
172
+ return nullptr; // FIXME ??
173
+ return myagxget(n, a);
174
+ }
175
+ char *getv(Agnode_t *n, char *attr) {
176
+ if (!n || !attr)
177
+ return nullptr;
178
+ if (AGTYPE(n) == AGRAPH) // protonode
179
+ return nullptr; // FIXME ??
180
+ Agraph_t *g = agroot(agraphof(n));
181
+ Agsym_t *a = agattr(g, AGNODE, attr, nullptr);
182
+ return myagxget(n, a);
183
+ }
184
+ char *setv(Agnode_t *n, Agsym_t *a, char *val) {
185
+ if (!n || !a || !val)
186
+ return nullptr;
187
+ if (AGTYPE(n) == AGRAPH) // protonode
188
+ return nullptr; // FIXME ??
189
+ myagxset(n, a, val);
190
+ return val;
191
+ }
192
+ char *setv(Agnode_t *n, char *attr, char *val) {
193
+
194
+ if (!n || !attr || !val)
195
+ return nullptr;
196
+ if (AGTYPE(n) == AGRAPH) { // protonode
197
+ auto g = reinterpret_cast<Agraph_t *>(n);
198
+ (void)agattr(g, AGNODE, attr,
199
+ val); // create default attribute in pseudo protonode
200
+ // FIXME? - deal with html in "label" attributes
201
+ return val;
202
+ }
203
+ Agraph_t *g = agroot(agraphof(n));
204
+ Agsym_t *a = agattr(g, AGNODE, attr, nullptr);
205
+ if (!a)
206
+ a = agnodeattr(g, attr, emptystring);
207
+ myagxset(n, a, val);
208
+ return val;
209
+ }
210
+ //-------------------------------------------------
211
+ char *getv(Agedge_t *e, Agsym_t *a) {
212
+ if (!e || !a)
213
+ return nullptr;
214
+ if (AGTYPE(e) == AGRAPH) // protoedge
215
+ return nullptr; // FIXME ??
216
+ return myagxget(e, a);
217
+ }
218
+ char *getv(Agedge_t *e, char *attr) {
219
+ if (!e || !attr)
220
+ return nullptr;
221
+ if (AGTYPE(e) == AGRAPH) // protoedge
222
+ return nullptr; // FIXME ??
223
+ Agraph_t *g = agraphof(agtail(e));
224
+ Agsym_t *a = agattr(g, AGEDGE, attr, nullptr);
225
+ return myagxget(e, a);
226
+ }
227
+ char *setv(Agedge_t *e, Agsym_t *a, char *val) {
228
+ if (!e || !a || !val)
229
+ return nullptr;
230
+ if (AGTYPE(e) == AGRAPH) // protoedge
231
+ return nullptr; // FIXME ??
232
+ myagxset(e, a, val);
233
+ return val;
234
+ }
235
+ char *setv(Agedge_t *e, char *attr, char *val) {
236
+ if (!e || !attr || !val)
237
+ return nullptr;
238
+ if (AGTYPE(e) == AGRAPH) { // protoedge
239
+ auto g = reinterpret_cast<Agraph_t *>(e);
240
+ (void)agattr(g, AGEDGE, attr,
241
+ val); // create default attribute in pseudo protoedge
242
+ // FIXME? - deal with html in "label" attributes
243
+ return val;
244
+ }
245
+ Agraph_t *g = agroot(agraphof(agtail(e)));
246
+ Agsym_t *a = agattr(g, AGEDGE, attr, nullptr);
247
+ if (!a)
248
+ a = agattr(g, AGEDGE, attr, emptystring);
249
+ myagxset(e, a, val);
250
+ return val;
251
+ }
252
+ //-------------------------------------------------
253
+ Agraph_t *findsubg(Agraph_t *g, char *name) {
254
+ if (!g || !name)
255
+ return nullptr;
256
+ return agsubg(g, name, 0);
257
+ }
258
+
259
+ Agnode_t *findnode(Agraph_t *g, char *name) {
260
+ if (!g || !name)
261
+ return nullptr;
262
+ return agnode(g, name, 0);
263
+ }
264
+
265
+ Agedge_t *findedge(Agnode_t *t, Agnode_t *h) {
266
+ if (!t || !h)
267
+ return nullptr;
268
+ if (AGTYPE(t) == AGRAPH || AGTYPE(h) == AGRAPH)
269
+ return nullptr;
270
+ return agfindedge(agraphof(t), t, h);
271
+ }
272
+
273
+ Agsym_t *findattr(Agraph_t *g, char *name) {
274
+ if (!g || !name)
275
+ return nullptr;
276
+ return agfindattr(g, name);
277
+ }
278
+
279
+ Agsym_t *findattr(Agnode_t *n, char *name) {
280
+ if (!n || !name)
281
+ return nullptr;
282
+ return agfindattr(n, name);
283
+ }
284
+
285
+ Agsym_t *findattr(Agedge_t *e, char *name) {
286
+ if (!e || !name)
287
+ return nullptr;
288
+ return agfindattr(e, name);
289
+ }
290
+
291
+ //-------------------------------------------------
292
+
293
+ Agnode_t *headof(Agedge_t *e) {
294
+ if (!e)
295
+ return nullptr;
296
+ if (AGTYPE(e) == AGRAPH)
297
+ return nullptr;
298
+ return aghead(e);
299
+ }
300
+
301
+ Agnode_t *tailof(Agedge_t *e) {
302
+ if (!e)
303
+ return nullptr;
304
+ if (AGTYPE(e) == AGRAPH)
305
+ return nullptr;
306
+ return agtail(e);
307
+ }
308
+
309
+ Agraph_t *graphof(Agraph_t *g) {
310
+ if (!g || g == g->root)
311
+ return nullptr;
312
+ return agroot(g);
313
+ }
314
+
315
+ Agraph_t *graphof(Agedge_t *e) {
316
+ if (!e)
317
+ return nullptr;
318
+ if (AGTYPE(e) == AGRAPH)
319
+ return reinterpret_cast<Agraph_t *>(
320
+ e); // graph of protoedge is itself recast
321
+ return agraphof(agtail(e));
322
+ }
323
+
324
+ Agraph_t *graphof(Agnode_t *n) {
325
+ if (!n)
326
+ return nullptr;
327
+ if (AGTYPE(n) == AGRAPH)
328
+ return reinterpret_cast<Agraph_t *>(
329
+ n); // graph of protonode is itself recast
330
+ return agraphof(n);
331
+ }
332
+
333
+ Agraph_t *rootof(Agraph_t *g) {
334
+ if (!g)
335
+ return nullptr;
336
+ return agroot(g);
337
+ }
338
+
339
+ //-------------------------------------------------
340
+ Agnode_t *protonode(Agraph_t *g) {
341
+ return reinterpret_cast<Agnode_t *>(g); // gross abuse of the type system!
342
+ }
343
+
344
+ Agedge_t *protoedge(Agraph_t *g) {
345
+ return reinterpret_cast<Agedge_t *>(g); // gross abuse of the type system!
346
+ }
347
+
348
+ //-------------------------------------------------
349
+ char *nameof(Agraph_t *g) {
350
+ if (!g)
351
+ return nullptr;
352
+ return agnameof(g);
353
+ }
354
+ char *nameof(Agnode_t *n) {
355
+ if (!n)
356
+ return nullptr;
357
+ if (AGTYPE(n) == AGRAPH)
358
+ return nullptr;
359
+ return agnameof(n);
360
+ }
361
+ char *nameof(Agsym_t *a) {
362
+ if (!a)
363
+ return nullptr;
364
+ return a->name;
365
+ }
366
+
367
+ //-------------------------------------------------
368
+ bool ok(Agraph_t *g) { return g != nullptr; }
369
+ bool ok(Agnode_t *n) { return n != nullptr; }
370
+ bool ok(Agedge_t *e) { return e != nullptr; }
371
+ bool ok(Agsym_t *a) { return a != nullptr; }
372
+ //-------------------------------------------------
373
+ Agraph_t *firstsubg(Agraph_t *g) {
374
+ if (!g)
375
+ return nullptr;
376
+ return agfstsubg(g);
377
+ }
378
+
379
+ Agraph_t *nextsubg(Agraph_t *g, Agraph_t *sg) {
380
+
381
+ if (!g || !sg)
382
+ return nullptr;
383
+ return agnxtsubg(sg);
384
+ }
385
+
386
+ Agraph_t *firstsupg(Agraph_t *g) { return g->parent; }
387
+
388
+ Agraph_t *nextsupg(Agraph_t *, Agraph_t *) { return nullptr; }
389
+
390
+ Agedge_t *firstout(Agraph_t *g) {
391
+ if (!g)
392
+ return nullptr;
393
+ for (Agnode_t *n = agfstnode(g); n; n = agnxtnode(g, n)) {
394
+ Agedge_t *e = agfstout(g, n);
395
+ if (e)
396
+ return e;
397
+ }
398
+ return nullptr;
399
+ }
400
+
401
+ Agedge_t *nextout(Agraph_t *g, Agedge_t *e) {
402
+ if (!g || !e)
403
+ return nullptr;
404
+ Agedge_t *ne = agnxtout(g, e);
405
+ if (ne)
406
+ return (ne);
407
+ for (Agnode_t *n = agnxtnode(g, agtail(e)); n; n = agnxtnode(g, n)) {
408
+ ne = agfstout(g, n);
409
+ if (ne)
410
+ return ne;
411
+ }
412
+ return nullptr;
413
+ }
414
+
415
+ Agedge_t *firstedge(Agraph_t *g) { return firstout(g); }
416
+
417
+ Agedge_t *nextedge(Agraph_t *g, Agedge_t *e) { return nextout(g, e); }
418
+
419
+ Agedge_t *firstout(Agnode_t *n) {
420
+ if (!n)
421
+ return nullptr;
422
+ return agfstout(agraphof(n), n);
423
+ }
424
+
425
+ Agedge_t *nextout(Agnode_t *n, Agedge_t *e) {
426
+ if (!n || !e)
427
+ return nullptr;
428
+ return agnxtout(agraphof(n), e);
429
+ }
430
+
431
+ Agnode_t *firsthead(Agnode_t *n) {
432
+ if (!n)
433
+ return nullptr;
434
+ Agedge_t *e = agfstout(agraphof(n), n);
435
+ if (!e)
436
+ return nullptr;
437
+ return aghead(e);
438
+ }
439
+
440
+ Agnode_t *nexthead(Agnode_t *n, Agnode_t *h) {
441
+ if (!n || !h)
442
+ return nullptr;
443
+ Agraph_t *g = agraphof(n);
444
+ Agedge_t *e = agfindedge(g, n, h);
445
+ if (!e)
446
+ return nullptr;
447
+ do {
448
+ e = agnxtout(g, AGMKOUT(e));
449
+ if (!e)
450
+ return nullptr;
451
+ } while (aghead(e) == h);
452
+ return aghead(e);
453
+ }
454
+
455
+ Agedge_t *firstedge(Agnode_t *n) {
456
+ if (!n)
457
+ return nullptr;
458
+ return agfstedge(agraphof(n), n);
459
+ }
460
+
461
+ Agedge_t *nextedge(Agnode_t *n, Agedge_t *e) {
462
+ if (!n || !e)
463
+ return nullptr;
464
+ return agnxtedge(agraphof(n), e, n);
465
+ }
466
+
467
+ Agedge_t *firstin(Agraph_t *g) {
468
+ if (!g)
469
+ return nullptr;
470
+ Agnode_t *n = agfstnode(g);
471
+ if (!n)
472
+ return nullptr;
473
+ return agfstin(g, n);
474
+ }
475
+
476
+ Agedge_t *nextin(Agraph_t *g, Agedge_t *e) {
477
+ if (!g || !e)
478
+ return nullptr;
479
+ Agedge_t *ne = agnxtin(g, e);
480
+ if (ne)
481
+ return (ne);
482
+ Agnode_t *n = agnxtnode(g, aghead(e));
483
+ if (!n)
484
+ return nullptr;
485
+ return agfstin(g, n);
486
+ }
487
+
488
+ Agedge_t *firstin(Agnode_t *n) {
489
+ if (!n)
490
+ return nullptr;
491
+ return agfstin(agraphof(n), n);
492
+ }
493
+
494
+ Agedge_t *nextin(Agnode_t *n, Agedge_t *e) {
495
+ if (!n || !e)
496
+ return nullptr;
497
+ return agnxtin(agraphof(n), e);
498
+ }
499
+
500
+ Agnode_t *firsttail(Agnode_t *n) {
501
+ if (!n)
502
+ return nullptr;
503
+ Agedge_t *e = agfstin(agraphof(n), n);
504
+ if (!e)
505
+ return nullptr;
506
+ return agtail(e);
507
+ }
508
+
509
+ Agnode_t *nexttail(Agnode_t *n, Agnode_t *t) {
510
+ if (!n || !t)
511
+ return nullptr;
512
+ Agraph_t *g = agraphof(n);
513
+ Agedge_t *e = agfindedge(g, t, n);
514
+ if (!e)
515
+ return nullptr;
516
+ do {
517
+ e = agnxtin(g, AGMKIN(e));
518
+ if (!e)
519
+ return nullptr;
520
+ } while (agtail(e) == t);
521
+ return agtail(e);
522
+ }
523
+
524
+ Agnode_t *firstnode(Agraph_t *g) {
525
+ if (!g)
526
+ return nullptr;
527
+ return agfstnode(g);
528
+ }
529
+
530
+ Agnode_t *nextnode(Agraph_t *g, Agnode_t *n) {
531
+ if (!g || !n)
532
+ return nullptr;
533
+ return agnxtnode(g, n);
534
+ }
535
+
536
+ Agnode_t *firstnode(Agedge_t *e) {
537
+ if (!e)
538
+ return nullptr;
539
+ return agtail(e);
540
+ }
541
+
542
+ Agnode_t *nextnode(Agedge_t *e, Agnode_t *n) {
543
+ if (!e || n != agtail(e))
544
+ return nullptr;
545
+ return aghead(e);
546
+ }
547
+
548
+ Agsym_t *firstattr(Agraph_t *g) {
549
+ if (!g)
550
+ return nullptr;
551
+ g = agroot(g);
552
+ return agnxtattr(g, AGRAPH, nullptr);
553
+ }
554
+
555
+ Agsym_t *nextattr(Agraph_t *g, Agsym_t *a) {
556
+ if (!g || !a)
557
+ return nullptr;
558
+ g = agroot(g);
559
+ return agnxtattr(g, AGRAPH, a);
560
+ }
561
+
562
+ Agsym_t *firstattr(Agnode_t *n) {
563
+ if (!n)
564
+ return nullptr;
565
+ Agraph_t *g = agraphof(n);
566
+ return agnxtattr(g, AGNODE, nullptr);
567
+ }
568
+
569
+ Agsym_t *nextattr(Agnode_t *n, Agsym_t *a) {
570
+ if (!n || !a)
571
+ return nullptr;
572
+ Agraph_t *g = agraphof(n);
573
+ return agnxtattr(g, AGNODE, a);
574
+ }
575
+
576
+ Agsym_t *firstattr(Agedge_t *e) {
577
+ if (!e)
578
+ return nullptr;
579
+ Agraph_t *g = agraphof(agtail(e));
580
+ return agnxtattr(g, AGEDGE, nullptr);
581
+ }
582
+
583
+ Agsym_t *nextattr(Agedge_t *e, Agsym_t *a) {
584
+ if (!e || !a)
585
+ return nullptr;
586
+ Agraph_t *g = agraphof(agtail(e));
587
+ return agnxtattr(g, AGEDGE, a);
588
+ }
589
+
590
+ bool rm(Agraph_t *g) {
591
+ if (!g)
592
+ return false;
593
+ // The rm function appears to have the semantics of agclose, so
594
+ // we should just do that, and let cgraph take care of all the
595
+ // details.
596
+ agclose(g);
597
+ return true;
598
+ }
599
+
600
+ bool rm(Agnode_t *n) {
601
+ if (!n)
602
+ return false;
603
+ // removal of the protonode is not permitted
604
+ if (strcmp(agnameof(n), "\001proto") == 0)
605
+ return false;
606
+ agdelete(agraphof(n), n);
607
+ return true;
608
+ }
609
+
610
+ bool rm(Agedge_t *e) {
611
+ if (!e)
612
+ return false;
613
+ // removal of the protoedge is not permitted
614
+ if (strcmp(agnameof(aghead(e)), "\001proto") == 0 ||
615
+ strcmp(agnameof(agtail(e)), "\001proto") == 0)
616
+ return false;
617
+ agdelete(agroot(agraphof(aghead(e))), e);
618
+ return true;
619
+ }
620
+
621
+ bool layout(Agraph_t *g, const char *engine) {
622
+ if (!g)
623
+ return false;
624
+ (void)gvFreeLayout(gvc, g); // ignore errors
625
+ int err = gvLayout(gvc, g, engine);
626
+ return err == 0;
627
+ }
628
+
629
+ // annotate the graph with layout information
630
+ bool render(Agraph_t *g) {
631
+ if (!g)
632
+ return false;
633
+ attach_attrs(g);
634
+ return true;
635
+ }
636
+
637
+ // render to stdout
638
+ bool render(Agraph_t *g, const char *format) {
639
+ if (!g)
640
+ return false;
641
+ int err = gvRender(gvc, g, format, stdout);
642
+ return err == 0;
643
+ }
644
+
645
+ // render to an open FILE
646
+ bool render(Agraph_t *g, const char *format, FILE *f) {
647
+ if (!g)
648
+ return false;
649
+ int err = gvRender(gvc, g, format, f);
650
+ return err == 0;
651
+ }
652
+
653
+ // render to an open channel
654
+ bool renderchannel(Agraph_t *g, const char *format, const char *channelname) {
655
+ if (!g)
656
+ return false;
657
+ gv_channel_writer_init(gvc);
658
+ int err = gvRender(gvc, g, format, (FILE *)channelname);
659
+ gv_writer_reset(gvc); // Reset to default
660
+ return err == 0;
661
+ }
662
+
663
+ // render to a filename
664
+ bool render(Agraph_t *g, const char *format, const char *filename) {
665
+ if (!g)
666
+ return false;
667
+ int err = gvRenderFilename(gvc, g, format, filename);
668
+ return err == 0;
669
+ }
670
+
671
+ typedef struct {
672
+ char *data;
673
+ int sz; // buffer size
674
+ int len; // length of array
675
+ } BA;
676
+
677
+ // render to string result, using binding-dependent gv_string_writer()
678
+ char *renderresult(Agraph_t *g, const char *format) {
679
+ if (!g)
680
+ return nullptr;
681
+ if (!GD_alg(g))
682
+ return nullptr;
683
+ BA ba;
684
+ ba.sz = BUFSIZ;
685
+ // must be freed by wrapper code
686
+ ba.data = reinterpret_cast<char *>(malloc(ba.sz * sizeof(char)));
687
+ ba.len = 0;
688
+ gv_string_writer_init(gvc);
689
+ (void)gvRender(gvc, g, format, reinterpret_cast<FILE *>(&ba));
690
+ gv_writer_reset(gvc); // Reset to default
691
+ *reinterpret_cast<int *>(GD_alg(g)) = ba.len;
692
+ return ba.data;
693
+ }
694
+
695
+ // render to string result, using binding-dependent gv_string_writer()
696
+ void renderresult(Agraph_t *g, const char *format, char *outdata) {
697
+ if (!g)
698
+ return;
699
+ gv_string_writer_init(gvc);
700
+ (void)gvRender(gvc, g, format, reinterpret_cast<FILE *>(outdata));
701
+ gv_writer_reset(gvc); // Reset to default
702
+ }
703
+
704
+ // render to a malloc'ed data string, to be free'd by caller.
705
+ char *renderdata(Agraph_t *g, const char *format) {
706
+ if (!g)
707
+ return nullptr;
708
+ char *data;
709
+ unsigned int length;
710
+ int err = gvRenderData(gvc, g, format, &data, &length);
711
+ if (err)
712
+ return nullptr;
713
+ return data;
714
+ }
715
+
716
+ bool write(Agraph_t *g, FILE *f) {
717
+ if (!g)
718
+ return false;
719
+ int err = agwrite(g, f);
720
+ return err == 0;
721
+ }
722
+
723
+ bool write(Agraph_t *g, const char *filename) {
724
+ if (!g)
725
+ return false;
726
+ FILE *f = fopen(filename, "w");
727
+ if (!f)
728
+ return false;
729
+ int err = agwrite(g, f);
730
+ fclose(f);
731
+ return err == 0;
732
+ }
733
+
734
+ bool tred(Agraph_t *g) {
735
+ if (!g)
736
+ return false;
737
+ int err = gvToolTred(g);
738
+ return err == 0;
739
+ }
data/miniconda3/include/graphviz/gv.i ADDED
@@ -0,0 +1,245 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*************************************************************************
2
+ * Copyright (c) 2011 AT&T Intellectual Property
3
+ * All rights reserved. This program and the accompanying materials
4
+ * are made available under the terms of the Eclipse Public License v1.0
5
+ * which accompanies this distribution, and is available at
6
+ * http://www.eclipse.org/legal/epl-v10.html
7
+ *
8
+ * Contributors: Details at https://graphviz.org
9
+ *************************************************************************/
10
+
11
+ %module gv
12
+
13
+ #ifdef SWIGTCL
14
+ // A typemap telling SWIG to ignore an argument for input
15
+ // However, we still need to pass a pointer to the C function
16
+ %typemap(in,numinputs=0) char *outdata (Tcl_Obj *o) {
17
+ o = Tcl_NewStringObj(NULL, -1);
18
+ $1 = (char*)o;
19
+ }
20
+ // A typemap defining how to return an argument by appending it to the result
21
+ %typemap(argout) char *outdata {
22
+ Tcl_ListObjAppendElement(interp,$result,(Tcl_Obj*)$1);
23
+ }
24
+
25
+ // A typemap telling SWIG to map const char *channelname to Tcl_Channel *chan
26
+ %typemap(in) const char *channelname (int mode) {
27
+ $1 = (char*)Tcl_GetChannel(interp, Tcl_GetString($input), &mode);
28
+ // FIXME - need to error if chan is NULL or mode not TCL_WRITABLE
29
+ }
30
+ #endif
31
+
32
+ #ifdef SWIGJAVA
33
+ %typemap(jstype) char* renderresult "byte[]"
34
+ %typemap(jtype) char* renderresult "byte[]"
35
+ %typemap(jni) char* renderresult "jbyteArray"
36
+ %typemap(in) Agraph_t *ing (int sz) {
37
+ $1 = *(Agraph_t **)&jarg1;
38
+ GD_alg($1) = &sz;
39
+ }
40
+ %typemap(out) char* renderresult {
41
+ $result = jenv->NewByteArray (sz1);
42
+ jenv->SetByteArrayRegion ($result, 0, sz1, (jbyte*)$1);
43
+ free ($1);
44
+ }
45
+ #endif
46
+
47
+ /* */
48
+ %inline %{
49
+ /* some language headers (e.g. php.h, ruby.h) leave these defined */
50
+ #undef PACKAGE_BUGREPORT
51
+ #undef PACKAGE_STRING
52
+ #undef PACKAGE_TARNAME
53
+ #undef PACKAGE_VERSION
54
+ #undef PACKAGE_NAME
55
+
56
+ #ifdef SWIGOCAML
57
+ #include <stdint.h>
58
+ #endif
59
+
60
+ #include "config.h"
61
+ #include <gvc/gvc.h>
62
+
63
+ /** New graphs */
64
+ /*** New empty graph */
65
+ extern Agraph_t *graph(char *name);
66
+ extern Agraph_t *digraph(char *name);
67
+ extern Agraph_t *strictgraph(char *name);
68
+ extern Agraph_t *strictdigraph(char *name);
69
+ /*** New graph from a dot-syntax string or file */
70
+ extern Agraph_t *readstring(char *string);
71
+ extern Agraph_t *read(const char *filename);
72
+ extern Agraph_t *read(FILE *f);
73
+ /*** Add new subgraph to existing graph */
74
+ extern Agraph_t *graph(Agraph_t *g, char *name);
75
+
76
+ /** New nodes */
77
+ /*** Add new node to existing graph */
78
+ extern Agnode_t *node(Agraph_t *g, char *name);
79
+
80
+ /** New edges */
81
+ /*** Add new edge between existing nodes */
82
+ extern Agedge_t *edge(Agnode_t *t, Agnode_t *h);
83
+ /*** Add a new edge between an existing tail node, and a named head node which will be induced in the graph if it doesn't already exist */
84
+ extern Agedge_t *edge(Agnode_t *t, char *hname);
85
+ /*** Add a new edge between an existing head node, and a named tail node which will be induced in the graph if it doesn't already exist */
86
+ extern Agedge_t *edge(char *tname, Agnode_t *h);
87
+ /*** Add a new edge between named tail and head nodes which will be induced in the graph if they don't already exist */
88
+ extern Agedge_t *edge(Agraph_t *g, char *tname, char *hname);
89
+
90
+ /** Setting attribute values */
91
+ /*** Set value of named attribute of graph/node/edge - creating attribute if necessary */
92
+ extern char *setv(Agraph_t *g, char *attr, char *val);
93
+ extern char *setv(Agnode_t *n, char *attr, char *val);
94
+ extern char *setv(Agedge_t *e, char *attr, char *val);
95
+
96
+ /*** Set value of existing attribute of graph/node/edge (using attribute handle) */
97
+ extern char *setv(Agraph_t *g, Agsym_t *a, char *val);
98
+ extern char *setv(Agnode_t *n, Agsym_t *a, char *val);
99
+ extern char *setv(Agedge_t *e, Agsym_t *a, char *val);
100
+
101
+ /** Getting attribute values */
102
+ /*** Get value of named attribute of graph/node/edge */
103
+ extern char *getv(Agraph_t *g, char *attr);
104
+ extern char *getv(Agnode_t *n, char *attr);
105
+ extern char *getv(Agedge_t *e, char *attr);
106
+
107
+ /*** Get value of attribute of graph/node/edge (using attribute handle) */
108
+ extern char *getv(Agraph_t *g, Agsym_t *a);
109
+ extern char *getv(Agnode_t *n, Agsym_t *a);
110
+ extern char *getv(Agedge_t *e, Agsym_t *a);
111
+
112
+ /** Obtain names from handles */
113
+ extern char *nameof(Agraph_t *g);
114
+ extern char *nameof(Agnode_t *n);
115
+ extern char *nameof(Agsym_t *a);
116
+
117
+ /** Find handles from names */
118
+ extern Agraph_t *findsubg(Agraph_t *g, char *name);
119
+ extern Agnode_t *findnode(Agraph_t *g, char *name);
120
+ extern Agedge_t *findedge(Agnode_t *t, Agnode_t *h);
121
+
122
+ /** */
123
+ extern Agsym_t *findattr(Agraph_t *g, char *name);
124
+ extern Agsym_t *findattr(Agnode_t *n, char *name);
125
+ extern Agsym_t *findattr(Agedge_t *e, char *name);
126
+
127
+ /** Misc graph navigators returning handles */
128
+ extern Agnode_t *headof(Agedge_t *e);
129
+ extern Agnode_t *tailof(Agedge_t *e);
130
+ extern Agraph_t *graphof(Agraph_t *g);
131
+ extern Agraph_t *graphof(Agedge_t *e);
132
+ extern Agraph_t *graphof(Agnode_t *n);
133
+ extern Agraph_t *rootof(Agraph_t *g);
134
+
135
+ /** Obtain handles of proto node/edge for setting default attribute values */
136
+ extern Agnode_t *protonode(Agraph_t *g);
137
+ extern Agedge_t *protoedge(Agraph_t *g);
138
+
139
+ /** Iterators */
140
+ /*** Iteration termination tests */
141
+ extern bool ok(Agraph_t *g);
142
+ extern bool ok(Agnode_t *n);
143
+ extern bool ok(Agedge_t *e);
144
+ extern bool ok(Agsym_t *a);
145
+
146
+ /*** Iterate over subgraphs of a graph */
147
+ extern Agraph_t *firstsubg(Agraph_t *g);
148
+ extern Agraph_t *nextsubg(Agraph_t *g, Agraph_t *sg);
149
+
150
+ /*** Iterate over supergraphs of a graph (obscure and rarely useful) */
151
+ extern Agraph_t *firstsupg(Agraph_t *g);
152
+ extern Agraph_t *nextsupg(Agraph_t *g, Agraph_t *sg);
153
+
154
+ /*** Iterate over edges of a graph */
155
+ extern Agedge_t *firstedge(Agraph_t *g);
156
+ extern Agedge_t *nextedge(Agraph_t *g, Agedge_t *e);
157
+
158
+ /*** Iterate over outedges of a graph */
159
+ extern Agedge_t *firstout(Agraph_t *g);
160
+ extern Agedge_t *nextout(Agraph_t *g, Agedge_t *e);
161
+
162
+ /*** Iterate over edges of a node */
163
+ extern Agedge_t *firstedge(Agnode_t *n);
164
+ extern Agedge_t *nextedge(Agnode_t *n, Agedge_t *e);
165
+
166
+ /*** Iterate over out-edges of a node */
167
+ extern Agedge_t *firstout(Agnode_t *n);
168
+ extern Agedge_t *nextout(Agnode_t *n, Agedge_t *e);
169
+
170
+ /*** Iterate over head nodes reachable from out-edges of a node */
171
+ extern Agnode_t *firsthead(Agnode_t *n);
172
+ extern Agnode_t *nexthead(Agnode_t *n, Agnode_t *h);
173
+
174
+ /*** Iterate over in-edges of a graph */
175
+ extern Agedge_t *firstin(Agraph_t *g);
176
+ extern Agedge_t *nextin(Agnode_t *n, Agedge_t *e);
177
+
178
+ /*** Iterate over in-edges of a node */
179
+ extern Agedge_t *firstin(Agnode_t *n);
180
+ extern Agedge_t *nextin(Agraph_t *g, Agedge_t *e);
181
+
182
+ /*** Iterate over tail nodes reachable from in-edges of a node */
183
+ extern Agnode_t *firsttail(Agnode_t *n);
184
+ extern Agnode_t *nexttail(Agnode_t *n, Agnode_t *t);
185
+
186
+ /*** Iterate over nodes of a graph */
187
+ extern Agnode_t *firstnode(Agraph_t *g);
188
+ extern Agnode_t *nextnode(Agraph_t *g, Agnode_t *n);
189
+
190
+ /*** Iterate over nodes of an edge */
191
+ extern Agnode_t *firstnode(Agedge_t *e);
192
+ extern Agnode_t *nextnode(Agedge_t *e, Agnode_t *n);
193
+
194
+ /*** Iterate over attributes of a graph */
195
+ extern Agsym_t *firstattr(Agraph_t *g);
196
+ extern Agsym_t *nextattr(Agraph_t *g, Agsym_t *a);
197
+
198
+ /*** Iterate over attributes of an edge */
199
+ extern Agsym_t *firstattr(Agedge_t *e);
200
+ extern Agsym_t *nextattr(Agedge_t *e, Agsym_t *a);
201
+
202
+ /*** Iterate over attributes of a node */
203
+ extern Agsym_t *firstattr(Agnode_t *n);
204
+ extern Agsym_t *nextattr(Agnode_t *n, Agsym_t *a);
205
+
206
+ /** Remove graph objects */
207
+ extern bool rm(Agraph_t *g);
208
+ extern bool rm(Agnode_t *n);
209
+ extern bool rm(Agedge_t *e);
210
+
211
+ /** Layout */
212
+ /*** Annotate a graph with layout attributes and values using a specific layout engine */
213
+ extern bool layout(Agraph_t *g, const char *engine);
214
+
215
+ /** Render */
216
+ /*** Render a layout into attributes of the graph */
217
+ extern bool render(Agraph_t *g);
218
+ /*** Render a layout to stdout */
219
+ extern bool render(Agraph_t *g, const char *format);
220
+ /*** Render to an open file */
221
+ extern bool render(Agraph_t *g, const char *format, FILE *fout);
222
+ /*** Render a layout to an unopened file by name */
223
+ extern bool render(Agraph_t *g, const char *format, const char *filename);
224
+ /*** Render to a string result */
225
+ #ifdef SWIGJAVA
226
+ extern char* renderresult(Agraph_t *ing, const char *format);
227
+ #else
228
+ extern void renderresult(Agraph_t *g, const char *format, char *outdata);
229
+ /*** Render to an open channel */
230
+ extern bool renderchannel(Agraph_t *g, const char *format, const char *channelname);
231
+ /*** Render a layout to a malloc'ed string, to be free'd by the caller */
232
+ /*** (deprecated - too easy to leak memory) */
233
+ /*** (still needed for "eval [gv::renderdata $G tk]" ) */
234
+ #endif
235
+ extern char* renderdata(Agraph_t *g, const char *format);
236
+
237
+ /*** Writing graph back to file */
238
+ extern bool write(Agraph_t *g, const char *filename);
239
+ extern bool write(Agraph_t *g, FILE *f);
240
+
241
+ /*** Graph transformation tools */
242
+ extern bool tred(Agraph_t *g);
243
+
244
+ %}
245
+
data/miniconda3/include/graphviz/gvc.h ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @file
3
+ * @brief Graphviz context library
4
+ */
5
+
6
+ /*************************************************************************
7
+ * Copyright (c) 2011 AT&T Intellectual Property
8
+ * All rights reserved. This program and the accompanying materials
9
+ * are made available under the terms of the Eclipse Public License v1.0
10
+ * which accompanies this distribution, and is available at
11
+ * http://www.eclipse.org/legal/epl-v10.html
12
+ *
13
+ * Contributors: Details at https://graphviz.org
14
+ *************************************************************************/
15
+
16
+ #pragma once
17
+
18
+ #include <stdbool.h>
19
+
20
+ #include "types.h"
21
+ #include "gvplugin.h"
22
+
23
+ #ifdef __cplusplus
24
+ extern "C" {
25
+ #endif
26
+
27
+ #ifdef GVDLL
28
+ #ifdef GVC_EXPORTS
29
+ #define GVC_API __declspec(dllexport)
30
+ #else
31
+ #define GVC_API __declspec(dllimport)
32
+ #endif
33
+ #endif
34
+
35
+ #ifndef GVC_API
36
+ #define GVC_API /* nothing */
37
+ #endif
38
+
39
+ #define LAYOUT_DONE(g) (agbindrec(g, "Agraphinfo_t", 0, TRUE) && GD_drawing(g))
40
+
41
+ /* misc */
42
+ /* FIXME - this needs eliminating or renaming */
43
+ GVC_API void gvToggle(int);
44
+
45
+ /* set up a graphviz context */
46
+ GVC_API GVC_t *gvNEWcontext(const lt_symlist_t *builtins, int demand_loading);
47
+
48
+ /* set up a graphviz context - and init graph - retaining old API */
49
+ GVC_API GVC_t *gvContext(void);
50
+ /* set up a graphviz context - and init graph - with builtins */
51
+ GVC_API GVC_t *gvContextPlugins(const lt_symlist_t *builtins, int demand_loading);
52
+
53
+ /* get information associated with a graphviz context */
54
+ GVC_API char **gvcInfo(GVC_t*);
55
+ GVC_API char *gvcVersion(GVC_t*);
56
+ GVC_API char *gvcBuildDate(GVC_t*);
57
+
58
+ /* parse command line args - minimally argv[0] sets layout engine */
59
+ GVC_API int gvParseArgs(GVC_t *gvc, int argc, char **argv);
60
+ GVC_API graph_t *gvNextInputGraph(GVC_t *gvc);
61
+ GVC_API graph_t *gvPluginsGraph(GVC_t *gvc);
62
+
63
+ /* Compute a layout using a specified engine */
64
+ GVC_API int gvLayout(GVC_t *gvc, graph_t *g, const char *engine);
65
+
66
+ /* Compute a layout using layout engine from command line args */
67
+ GVC_API int gvLayoutJobs(GVC_t *gvc, graph_t *g);
68
+
69
+ /* Check if a layout has been done */
70
+ GVC_API bool gvLayoutDone(graph_t *g);
71
+
72
+ /* Render layout into string attributes of the graph */
73
+ GVC_API void attach_attrs(graph_t *g);
74
+
75
+ /* Render layout in a specified format to an open FILE */
76
+ GVC_API int gvRender(GVC_t *gvc, graph_t *g, const char *format, FILE *out);
77
+
78
+ /* Render layout in a specified format to a file with the given name */
79
+ GVC_API int gvRenderFilename(GVC_t *gvc, graph_t *g, const char *format, const char *filename);
80
+
81
+ /* Render layout in a specified format to an GVC_APIal context */
82
+ GVC_API int gvRenderContext(GVC_t *gvc, graph_t *g, const char *format, void *context);
83
+
84
+ /* Render layout in a specified format to a malloc'ed string */
85
+ GVC_API int gvRenderData(GVC_t *gvc, graph_t *g, const char *format, char **result, unsigned int *length);
86
+
87
+ /* Free memory allocated and pointed to by *result in gvRenderData */
88
+ GVC_API void gvFreeRenderData (char* data);
89
+
90
+ /* Render layout according to -T and -o options found by gvParseArgs */
91
+ GVC_API int gvRenderJobs(GVC_t *gvc, graph_t *g);
92
+
93
+ /* Clean up layout data structures - layouts are not nestable (yet) */
94
+ GVC_API int gvFreeLayout(GVC_t *gvc, graph_t *g);
95
+
96
+ /* Clean up graphviz context */
97
+ GVC_API void gvFinalize(GVC_t *gvc);
98
+ GVC_API int gvFreeContext(GVC_t *gvc);
99
+
100
+ /* Return list of plugins of type kind.
101
+ * kind would normally be "render" "layout" "textlayout" "device" "loadimage"
102
+ * The size of the list is stored in sz.
103
+ * The caller is responsible for freeing the storage. This involves
104
+ * freeing each item, then the list.
105
+ * Returns NULL on error, or if there are no plugins.
106
+ * In the former case, sz is unchanged; in the latter, sz = 0.
107
+ *
108
+ * At present, the str argument is unused, but may be used to modify
109
+ * the search as in gvplugin_list above.
110
+ */
111
+ GVC_API char** gvPluginList (GVC_t *gvc, const char* kind, int* sz, char*);
112
+
113
+ /** Add a library from your user application
114
+ * @param gvc Graphviz context to add library to
115
+ * @param lib library to add
116
+ */
117
+ GVC_API void gvAddLibrary(GVC_t *gvc, gvplugin_library_t *lib);
118
+
119
+ /** Perform a Transitive Reduction on a graph
120
+ * @param g graph to be transformed.
121
+ */
122
+ GVC_API int gvToolTred(graph_t *g);
123
+
124
+ #undef GVC_API
125
+
126
+ #ifdef __cplusplus
127
+ }
128
+ #endif
data/miniconda3/include/graphviz/gvcext.h ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*************************************************************************
2
+ * Copyright (c) 2011 AT&T Intellectual Property
3
+ * All rights reserved. This program and the accompanying materials
4
+ * are made available under the terms of the Eclipse Public License v1.0
5
+ * which accompanies this distribution, and is available at
6
+ * http://www.eclipse.org/legal/epl-v10.html
7
+ *
8
+ * Contributors: Details at https://graphviz.org
9
+ *************************************************************************/
10
+
11
+ /* Common header used by both clients and plugins */
12
+
13
+ #pragma once
14
+
15
+ #ifdef __cplusplus
16
+ extern "C" {
17
+ #endif
18
+
19
+ /*
20
+ * Define an apis array of name strings using an enumerated api_t as index.
21
+ * The enumerated type is defined here. The apis array is
22
+ * inititialized in gvplugin.c by redefining ELEM and reinvoking APIS.
23
+ */
24
+ #define APIS ELEM(render) ELEM(layout) ELEM(textlayout) ELEM(device) ELEM(loadimage)
25
+
26
+ /*
27
+ * Define api_t using names based on the plugin names with API_ prefixed.
28
+ */
29
+ #define ELEM(x) API_##x,
30
+ typedef enum { APIS } api_t; /* API_render, API_layout, ... */
31
+ #undef ELEM
32
+
33
+ typedef struct GVJ_s GVJ_t;
34
+ typedef struct GVG_s GVG_t;
35
+ typedef struct GVC_s GVC_t;
36
+
37
+ typedef struct {
38
+ const char *name;
39
+ void* address;
40
+ } lt_symlist_t;
41
+
42
+ typedef struct gvplugin_available_s gvplugin_available_t;
43
+
44
+ #if !defined(LTDL_H)
45
+ extern lt_symlist_t lt_preloaded_symbols[];
46
+ #endif
47
+
48
+ #ifdef __cplusplus
49
+ }
50
+ #endif
data/miniconda3/include/graphviz/gvcjob.h ADDED
@@ -0,0 +1,373 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*************************************************************************
2
+ * Copyright (c) 2011 AT&T Intellectual Property
3
+ * All rights reserved. This program and the accompanying materials
4
+ * are made available under the terms of the Eclipse Public License v1.0
5
+ * which accompanies this distribution, and is available at
6
+ * http://www.eclipse.org/legal/epl-v10.html
7
+ *
8
+ * Contributors: Details at https://graphviz.org
9
+ *************************************************************************/
10
+
11
+ /* Common header used by both clients and plugins */
12
+
13
+ #pragma once
14
+
15
+ #ifdef __cplusplus
16
+ extern "C" {
17
+ #endif
18
+
19
+ #include "gvcommon.h"
20
+ #include "color.h"
21
+ #include <stdbool.h>
22
+
23
+ #define ARRAY_SIZE(A) (sizeof(A)/sizeof(A[0]))
24
+
25
+ typedef struct gvdevice_engine_s gvdevice_engine_t;
26
+ typedef struct gvformatter_engine_s gvformatter_engine_t;
27
+ typedef struct gvrender_engine_s gvrender_engine_t;
28
+ typedef struct gvlayout_engine_s gvlayout_engine_t;
29
+ typedef struct gvtextlayout_engine_s gvtextlayout_engine_t;
30
+ typedef struct gvloadimage_engine_s gvloadimage_engine_t;
31
+
32
+ typedef enum { PEN_NONE, PEN_DASHED, PEN_DOTTED, PEN_SOLID } pen_type;
33
+ typedef enum { FILL_NONE, FILL_SOLID, FILL_LINEAR, FILL_RADIAL } fill_type;
34
+ typedef enum { FONT_REGULAR, FONT_BOLD, FONT_ITALIC } font_type;
35
+ typedef enum { LABEL_PLAIN, LABEL_HTML } label_type;
36
+
37
+ #define PENWIDTH_NORMAL 1.
38
+ #define PENWIDTH_BOLD 2.
39
+ typedef enum { GVATTR_STRING, GVATTR_BOOL, GVATTR_COLOR } gvattr_t;
40
+
41
+ /* The -T output formats listed below are examples only, they are not definitive or inclusive,
42
+ other outputs may use the flags now, or in the future
43
+
44
+ Default emit order is breadth first graph walk order
45
+ EMIT_SORTED emits nodes before edges
46
+ EMIT_COLORS emits colors before nodes or edge -Tfig
47
+ EMIT_CLUSTERS_LAST emits cluster after nodes and edges
48
+ EMIT_PREORDER emit in preorder traversal ???
49
+ EMIT_EDGE_SORTED emits edges before nodes
50
+
51
+ GVDEVICE_DOES_PAGES provides pagination support -Tps
52
+ GVDEVICE_DOES_LAYERS provides support for layers -Tps
53
+ GVDEVICE_EVENTS supports mouse events -Tgtk, -Txlib
54
+ GVDEVICE_DOES_TRUECOLOR supports alpha channel -Tpng, -Tgtk, -Txlib
55
+ GVDEVICE_BINARY_FORMAT Suppresses \r\n substitution for linends
56
+ GVDEVICE_COMPRESSED_FORMAT controls libz compression
57
+ GVDEVICE_NO_WRITER used when gvdevice is not used because device uses its own writer, devil outputs (FIXME seems to overlap OUTPUT_NOT_REQUIRED)
58
+
59
+ GVRENDER_Y_GOES_DOWN device origin top left, y goes down, otherwise
60
+ device origin lower left, y goes up
61
+ GVRENDER_DOES_TRANSFORM device uses scale, translate, rotate to do its own
62
+ coordinate transformations, otherwise coordinates
63
+ are pre-transformed
64
+ GVRENDER_DOES_ARROWS renderer has its own idea of arrow shapes (deprecated)
65
+ GVRENDER_DOES_LABELS basically, maps don't need labels
66
+ GVRENDER_DOES_MAPS renderer encodes mapping information for mouse events -Tcmapx -Tsvg
67
+ GVRENDER_DOES_MAP_RECTANGLE supports a 2 coord rectngle optimization
68
+ GVRENDER_DOES_MAP_CIRCLE supports a 1 coord + radius circle optimization
69
+ GVRENDER_DOES_MAP_POLYGON supports polygons (basically, -Tsvg uses anchors, so doesn't need to support any map shapes)
70
+ GVRENDER_DOES_MAP_ELLIPSE supports a 2 coord ellipse optimization
71
+ GVRENDER_DOES_MAP_BSPLINE supports mapping of splines
72
+ GVRENDER_DOES_TOOLTIPS can represent tooltip info -Tcmapx, -Tsvg
73
+ GVRENDER_DOES_TARGETS can represent target info (open link in a new tab or window)
74
+ GVRENDER_DOES_Z render support 2.5D representation -Tvrml
75
+ GVRENDER_NO_WHITE_BG don't paint white background, assumes white paper -Tps
76
+ LAYOUT_NOT_REQUIRED don't perform layout -Tcanon
77
+ OUTPUT_NOT_REQUIRED don't use gvdevice for output (basically when agwrite() used instead) -Tcanon, -Txdot
78
+ */
79
+
80
+
81
+ #define EMIT_SORTED (1<<0)
82
+ #define EMIT_COLORS (1<<1)
83
+ #define EMIT_CLUSTERS_LAST (1<<2)
84
+ #define EMIT_PREORDER (1<<3)
85
+ #define EMIT_EDGE_SORTED (1<<4)
86
+ #define GVDEVICE_DOES_PAGES (1<<5)
87
+ #define GVDEVICE_DOES_LAYERS (1<<6)
88
+ #define GVDEVICE_EVENTS (1<<7)
89
+ #define GVDEVICE_DOES_TRUECOLOR (1<<8)
90
+ #define GVDEVICE_BINARY_FORMAT (1<<9)
91
+ #define GVDEVICE_COMPRESSED_FORMAT (1<<10)
92
+ #define GVDEVICE_NO_WRITER (1<<11)
93
+ #define GVRENDER_Y_GOES_DOWN (1<<12)
94
+ #define GVRENDER_DOES_TRANSFORM (1<<13)
95
+ #define GVRENDER_DOES_ARROWS (1<<14)
96
+ #define GVRENDER_DOES_LABELS (1<<15)
97
+ #define GVRENDER_DOES_MAPS (1<<16)
98
+ #define GVRENDER_DOES_MAP_RECTANGLE (1<<17)
99
+ #define GVRENDER_DOES_MAP_CIRCLE (1<<18)
100
+ #define GVRENDER_DOES_MAP_POLYGON (1<<19)
101
+ #define GVRENDER_DOES_MAP_ELLIPSE (1<<20)
102
+ #define GVRENDER_DOES_MAP_BSPLINE (1<<21)
103
+ #define GVRENDER_DOES_TOOLTIPS (1<<22)
104
+ #define GVRENDER_DOES_TARGETS (1<<23)
105
+ #define GVRENDER_DOES_Z (1<<24)
106
+ #define GVRENDER_NO_WHITE_BG (1<<25)
107
+ #define LAYOUT_NOT_REQUIRED (1<<26)
108
+ #define OUTPUT_NOT_REQUIRED (1<<27)
109
+
110
+ typedef struct {
111
+ int flags;
112
+ double default_pad; /* graph units */
113
+ char **knowncolors;
114
+ int sz_knowncolors;
115
+ color_type_t color_type;
116
+ } gvrender_features_t;
117
+
118
+ typedef struct {
119
+ int flags;
120
+ pointf default_margin; /* left/right, top/bottom - points */
121
+ pointf default_pagesize;/* default page width, height - points */
122
+ pointf default_dpi;
123
+ } gvdevice_features_t;
124
+
125
+ #define LAYOUT_USES_RANKDIR (1<<0)
126
+
127
+ typedef struct gvplugin_active_device_s {
128
+ gvdevice_engine_t *engine;
129
+ int id;
130
+ gvdevice_features_t *features;
131
+ const char *type;
132
+ } gvplugin_active_device_t;
133
+
134
+ typedef struct gvplugin_active_render_s {
135
+ gvrender_engine_t *engine;
136
+ int id;
137
+ gvrender_features_t *features;
138
+ const char *type;
139
+ } gvplugin_active_render_t;
140
+
141
+ typedef struct gvplugin_active_loadimage_t {
142
+ gvloadimage_engine_t *engine;
143
+ int id;
144
+ const char *type;
145
+ } gvplugin_active_loadimage_t;
146
+
147
+ typedef struct gv_argvlist_s {
148
+ char **argv;
149
+ int argc;
150
+ int alloc;
151
+ } gv_argvlist_t;
152
+
153
+ typedef struct gvdevice_callbacks_s {
154
+ void (*refresh) (GVJ_t * job);
155
+ void (*button_press) (GVJ_t * job, int button, pointf pointer);
156
+ void (*button_release) (GVJ_t * job, int button, pointf pointer);
157
+ void (*motion) (GVJ_t * job, pointf pointer);
158
+ void (*modify) (GVJ_t * job, const char *name, const char *value);
159
+ void (*del) (GVJ_t * job); /* can't use "delete" 'cos C++ stole it */
160
+ void (*read) (GVJ_t * job, const char *filename, const char *layout);
161
+ void (*layout) (GVJ_t * job, const char *layout);
162
+ void (*render) (GVJ_t * job, const char *format, const char *filename);
163
+ } gvdevice_callbacks_t;
164
+
165
+ typedef int (*gvevent_key_callback_t) (GVJ_t * job);
166
+
167
+ typedef struct gvevent_key_binding_s {
168
+ char *keystring;
169
+ gvevent_key_callback_t callback;
170
+ } gvevent_key_binding_t;
171
+
172
+ typedef enum {MAP_RECTANGLE, MAP_CIRCLE, MAP_POLYGON, } map_shape_t;
173
+
174
+ typedef enum {ROOTGRAPH_OBJTYPE, CLUSTER_OBJTYPE, NODE_OBJTYPE, EDGE_OBJTYPE} obj_type;
175
+
176
+ /* If this enum is changed, the implementation of xbuf and xbufs in
177
+ * gvrender_core_dot.c will probably need to be changed.
178
+ */
179
+ typedef enum {
180
+ EMIT_GDRAW, EMIT_CDRAW, EMIT_TDRAW, EMIT_HDRAW,
181
+ EMIT_GLABEL, EMIT_CLABEL, EMIT_TLABEL, EMIT_HLABEL,
182
+ EMIT_NDRAW, EMIT_EDRAW, EMIT_NLABEL, EMIT_ELABEL,
183
+ } emit_state_t;
184
+
185
+ typedef struct obj_state_s obj_state_t;
186
+
187
+ struct obj_state_s {
188
+ obj_state_t *parent;
189
+
190
+ obj_type type;
191
+ union {
192
+ graph_t *g;
193
+ graph_t *sg;
194
+ node_t *n;
195
+ edge_t *e;
196
+ } u;
197
+
198
+ emit_state_t emit_state;
199
+
200
+ gvcolor_t pencolor, fillcolor, stopcolor;
201
+ int gradient_angle;
202
+ float gradient_frac;
203
+ pen_type pen;
204
+ fill_type fill;
205
+ double penwidth;
206
+ char **rawstyle;
207
+
208
+ double z, tail_z, head_z; /* z depths for 2.5D renderers such as vrml */
209
+
210
+ /* fully substituted text strings */
211
+ char *label;
212
+ char *xlabel;
213
+ char *taillabel;
214
+ char *headlabel;
215
+
216
+ char *url; /* if GVRENDER_DOES_MAPS */
217
+ char *id;
218
+ char *labelurl;
219
+ char *tailurl;
220
+ char *headurl;
221
+
222
+ char *tooltip; /* if GVRENDER_DOES_TOOLTIPS */
223
+ char *labeltooltip;
224
+ char *tailtooltip;
225
+ char *headtooltip;
226
+
227
+ char *target; /* if GVRENDER_DOES_TARGETS */
228
+ char *labeltarget;
229
+ char *tailtarget;
230
+ char *headtarget;
231
+
232
+ unsigned explicit_tooltip:1;
233
+ unsigned explicit_tailtooltip:1;
234
+ unsigned explicit_headtooltip:1;
235
+ unsigned explicit_labeltooltip:1;
236
+ unsigned explicit_tailtarget:1;
237
+ unsigned explicit_headtarget:1;
238
+ unsigned explicit_edgetarget:1;
239
+ unsigned explicit_tailurl:1;
240
+ unsigned explicit_headurl:1;
241
+ unsigned labeledgealigned:1;
242
+
243
+ /* primary mapped region - node shape, edge labels */
244
+ map_shape_t url_map_shape;
245
+ int url_map_n; /* number of points for url map if GVRENDER_DOES_MAPS */
246
+ pointf *url_map_p;
247
+
248
+ /* additional mapped regions for edges */
249
+ int url_bsplinemap_poly_n; /* number of polygons in url bspline map
250
+ if GVRENDER_DOES_MAPS && GVRENDER_DOES_MAP_BSPLINES */
251
+ int *url_bsplinemap_n; /* array of url_bsplinemap_poly_n ints
252
+ of number of points in each polygon */
253
+ pointf *url_bsplinemap_p; /* all the polygon points */
254
+
255
+ int tailendurl_map_n; /* tail end intersection with node */
256
+ pointf *tailendurl_map_p;
257
+
258
+ int headendurl_map_n; /* head end intersection with node */
259
+ pointf *headendurl_map_p;
260
+ };
261
+
262
+ /* Note on units:
263
+ * points - a physical distance (1/72 inch) unaffected by zoom or dpi.
264
+ * graph units - related to physical distance by zoom. Equals points at zoom=1
265
+ * device units - related to physical distance in points by dpi/72
266
+ */
267
+
268
+ struct GVJ_s {
269
+ GVC_t *gvc; /* parent gvc */
270
+ GVJ_t *next; /* linked list of jobs */
271
+ GVJ_t *next_active; /* linked list of active jobs (e.g. multiple windows) */
272
+
273
+ GVCOMMON_t *common;
274
+
275
+ obj_state_t *obj; /* objects can be nested (at least clusters can)
276
+ so keep object state on a stack */
277
+ char *input_filename;
278
+ int graph_index;
279
+
280
+ const char *layout_type;
281
+
282
+ const char *output_filename;
283
+ FILE *output_file;
284
+ char *output_data;
285
+ unsigned int output_data_allocated;
286
+ unsigned int output_data_position;
287
+
288
+ const char *output_langname;
289
+ int output_lang;
290
+
291
+ gvplugin_active_render_t render;
292
+ gvplugin_active_device_t device;
293
+ gvplugin_active_loadimage_t loadimage;
294
+ gvdevice_callbacks_t *callbacks;
295
+ pointf device_dpi;
296
+ bool device_sets_dpi;
297
+
298
+ void *display;
299
+ int screen;
300
+
301
+ void *context; /* gd or cairo surface */
302
+ bool external_context; /* context belongs to caller */
303
+ char *imagedata; /* location of imagedata */
304
+
305
+ int flags; /* emit_graph flags */
306
+
307
+ int numLayers; /* number of layers */
308
+ int layerNum; /* current layer - 1 based*/
309
+
310
+ point pagesArraySize; /* 2D size of page array */
311
+ point pagesArrayFirst;/* 2D starting corner in */
312
+ point pagesArrayMajor;/* 2D major increment */
313
+ point pagesArrayMinor;/* 2D minor increment */
314
+ point pagesArrayElem; /* 2D coord of current page - 0,0 based */
315
+ int numPages; /* number of pages */
316
+
317
+ boxf bb; /* graph bb with padding - graph units */
318
+ pointf pad; /* padding around bb - graph units */
319
+ boxf clip; /* clip region in graph units */
320
+ boxf pageBox; /* current page in graph units */
321
+ pointf pageSize; /* page size in graph units */
322
+ pointf focus; /* viewport focus - graph units */
323
+
324
+ double zoom; /* viewport zoom factor (points per graph unit) */
325
+ int rotation; /* viewport rotation (degrees) 0=portrait, 90=landscape */
326
+
327
+ pointf view; /* viewport size - points */
328
+ boxf canvasBox; /* viewport area - points */
329
+ pointf margin; /* job-specific margin - points */
330
+
331
+ pointf dpi; /* device resolution device-units-per-inch */
332
+
333
+ unsigned int width; /* device width - device units */
334
+ unsigned int height; /* device height - device units */
335
+ box pageBoundingBox;/* rotated boundingBox - device units */
336
+ box boundingBox; /* cumulative boundingBox over all pages - device units */
337
+
338
+ pointf scale; /* composite device to graph units (zoom and dpi) */
339
+ pointf translation; /* composite translation */
340
+ pointf devscale; /* composite device to points: dpi, y_goes_down */
341
+
342
+ bool fit_mode,
343
+ needs_refresh,
344
+ click,
345
+ has_grown,
346
+ has_been_rendered;
347
+
348
+ unsigned char button; /* active button */
349
+ pointf pointer; /* pointer position in device units */
350
+ pointf oldpointer; /* old pointer position in device units */
351
+
352
+ void *current_obj; /* graph object that pointer is in currently */
353
+
354
+ void *selected_obj; /* graph object that has been selected */
355
+ /* (e.g. button 1 clicked on current obj) */
356
+ char *active_tooltip; /* tooltip of active object - or NULL */
357
+ char *selected_href; /* href of selected object - or NULL */
358
+ gv_argvlist_t selected_obj_type_name; /* (e.g. "edge" "node3" "e" "->" "node5" "") */
359
+ gv_argvlist_t selected_obj_attributes; /* attribute triplets: name, value, type */
360
+ /* e.g. "color", "red", GVATTR_COLOR,
361
+ "style", "filled", GVATTR_BOOL, */
362
+
363
+ void *window; /* display-specific data for gvrender plugin */
364
+
365
+ /* keybindings for keyboard events */
366
+ gvevent_key_binding_t *keybindings;
367
+ int numkeys;
368
+ void *keycodes;
369
+ };
370
+
371
+ #ifdef __cplusplus
372
+ }
373
+ #endif
data/miniconda3/include/graphviz/gvcommon.h ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*************************************************************************
2
+ * Copyright (c) 2011 AT&T Intellectual Property
3
+ * All rights reserved. This program and the accompanying materials
4
+ * are made available under the terms of the Eclipse Public License v1.0
5
+ * which accompanies this distribution, and is available at
6
+ * http://www.eclipse.org/legal/epl-v10.html
7
+ *
8
+ * Contributors: Details at https://graphviz.org
9
+ *************************************************************************/
10
+
11
+ #pragma once
12
+
13
+ #ifdef __cplusplus
14
+ extern "C" {
15
+ #endif
16
+
17
+ typedef struct GVCOMMON_s {
18
+ char **info;
19
+ char *cmdname;
20
+ int verbose;
21
+ bool config, auto_outfile_names;
22
+ void (*errorfn) (const char *fmt, ...);
23
+ const char **show_boxes; /* emit code for correct box coordinates */
24
+ const char **lib;
25
+
26
+ /* rendering state */
27
+ int viewNum; /* current view - 1 based count of views,
28
+ all pages in all layers */
29
+ const lt_symlist_t *builtins;
30
+ int demand_loading;
31
+ } GVCOMMON_t;
32
+
33
+ #ifdef __cplusplus
34
+ }
35
+ #endif
data/miniconda3/include/graphviz/gvconfig.h ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*************************************************************************
2
+ * Copyright (c) 2011 AT&T Intellectual Property
3
+ * All rights reserved. This program and the accompanying materials
4
+ * are made available under the terms of the Eclipse Public License v1.0
5
+ * which accompanies this distribution, and is available at
6
+ * http://www.eclipse.org/legal/epl-v10.html
7
+ *
8
+ * Contributors: Details at https://graphviz.org
9
+ *************************************************************************/
10
+
11
+ /* Header used by plugins */
12
+
13
+ #pragma once
14
+
15
+ #include "gvplugin.h"
16
+
17
+ #ifdef __cplusplus
18
+ extern "C" {
19
+ #endif
20
+
21
+ extern void gvconfig_plugin_install_from_library(GVC_t * gvc,
22
+ char *package_path,
23
+ gvplugin_library_t *library);
24
+
25
+ #ifdef __cplusplus
26
+ }
27
+ #endif
data/miniconda3/include/graphviz/gvplugin.h ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*************************************************************************
2
+ * Copyright (c) 2011 AT&T Intellectual Property
3
+ * All rights reserved. This program and the accompanying materials
4
+ * are made available under the terms of the Eclipse Public License v1.0
5
+ * which accompanies this distribution, and is available at
6
+ * http://www.eclipse.org/legal/epl-v10.html
7
+ *
8
+ * Contributors: Details at https://graphviz.org
9
+ *************************************************************************/
10
+
11
+ /* Header used by plugins */
12
+
13
+ #pragma once
14
+
15
+ #ifdef __cplusplus
16
+ extern "C" {
17
+ #endif
18
+
19
+ #include "gvcext.h"
20
+
21
+ /*
22
+ * Terminology:
23
+ *
24
+ * package - e.g. libgvplugin_cairo.so
25
+ * api - e.g. render
26
+ * type - e.g. "png", "ps"
27
+ */
28
+
29
+ typedef struct {
30
+ int id; /* an id that is only unique within a package
31
+ of plugins of the same api.
32
+ A renderer-type such as "png" in the cairo package
33
+ has an id that is different from the "ps" type
34
+ in the same package */
35
+ const char *type; /* a string name, such as "png" or "ps" that
36
+ distinguishes different types within the same
37
+ (renderer in this case) */
38
+ int quality; /* an arbitrary integer used for ordering plugins of
39
+ the same type from different packages */
40
+ void *engine; /* pointer to the jump table for the plugin */
41
+ void *features; /* pointer to the feature description
42
+ void* because type varies by api */
43
+ } gvplugin_installed_t;
44
+
45
+ typedef struct {
46
+ api_t api;
47
+ gvplugin_installed_t *types;
48
+ } gvplugin_api_t;
49
+
50
+ typedef struct {
51
+ char *packagename; /* used when this plugin is builtin and has
52
+ no pathname */
53
+ gvplugin_api_t *apis;
54
+ } gvplugin_library_t;
55
+
56
+ #ifdef __cplusplus
57
+ }
58
+ #endif
data/miniconda3/include/graphviz/gvplugin_device.h ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*************************************************************************
2
+ * Copyright (c) 2011 AT&T Intellectual Property
3
+ * All rights reserved. This program and the accompanying materials
4
+ * are made available under the terms of the Eclipse Public License v1.0
5
+ * which accompanies this distribution, and is available at
6
+ * http://www.eclipse.org/legal/epl-v10.html
7
+ *
8
+ * Contributors: Details at https://graphviz.org
9
+ *************************************************************************/
10
+
11
+ #pragma once
12
+
13
+ #include "types.h"
14
+ #include "gvplugin.h"
15
+ #include "gvcjob.h"
16
+
17
+ #ifdef __cplusplus
18
+ extern "C" {
19
+ #endif
20
+
21
+ struct gvdevice_engine_s {
22
+ void (*initialize) (GVJ_t * firstjob);
23
+ void (*format) (GVJ_t * firstjob);
24
+ void (*finalize) (GVJ_t * firstjob);
25
+ };
26
+
27
+ #ifdef __cplusplus
28
+ }
29
+ #endif
data/miniconda3/include/graphviz/gvplugin_layout.h ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*************************************************************************
2
+ * Copyright (c) 2011 AT&T Intellectual Property
3
+ * All rights reserved. This program and the accompanying materials
4
+ * are made available under the terms of the Eclipse Public License v1.0
5
+ * which accompanies this distribution, and is available at
6
+ * http://www.eclipse.org/legal/epl-v10.html
7
+ *
8
+ * Contributors: Details at https://graphviz.org
9
+ *************************************************************************/
10
+
11
+ #pragma once
12
+
13
+ #include "types.h"
14
+ #include "gvplugin.h"
15
+ #include "gvcjob.h"
16
+
17
+ #ifdef __cplusplus
18
+ extern "C" {
19
+ #endif
20
+
21
+ struct gvlayout_engine_s {
22
+ void (*layout) (graph_t * g);
23
+ void (*cleanup) (graph_t * g);
24
+ };
25
+
26
+ #ifdef __cplusplus
27
+ }
28
+ #endif
data/miniconda3/include/graphviz/gvplugin_loadimage.h ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*************************************************************************
2
+ * Copyright (c) 2011 AT&T Intellectual Property
3
+ * All rights reserved. This program and the accompanying materials
4
+ * are made available under the terms of the Eclipse Public License v1.0
5
+ * which accompanies this distribution, and is available at
6
+ * http://www.eclipse.org/legal/epl-v10.html
7
+ *
8
+ * Contributors: Details at https://graphviz.org
9
+ *************************************************************************/
10
+
11
+ #pragma once
12
+
13
+ #include "types.h"
14
+ #include "gvplugin.h"
15
+ #include "gvcjob.h"
16
+ #include <stdbool.h>
17
+
18
+ #ifdef __cplusplus
19
+ extern "C" {
20
+ #endif
21
+
22
+ #ifdef GVDLL
23
+ #ifdef GVC_EXPORTS
24
+ #define GVPLUGIN_LOADIMAGE_API __declspec(dllexport)
25
+ #else
26
+ #define GVPLUGIN_LOADIMAGE_API __declspec(dllimport)
27
+ #endif
28
+ #endif
29
+
30
+ #ifndef GVPLUGIN_LOADIMAGE_API
31
+ #define GVPLUGIN_LOADIMAGE_API /* nothing */
32
+ #endif
33
+
34
+ GVPLUGIN_LOADIMAGE_API bool gvusershape_file_access(usershape_t *us);
35
+ GVPLUGIN_LOADIMAGE_API void gvusershape_file_release(usershape_t *us);
36
+
37
+ struct gvloadimage_engine_s {
38
+ void (*loadimage) (GVJ_t *job, usershape_t *us, boxf b, bool filled);
39
+ };
40
+
41
+ #undef GVPLUGIN_LOADIMAGE_API
42
+
43
+ #ifdef __cplusplus
44
+ }
45
+ #endif
data/miniconda3/include/graphviz/gvplugin_render.h ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*************************************************************************
2
+ * Copyright (c) 2011 AT&T Intellectual Property
3
+ * All rights reserved. This program and the accompanying materials
4
+ * are made available under the terms of the Eclipse Public License v1.0
5
+ * which accompanies this distribution, and is available at
6
+ * http://www.eclipse.org/legal/epl-v10.html
7
+ *
8
+ * Contributors: Details at https://graphviz.org
9
+ *************************************************************************/
10
+
11
+ #pragma once
12
+
13
+ #include "types.h"
14
+ #include "gvplugin.h"
15
+ #include "gvcjob.h"
16
+
17
+ #ifdef __cplusplus
18
+ extern "C" {
19
+ #endif
20
+
21
+ struct gvrender_engine_s {
22
+ void (*begin_job) (GVJ_t * job);
23
+ void (*end_job) (GVJ_t * job);
24
+ void (*begin_graph) (GVJ_t * job);
25
+ void (*end_graph) (GVJ_t * job);
26
+ void (*begin_layer) (GVJ_t * job, char *layername,
27
+ int layerNum, int numLayers);
28
+ void (*end_layer) (GVJ_t * job);
29
+ void (*begin_page) (GVJ_t * job);
30
+ void (*end_page) (GVJ_t * job);
31
+ void (*begin_cluster) (GVJ_t * job);
32
+ void (*end_cluster) (GVJ_t * job);
33
+ void (*begin_nodes) (GVJ_t * job);
34
+ void (*end_nodes) (GVJ_t * job);
35
+ void (*begin_edges) (GVJ_t * job);
36
+ void (*end_edges) (GVJ_t * job);
37
+ void (*begin_node) (GVJ_t * job);
38
+ void (*end_node) (GVJ_t * job);
39
+ void (*begin_edge) (GVJ_t * job);
40
+ void (*end_edge) (GVJ_t * job);
41
+ void (*begin_anchor) (GVJ_t * job,
42
+ char *href, char *tooltip, char *target, char *id);
43
+ void (*end_anchor) (GVJ_t * job);
44
+ void (*begin_label) (GVJ_t * job, label_type type);
45
+ void (*end_label) (GVJ_t * job);
46
+ void (*textspan) (GVJ_t * job, pointf p, textspan_t * span);
47
+ void (*resolve_color) (GVJ_t * job, gvcolor_t * color);
48
+ void (*ellipse) (GVJ_t * job, pointf * A, int filled);
49
+ void (*polygon) (GVJ_t * job, pointf * A, int n, int filled);
50
+ void (*beziercurve) (GVJ_t * job, pointf * A, int n,
51
+ int arrow_at_start, int arrow_at_end, int);
52
+ void (*polyline) (GVJ_t * job, pointf * A, int n);
53
+ void (*comment) (GVJ_t * job, char *comment);
54
+ void (*library_shape) (GVJ_t * job, char *name, pointf * A, int n, int filled);
55
+ };
56
+
57
+ #ifdef __cplusplus
58
+ }
59
+ #endif
data/miniconda3/include/graphviz/gvplugin_textlayout.h ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*************************************************************************
2
+ * Copyright (c) 2011 AT&T Intellectual Property
3
+ * All rights reserved. This program and the accompanying materials
4
+ * are made available under the terms of the Eclipse Public License v1.0
5
+ * which accompanies this distribution, and is available at
6
+ * http://www.eclipse.org/legal/epl-v10.html
7
+ *
8
+ * Contributors: Details at https://graphviz.org
9
+ *************************************************************************/
10
+
11
+ #pragma once
12
+
13
+ #include "types.h"
14
+ #include "gvplugin.h"
15
+ #include "gvcjob.h"
16
+ #include "gvcommon.h"
17
+ #include <stdbool.h>
18
+
19
+ #ifdef __cplusplus
20
+ extern "C" {
21
+ #endif
22
+
23
+ struct gvtextlayout_engine_s {
24
+ bool (*textlayout) (textspan_t *span, char** fontpath);
25
+ };
26
+
27
+ #ifdef __cplusplus
28
+ }
29
+ #endif
data/miniconda3/include/graphviz/gvpr.h ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @file
3
+ * @brief graph pattern scanning and processing language API, main function @ref gvpr
4
+ */
5
+ /*************************************************************************
6
+ * Copyright (c) 2011 AT&T Intellectual Property
7
+ * All rights reserved. This program and the accompanying materials
8
+ * are made available under the terms of the Eclipse Public License v1.0
9
+ * which accompanies this distribution, and is available at
10
+ * http://www.eclipse.org/legal/epl-v10.html
11
+ *
12
+ * Contributors: Details at https://graphviz.org
13
+ *************************************************************************/
14
+
15
+ #pragma once
16
+
17
+ #ifdef __cplusplus
18
+ extern "C" {
19
+ #endif
20
+
21
+ #ifdef GVDLL
22
+ #ifdef EXPORT_GVPR
23
+ #define GVPR_API __declspec(dllexport)
24
+ #else
25
+ #define GVPR_API __declspec(dllimport)
26
+ #endif
27
+ #endif
28
+
29
+ #ifndef GVPR_API
30
+ #define GVPR_API /* nothing */
31
+ #endif
32
+
33
+ #include "cgraph.h"
34
+ #ifdef _MSC_VER
35
+ #include <BaseTsd.h>
36
+ typedef SSIZE_T ssize_t;
37
+ #endif
38
+
39
+ /* Bits for flags variable in gvprstate_t.
40
+ * Included here so that calling programs can use the first
41
+ * two in gvpropts.flags
42
+ */
43
+ /* If set, gvpr calls exit() on errors */
44
+ #define GV_USE_EXIT 1
45
+ /* If set, gvpr stores output graphs in gvpropts */
46
+ #define GV_USE_OUTGRAPH 2
47
+ /* Use longjmp to return to top-level call in gvpr */
48
+ #define GV_USE_JUMP 4
49
+ /* $tvnext has been set but not used */
50
+ #define GV_NEXT_SET 8
51
+
52
+
53
+ typedef ssize_t (*gvprwr) (void*, const char *buf, size_t nbyte, void*);
54
+ typedef int (*gvpruserfn) (char *);
55
+ typedef struct {
56
+ char* name;
57
+ gvpruserfn fn;
58
+ } gvprbinding;
59
+
60
+ typedef struct {
61
+ Agraph_t** ingraphs; /* NULL-terminated array of input graphs */
62
+ int n_outgraphs; /* if GV_USE_OUTGRAPH set, output graphs */
63
+ Agraph_t** outgraphs;
64
+ gvprwr out; /* write function for stdout */
65
+ gvprwr err; /* write function for stderr */
66
+ int flags;
67
+ gvprbinding* bindings; /* array of bindings, terminated with {NULL,NULL} */
68
+ } gvpropts;
69
+
70
+ GVPR_API extern int gvpr (int argc, char *argv[], gvpropts* opts);
71
+
72
+ #ifdef __cplusplus
73
+ }
74
+ #endif
data/miniconda3/include/graphviz/pack.h ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @file
3
+ * @brief support for connected components
4
+ */
5
+
6
+ /*************************************************************************
7
+ * Copyright (c) 2011 AT&T Intellectual Property
8
+ * All rights reserved. This program and the accompanying materials
9
+ * are made available under the terms of the Eclipse Public License v1.0
10
+ * which accompanies this distribution, and is available at
11
+ * http://www.eclipse.org/legal/epl-v10.html
12
+ *
13
+ * Contributors: Details at https://graphviz.org
14
+ *************************************************************************/
15
+
16
+ #pragma once
17
+
18
+ #include <stdbool.h>
19
+
20
+ #ifdef __cplusplus
21
+ extern "C" {
22
+ #endif
23
+
24
+ #include "types.h"
25
+
26
+ /* Type indicating granularity and method
27
+ * l_undef - unspecified
28
+ * l_node - polyomino using nodes and edges
29
+ * l_clust - polyomino using nodes and edges and top-level clusters
30
+ * (assumes ND_clust(n) unused by application)
31
+ * l_graph - polyomino using computer graph bounding box
32
+ * l_array - array based on graph bounding boxes
33
+ * l_aspect - tiling based on graph bounding boxes preserving aspect ratio
34
+ * l_hull - polyomino using convex hull (unimplemented)
35
+ * l_tile - tiling using graph bounding box (unimplemented)
36
+ * l_bisect - alternate bisection using graph bounding box (unimplemented)
37
+ */
38
+ typedef enum { l_undef, l_clust, l_node, l_graph, l_array, l_aspect } pack_mode;
39
+
40
+ #define PK_COL_MAJOR (1 << 0)
41
+ #define PK_USER_VALS (1 << 1)
42
+ #define PK_LEFT_ALIGN (1 << 2)
43
+ #define PK_RIGHT_ALIGN (1 << 3)
44
+ #define PK_TOP_ALIGN (1 << 4)
45
+ #define PK_BOT_ALIGN (1 << 5)
46
+ #define PK_INPUT_ORDER (1 << 6)
47
+
48
+ typedef unsigned int packval_t;
49
+
50
+ typedef struct {
51
+ float aspect; /* desired aspect ratio */
52
+ int sz; /* row/column size size */
53
+ unsigned int margin; /* margin left around objects, in points */
54
+ int doSplines; /* use splines in constructing graph shape */
55
+ pack_mode mode; /* granularity and method */
56
+ bool *fixed; /* fixed[i] == true implies g[i] should not be moved */
57
+ packval_t* vals; /* for arrays, sort numbers */
58
+ int flags;
59
+ } pack_info;
60
+
61
+ #ifdef GVDLL
62
+ #ifdef GVC_EXPORTS
63
+ #define PACK_API __declspec(dllexport)
64
+ #else
65
+ #define PACK_API __declspec(dllimport)
66
+ #endif
67
+ #endif
68
+
69
+ #ifndef PACK_API
70
+ #define PACK_API /* nothing */
71
+ #endif
72
+
73
+ PACK_API point *putRects(int ng, boxf* bbs, pack_info* pinfo);
74
+ PACK_API int packRects(int ng, boxf* bbs, pack_info* pinfo);
75
+
76
+ PACK_API point *putGraphs(int, Agraph_t **, Agraph_t *, pack_info *);
77
+ PACK_API int packGraphs(int, Agraph_t **, Agraph_t *, pack_info *);
78
+ PACK_API int packSubgraphs(int, Agraph_t **, Agraph_t *, pack_info *);
79
+ PACK_API int pack_graph(int ng, Agraph_t** gs, Agraph_t* root, bool *fixed);
80
+
81
+ PACK_API int shiftGraphs(int, Agraph_t**, point*, Agraph_t*, int);
82
+
83
+ PACK_API pack_mode getPackMode(Agraph_t * g, pack_mode dflt);
84
+ PACK_API int getPack(Agraph_t *, int not_def, int dflt);
85
+ PACK_API pack_mode getPackInfo(Agraph_t * g, pack_mode dflt, int dfltMargin, pack_info*);
86
+ PACK_API pack_mode getPackModeInfo(Agraph_t * g, pack_mode dflt, pack_info*);
87
+ PACK_API pack_mode parsePackModeInfo(const char* p, pack_mode dflt,
88
+ pack_info* pinfo);
89
+
90
+ PACK_API int isConnected(Agraph_t *);
91
+ PACK_API Agraph_t **ccomps(Agraph_t *, int *, char *);
92
+ PACK_API Agraph_t **cccomps(Agraph_t *, int *, char *);
93
+ PACK_API Agraph_t **pccomps(Agraph_t *, int *, char *, bool *);
94
+ PACK_API int nodeInduce(Agraph_t *);
95
+ PACK_API Agraph_t *mapClust(Agraph_t *);
96
+ #undef PACK_API
97
+ #ifdef __cplusplus
98
+ }
99
+ #endif
data/miniconda3/include/graphviz/pathgeom.h ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*************************************************************************
2
+ * Copyright (c) 2011 AT&T Intellectual Property
3
+ * All rights reserved. This program and the accompanying materials
4
+ * are made available under the terms of the Eclipse Public License v1.0
5
+ * which accompanies this distribution, and is available at
6
+ * http://www.eclipse.org/legal/epl-v10.html
7
+ *
8
+ * Contributors: Details at https://graphviz.org
9
+ *************************************************************************/
10
+
11
+ #pragma once
12
+
13
+ #ifdef __cplusplus
14
+ extern "C" {
15
+ #endif
16
+
17
+ #ifdef GVDLL
18
+ #ifdef PATHPLAN_EXPORTS
19
+ #define PATHGEOM_API __declspec(dllexport)
20
+ #else
21
+ #define PATHGEOM_API __declspec(dllimport)
22
+ #endif
23
+ #endif
24
+
25
+ #ifndef PATHGEOM_API
26
+ #define PATHGEOM_API /* nothing */
27
+ #endif
28
+
29
+ #ifdef HAVE_POINTF_S
30
+ typedef struct pointf_s Ppoint_t;
31
+ typedef struct pointf_s Pvector_t;
32
+ #else
33
+ typedef struct Pxy_t {
34
+ double x, y;
35
+ } Pxy_t;
36
+
37
+ typedef struct Pxy_t Ppoint_t;
38
+ typedef struct Pxy_t Pvector_t;
39
+ #endif
40
+
41
+ typedef struct Ppoly_t {
42
+ Ppoint_t *ps;
43
+ int pn;
44
+ } Ppoly_t;
45
+
46
+ typedef Ppoly_t Ppolyline_t;
47
+
48
+ typedef struct Pedge_t {
49
+ Ppoint_t a, b;
50
+ } Pedge_t;
51
+
52
+ /* opaque state handle for visibility graph operations */
53
+ typedef struct vconfig_s vconfig_t;
54
+
55
+ PATHGEOM_API void freePath(Ppolyline_t* p);
56
+
57
+ #undef PATHGEOM_API
58
+
59
+ #ifdef __cplusplus
60
+ }
61
+ #endif
data/miniconda3/include/graphviz/pathplan.h ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @file
3
+ * @brief finds and smooths shortest paths
4
+ */
5
+
6
+ /*************************************************************************
7
+ * Copyright (c) 2011 AT&T Intellectual Property
8
+ * All rights reserved. This program and the accompanying materials
9
+ * are made available under the terms of the Eclipse Public License v1.0
10
+ * which accompanies this distribution, and is available at
11
+ * http://www.eclipse.org/legal/epl-v10.html
12
+ *
13
+ * Contributors: Details at https://graphviz.org
14
+ *************************************************************************/
15
+
16
+ #pragma once
17
+
18
+ #include "pathgeom.h"
19
+
20
+ #ifdef __cplusplus
21
+ extern "C" {
22
+ #endif
23
+
24
+ #ifdef GVDLL
25
+ #ifdef PATHPLAN_EXPORTS
26
+ #define PATHPLAN_API __declspec(dllexport)
27
+ #else
28
+ #define PATHPLAN_API __declspec(dllimport)
29
+ #endif
30
+ #endif
31
+
32
+ #ifndef PATHPLAN_API
33
+ #define PATHPLAN_API /* nothing */
34
+ #endif
35
+
36
+ /* find shortest euclidean path within a simple polygon */
37
+ PATHPLAN_API int Pshortestpath(Ppoly_t * boundary, Ppoint_t endpoints[2],
38
+ Ppolyline_t * output_route);
39
+
40
+ /* fit a spline to an input polyline, without touching barrier segments */
41
+ PATHPLAN_API int Proutespline(Pedge_t * barriers, int n_barriers,
42
+ Ppolyline_t input_route,
43
+ Pvector_t endpoint_slopes[2],
44
+ Ppolyline_t * output_route);
45
+
46
+ /* utility function to convert from a set of polygonal obstacles to barriers */
47
+ PATHPLAN_API int Ppolybarriers(Ppoly_t ** polys, int npolys,
48
+ Pedge_t ** barriers, int *n_barriers);
49
+
50
+ /* function to convert a polyline into a spline representation */
51
+ PATHPLAN_API void make_polyline(Ppolyline_t line, Ppolyline_t* sline);
52
+
53
+ #undef PATHPLAN_API
54
+
55
+ #ifdef __cplusplus
56
+ }
57
+ #endif
data/miniconda3/include/graphviz/textspan.h ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @file
3
+ * @brief @ref textspan_t, @ref textfont_t, @ref PostscriptAlias
4
+ */
5
+
6
+ /*************************************************************************
7
+ * Copyright (c) 2011 AT&T Intellectual Property
8
+ * All rights reserved. This program and the accompanying materials
9
+ * are made available under the terms of the Eclipse Public License v1.0
10
+ * which accompanies this distribution, and is available at
11
+ * http://www.eclipse.org/legal/epl-v10.html
12
+ *
13
+ * Contributors: Details at https://graphviz.org
14
+ *************************************************************************/
15
+
16
+ #pragma once
17
+
18
+ #ifdef __cplusplus
19
+ extern "C" {
20
+ #endif
21
+
22
+ #define GV_TEXTFONT_FLAGS_WIDTH 7
23
+
24
+ /* Bold, Italic, Underline, Sup, Sub, Strike */
25
+ /* Stored in textfont_t.flags, which is GV_TEXTFONT_FLAGS_WIDTH bits, so full */
26
+ /* Probably should be moved to textspan_t */
27
+ #define HTML_BF (1 << 0)
28
+ #define HTML_IF (1 << 1)
29
+ #define HTML_UL (1 << 2)
30
+ #define HTML_SUP (1 << 3)
31
+ #define HTML_SUB (1 << 4)
32
+ #define HTML_S (1 << 5)
33
+ #define HTML_OL (1 << 6)
34
+
35
+ typedef struct _PostscriptAlias {
36
+ char* name;
37
+ char* family;
38
+ char* weight;
39
+ char* stretch;
40
+ char* style;
41
+ int xfig_code;
42
+ char* svg_font_family;
43
+ char* svg_font_weight;
44
+ char* svg_font_style;
45
+ } PostscriptAlias;
46
+
47
+ /* font information
48
+ * If name or color is NULL, or size < 0, that attribute
49
+ * is unspecified.
50
+ */
51
+ typedef struct {
52
+ char* name;
53
+ char* color;
54
+ PostscriptAlias *postscript_alias;
55
+ double size;
56
+ unsigned int flags:GV_TEXTFONT_FLAGS_WIDTH; // HTML_UL, HTML_IF, HTML_BF, etc.
57
+ unsigned int cnt:(sizeof(unsigned int) * 8 - GV_TEXTFONT_FLAGS_WIDTH);
58
+ ///< reference count
59
+ } textfont_t;
60
+
61
+ /* atomic unit of text emitted using a single htmlfont_t */
62
+ typedef struct {
63
+ char *str; /* stored in utf-8 */
64
+ textfont_t *font;
65
+ void *layout;
66
+ void (*free_layout) (void *layout); /* FIXME - this is ugly */
67
+ double yoffset_layout, yoffset_centerline;
68
+ pointf size;
69
+ char just; /* 'l' 'n' 'r' */ /* FIXME */
70
+ } textspan_t;
71
+
72
+ #ifdef __cplusplus
73
+ }
74
+ #endif
data/miniconda3/include/graphviz/types.h ADDED
@@ -0,0 +1,619 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @file
3
+ * @brief graphs, nodes and edges info: Agraphinfo_t, Agnodeinfo_t and Agedgeinfo_t
4
+ */
5
+
6
+ /*************************************************************************
7
+ * Copyright (c) 2011 AT&T Intellectual Property
8
+ * All rights reserved. This program and the accompanying materials
9
+ * are made available under the terms of the Eclipse Public License v1.0
10
+ * which accompanies this distribution, and is available at
11
+ * http://www.eclipse.org/legal/epl-v10.html
12
+ *
13
+ * Contributors: Details at https://graphviz.org
14
+ *************************************************************************/
15
+
16
+ #pragma once
17
+
18
+ /* Define if you want CGRAPH */
19
+ #define WITH_CGRAPH 1
20
+
21
+ #include <stdbool.h>
22
+ #include <stdio.h>
23
+ #include <assert.h>
24
+ #include <signal.h>
25
+
26
+ /// @cond
27
+
28
+ #ifndef FALSE
29
+ #define FALSE 0
30
+ #endif
31
+ #ifndef TRUE
32
+ #define TRUE (!FALSE)
33
+ #endif
34
+
35
+ /// @endcond
36
+
37
+ #include "geom.h"
38
+ #include "gvcext.h"
39
+ #include "pathgeom.h"
40
+ #include "textspan.h"
41
+ #include "cgraph.h"
42
+
43
+ #ifdef __cplusplus
44
+ extern "C" {
45
+ #endif
46
+
47
+ typedef int (*qsort_cmpf) (const void *, const void *);
48
+ typedef int (*bsearch_cmpf) (const void *, const void *);
49
+ typedef struct Agraph_s graph_t;
50
+ typedef struct Agnode_s node_t;
51
+ typedef struct Agedge_s edge_t;
52
+ typedef struct Agsym_s attrsym_t;
53
+ #define TAIL_ID "tailport"
54
+ #define HEAD_ID "headport"
55
+
56
+ typedef struct htmllabel_t htmllabel_t;
57
+
58
+ typedef union inside_t {
59
+ struct {
60
+ pointf* p;
61
+ double* r;
62
+ } a;
63
+ struct {
64
+ node_t* n;
65
+ boxf* bp;
66
+ } s;
67
+ } inside_t;
68
+
69
+ typedef struct port { /* internal edge endpoint specification */
70
+ pointf p; /* aiming point relative to node center */
71
+ double theta; /* slope in radians */
72
+ boxf *bp; /* if not null, points to bbox of
73
+ * rectangular area that is port target
74
+ */
75
+ bool defined; /* if true, edge has port info at this end */
76
+ bool constrained; /* if true, constraints such as theta are set */
77
+ bool clip; /* if true, clip end to node/port shape */
78
+ bool dyna; /* if true, assign compass point dynamically */
79
+ unsigned char order; /* for mincross */
80
+ unsigned char side; /* if port is on perimeter of node, this
81
+ * contains the bitwise OR of the sides (TOP,
82
+ * BOTTOM, etc.) it is on.
83
+ */
84
+ char *name; /* port name, if it was explicitly given, otherwise NULL */
85
+ } port;
86
+
87
+ typedef struct {
88
+ bool(*swapEnds) (edge_t * e); /* Should head and tail be swapped? */
89
+ bool(*splineMerge) (node_t * n); /* Is n a node in the middle of an edge? */
90
+ bool ignoreSwap; /* Test for swapped edges if false */
91
+ bool isOrtho; /* Orthogonal routing used */
92
+ } splineInfo;
93
+
94
+ typedef struct pathend_t {
95
+ boxf nb; /* the node box */
96
+ pointf np; /* node port */
97
+ int sidemask;
98
+ int boxn;
99
+ boxf boxes[20];
100
+ } pathend_t;
101
+
102
+ typedef struct path { /* internal specification for an edge spline */
103
+ port start;
104
+ port end;
105
+ int nbox; /* number of subdivisions */
106
+ boxf *boxes; /* rectangular regions of subdivision */
107
+ void *data;
108
+ } path;
109
+
110
+ typedef struct bezier {
111
+ pointf *list;
112
+ int size;
113
+ int sflag;
114
+ int eflag;
115
+ pointf sp;
116
+ pointf ep;
117
+ } bezier;
118
+
119
+ typedef struct splines {
120
+ bezier *list;
121
+ int size;
122
+ boxf bb;
123
+ } splines;
124
+
125
+ typedef struct textlabel_t {
126
+ char *text;
127
+ char *fontname;
128
+ char *fontcolor;
129
+ int charset;
130
+ double fontsize;
131
+ pointf dimen; /* the diagonal size of the label (estimated by layout) */
132
+ pointf space; /* the diagonal size of the space for the label */
133
+ /* the rendered label is aligned in this box */
134
+ /* space does not include pad or margin */
135
+ pointf pos; /* the center of the space for the label */
136
+ union {
137
+ struct {
138
+ textspan_t *span;
139
+ short nspans;
140
+ } txt;
141
+ htmllabel_t *html;
142
+ } u;
143
+ char valign; /* 't' 'c' 'b' */
144
+ bool set; /* true if position is set */
145
+ bool html; /* true if html label */
146
+ } textlabel_t;
147
+
148
+ typedef struct polygon_t { /* mutable shape information for a node */
149
+ int regular; /* true for symmetric shapes */
150
+ int peripheries; /* number of periphery lines */
151
+ int sides; /* number of sides */
152
+ double orientation; /* orientation of shape (+ve degrees) */
153
+ double distortion; /* distortion factor - as in trapezium */
154
+ double skew; /* skew factor - as in parallelogram */
155
+ int option; /* ROUNDED, DIAGONAL corners, etc. */
156
+ pointf *vertices; /* array of vertex points */
157
+ } polygon_t;
158
+
159
+ typedef struct stroke_t { /* information about a single stroke */
160
+ /* we would have called it a path if that term wasn't already used */
161
+ int nvertices; /* number of points in the stroke */
162
+ int flags; /* stroke style flags */
163
+ pointf *vertices; /* array of vertex points */
164
+ } stroke_t;
165
+
166
+ /* flag definitions for stroke_t */
167
+ #define STROKE_CLOSED (1 << 0)
168
+ #define STROKE_FILLED (1 << 1)
169
+ #define STROKE_PENDOWN (1 << 2)
170
+ #define STROKE_VERTICES_ALLOCATED (1 << 3)
171
+
172
+ typedef struct shape_functions { /* read-only shape functions */
173
+ void (*initfn) (node_t *); /* initializes shape from node u.shape_info structure */
174
+ void (*freefn) (node_t *); /* frees shape from node u.shape_info structure */
175
+ port(*portfn) (node_t *, char *, char *); /* finds aiming point and slope of port */
176
+ bool(*insidefn) (inside_t * inside_context, pointf); /* clips incident gvc->e spline on shape of gvc->n */
177
+ int (*pboxfn)(node_t* n, port* p, int side, boxf rv[], int *kptr); /* finds box path to reach port */
178
+ void (*codefn) (GVJ_t * job, node_t * n); /* emits graphics code for node */
179
+ } shape_functions;
180
+
181
+ typedef enum { SH_UNSET, SH_POLY, SH_RECORD, SH_POINT, SH_EPSF} shape_kind;
182
+
183
+ typedef struct shape_desc { /* read-only shape descriptor */
184
+ char *name; /* as read from graph file */
185
+ shape_functions *fns;
186
+ polygon_t *polygon; /* base polygon info */
187
+ bool usershape;
188
+ } shape_desc;
189
+
190
+ #include "usershape.h" /* usershapes needed by gvc */
191
+
192
+ typedef struct nodequeue {
193
+ node_t **store;
194
+ node_t **limit;
195
+ node_t **head;
196
+ node_t **tail;
197
+ } nodequeue;
198
+
199
+ typedef struct adjmatrix_t {
200
+ int nrows;
201
+ int ncols;
202
+ char *data;
203
+ } adjmatrix_t;
204
+
205
+ typedef struct rank_t {
206
+ int n; /* number of nodes in this rank */
207
+ node_t **v; /* ordered list of nodes in rank */
208
+ int an; /* globally allocated number of nodes */
209
+ node_t **av; /* allocated list of nodes in rank */
210
+ double ht1; /* height below/above centerline */
211
+ double ht2; /* height below/above centerline */
212
+ double pht1; /* as above, but only primitive nodes */
213
+ double pht2; /* as above, but only primitive nodes */
214
+ bool candidate; /* for transpose () */
215
+ bool valid;
216
+ int cache_nc; /* caches number of crossings */
217
+ adjmatrix_t *flat;
218
+ } rank_t;
219
+
220
+ typedef enum { R_NONE =
221
+ 0, R_VALUE, R_FILL, R_COMPRESS, R_AUTO, R_EXPAND } ratio_t;
222
+
223
+ typedef struct layout_t {
224
+ double quantum;
225
+ double scale;
226
+ double ratio; /* set only if ratio_kind == R_VALUE */
227
+ double dpi;
228
+ pointf margin;
229
+ pointf page;
230
+ pointf size;
231
+ bool filled;
232
+ bool landscape;
233
+ bool centered;
234
+ ratio_t ratio_kind;
235
+ void* xdots;
236
+ char* id;
237
+ } layout_t;
238
+
239
+ /* for "record" shapes */
240
+ typedef struct field_t {
241
+ pointf size; /* its dimension */
242
+ boxf b; /* its placement in node's coordinates */
243
+ int n_flds;
244
+ textlabel_t *lp; /* n_flds == 0 */
245
+ struct field_t **fld; /* n_flds > 0 */
246
+ char *id; /* user's identifier */
247
+ unsigned char LR; /* if box list is horizontal (left to right) */
248
+ unsigned char sides; /* sides of node exposed to field */
249
+ } field_t;
250
+
251
+ typedef struct nlist_t {
252
+ node_t **list;
253
+ int size;
254
+ } nlist_t;
255
+
256
+ typedef struct elist {
257
+ edge_t **list;
258
+ int size;
259
+ } elist;
260
+
261
+ #define GUI_STATE_ACTIVE (1<<0)
262
+ #define GUI_STATE_SELECTED (1<<1)
263
+ #define GUI_STATE_VISITED (1<<2)
264
+ #define GUI_STATE_DELETED (1<<3)
265
+
266
+ #define elist_fastapp(item,L) do {L.list[L.size++] = item; L.list[L.size] = NULL;} while(0)
267
+ #define elist_append(item,L) do {L.list = ALLOC(L.size + 2,L.list,edge_t*); L.list[L.size++] = item; L.list[L.size] = NULL;} while(0)
268
+ #define alloc_elist(n,L) do {L.size = 0; L.list = N_NEW(n + 1,edge_t*); } while (0)
269
+ #define free_list(L) free(L.list)
270
+
271
+ typedef enum {NATIVEFONTS,PSFONTS,SVGFONTS} fontname_kind;
272
+
273
+ typedef struct Agraphinfo_t {
274
+ Agrec_t hdr;
275
+ /* to generate code */
276
+ layout_t *drawing;
277
+ textlabel_t *label; /* if the cluster has a title */
278
+ boxf bb; /* bounding box */
279
+ pointf border[4]; /* sizes of margins for graph labels */
280
+ unsigned char gui_state; /* Graph state for GUI ops */
281
+ unsigned char has_labels;
282
+ bool has_images;
283
+ unsigned char charset; /* input character set */
284
+ int rankdir;
285
+ double ht1; /* below and above extremal ranks */
286
+ double ht2; /* below and above extremal ranks */
287
+ unsigned short flags;
288
+ void *alg;
289
+ GVC_t *gvc; /* context for "globals" over multiple graphs */
290
+ void (*cleanup) (graph_t * g); /* function to deallocate layout-specific data */
291
+
292
+ #ifndef DOT_ONLY
293
+ /* to place nodes */
294
+ node_t **neato_nlist;
295
+ int move;
296
+ double **dist;
297
+ double **spring;
298
+ double **sum_t;
299
+ double ***t;
300
+ unsigned short ndim;
301
+ unsigned short odim;
302
+ #endif
303
+ #ifndef NEATO_ONLY
304
+ /* to have subgraphs */
305
+ int n_cluster;
306
+ graph_t **clust; /* clusters are in clust[1..n_cluster] !!! */
307
+ graph_t *dotroot;
308
+ node_t *nlist;
309
+ rank_t *rank;
310
+ graph_t *parent; /* containing cluster (not parent subgraph) */
311
+ int level; /* cluster nesting level (not node level!) */
312
+ node_t *minrep; /* set leaders for min and max rank */
313
+ node_t *maxrep; /* set leaders for min and max rank */
314
+
315
+ /* fast graph node list */
316
+ nlist_t comp;
317
+ /* connected components */
318
+ node_t *minset; /* set leaders */
319
+ node_t *maxset; /* set leaders */
320
+ long n_nodes;
321
+ /* includes virtual */
322
+ int minrank;
323
+ int maxrank;
324
+
325
+ /* various flags */
326
+ bool has_flat_edges;
327
+ bool has_sourcerank;
328
+ bool has_sinkrank;
329
+ unsigned char showboxes;
330
+ fontname_kind fontnames; /* to override mangling in SVG */
331
+
332
+ int nodesep;
333
+ int ranksep;
334
+ node_t *ln; /* left nodes of bounding box */
335
+ node_t *rn; /* right nodes of bounding box */
336
+
337
+ /* for clusters */
338
+ node_t *leader;
339
+ node_t **rankleader;
340
+ bool expanded;
341
+ char installed;
342
+ char set_type;
343
+ char label_pos;
344
+ bool exact_ranksep;
345
+ #endif
346
+
347
+ } Agraphinfo_t;
348
+
349
+ #define GD_parent(g) (((Agraphinfo_t*)AGDATA(g))->parent)
350
+ #define GD_level(g) (((Agraphinfo_t*)AGDATA(g))->level)
351
+ #define GD_drawing(g) (((Agraphinfo_t*)AGDATA(g))->drawing)
352
+ #define GD_bb(g) (((Agraphinfo_t*)AGDATA(g))->bb)
353
+ #define GD_gvc(g) (((Agraphinfo_t*)AGDATA(g))->gvc)
354
+ #define GD_cleanup(g) (((Agraphinfo_t*)AGDATA(g))->cleanup)
355
+ #define GD_dist(g) (((Agraphinfo_t*)AGDATA(g))->dist)
356
+ #define GD_alg(g) (((Agraphinfo_t*)AGDATA(g))->alg)
357
+ #define GD_border(g) (((Agraphinfo_t*)AGDATA(g))->border)
358
+ #define GD_clust(g) (((Agraphinfo_t*)AGDATA(g))->clust)
359
+ #define GD_dotroot(g) (((Agraphinfo_t*)AGDATA(g))->dotroot)
360
+ #define GD_comp(g) (((Agraphinfo_t*)AGDATA(g))->comp)
361
+ #define GD_exact_ranksep(g) (((Agraphinfo_t*)AGDATA(g))->exact_ranksep)
362
+ #define GD_expanded(g) (((Agraphinfo_t*)AGDATA(g))->expanded)
363
+ #define GD_flags(g) (((Agraphinfo_t*)AGDATA(g))->flags)
364
+ #define GD_gui_state(g) (((Agraphinfo_t*)AGDATA(g))->gui_state)
365
+ #define GD_charset(g) (((Agraphinfo_t*)AGDATA(g))->charset)
366
+ #define GD_has_labels(g) (((Agraphinfo_t*)AGDATA(g))->has_labels)
367
+ #define GD_has_images(g) (((Agraphinfo_t*)AGDATA(g))->has_images)
368
+ #define GD_has_flat_edges(g) (((Agraphinfo_t*)AGDATA(g))->has_flat_edges)
369
+ #define GD_has_sourcerank(g) (((Agraphinfo_t*)AGDATA(g))->has_sourcerank)
370
+ #define GD_has_sinkrank(g) (((Agraphinfo_t*)AGDATA(g))->has_sinkrank)
371
+ #define GD_ht1(g) (((Agraphinfo_t*)AGDATA(g))->ht1)
372
+ #define GD_ht2(g) (((Agraphinfo_t*)AGDATA(g))->ht2)
373
+ #define GD_installed(g) (((Agraphinfo_t*)AGDATA(g))->installed)
374
+ #define GD_label(g) (((Agraphinfo_t*)AGDATA(g))->label)
375
+ #define GD_leader(g) (((Agraphinfo_t*)AGDATA(g))->leader)
376
+ #define GD_rankdir2(g) (((Agraphinfo_t*)AGDATA(g))->rankdir)
377
+ #define GD_rankdir(g) (((Agraphinfo_t*)AGDATA(g))->rankdir & 0x3)
378
+ #define GD_flip(g) (GD_rankdir(g) & 1)
379
+ #define GD_realrankdir(g) ((((Agraphinfo_t*)AGDATA(g))->rankdir) >> 2)
380
+ #define GD_realflip(g) (GD_realrankdir(g) & 1)
381
+ #define GD_ln(g) (((Agraphinfo_t*)AGDATA(g))->ln)
382
+ #define GD_maxrank(g) (((Agraphinfo_t*)AGDATA(g))->maxrank)
383
+ #define GD_maxset(g) (((Agraphinfo_t*)AGDATA(g))->maxset)
384
+ #define GD_minrank(g) (((Agraphinfo_t*)AGDATA(g))->minrank)
385
+ #define GD_minset(g) (((Agraphinfo_t*)AGDATA(g))->minset)
386
+ #define GD_minrep(g) (((Agraphinfo_t*)AGDATA(g))->minrep)
387
+ #define GD_maxrep(g) (((Agraphinfo_t*)AGDATA(g))->maxrep)
388
+ #define GD_move(g) (((Agraphinfo_t*)AGDATA(g))->move)
389
+ #define GD_n_cluster(g) (((Agraphinfo_t*)AGDATA(g))->n_cluster)
390
+ #define GD_n_nodes(g) (((Agraphinfo_t*)AGDATA(g))->n_nodes)
391
+ #define GD_ndim(g) (((Agraphinfo_t*)AGDATA(g))->ndim)
392
+ #define GD_odim(g) (((Agraphinfo_t*)AGDATA(g))->odim)
393
+ #define GD_neato_nlist(g) (((Agraphinfo_t*)AGDATA(g))->neato_nlist)
394
+ #define GD_nlist(g) (((Agraphinfo_t*)AGDATA(g))->nlist)
395
+ #define GD_nodesep(g) (((Agraphinfo_t*)AGDATA(g))->nodesep)
396
+ #define GD_outleaf(g) (((Agraphinfo_t*)AGDATA(g))->outleaf)
397
+ #define GD_rank(g) (((Agraphinfo_t*)AGDATA(g))->rank)
398
+ #define GD_rankleader(g) (((Agraphinfo_t*)AGDATA(g))->rankleader)
399
+ #define GD_ranksep(g) (((Agraphinfo_t*)AGDATA(g))->ranksep)
400
+ #define GD_rn(g) (((Agraphinfo_t*)AGDATA(g))->rn)
401
+ #define GD_set_type(g) (((Agraphinfo_t*)AGDATA(g))->set_type)
402
+ #define GD_label_pos(g) (((Agraphinfo_t*)AGDATA(g))->label_pos)
403
+ #define GD_showboxes(g) (((Agraphinfo_t*)AGDATA(g))->showboxes)
404
+ #define GD_fontnames(g) (((Agraphinfo_t*)AGDATA(g))->fontnames)
405
+ #define GD_spring(g) (((Agraphinfo_t*)AGDATA(g))->spring)
406
+ #define GD_sum_t(g) (((Agraphinfo_t*)AGDATA(g))->sum_t)
407
+ #define GD_t(g) (((Agraphinfo_t*)AGDATA(g))->t)
408
+
409
+ typedef struct Agnodeinfo_t {
410
+ Agrec_t hdr;
411
+ shape_desc *shape;
412
+ void *shape_info;
413
+ pointf coord;
414
+ double width; /* inches */
415
+ double height; /* inches */
416
+ boxf bb;
417
+ double ht;
418
+ double lw;
419
+ double rw;
420
+ double outline_width; /* width in points with penwidth taken into account */
421
+ double outline_height; /* height in points with penwidth taken into account */
422
+ textlabel_t *label;
423
+ textlabel_t *xlabel;
424
+ void *alg;
425
+ char state;
426
+ unsigned char gui_state; /* Node state for GUI ops */
427
+ bool clustnode;
428
+
429
+ #ifndef DOT_ONLY
430
+ unsigned char pinned;
431
+ int id;
432
+ int heapindex;
433
+ int hops;
434
+ double *pos;
435
+ double dist;
436
+ #endif
437
+ #ifndef NEATO_ONLY
438
+ unsigned char showboxes;
439
+ bool has_port;
440
+ node_t* rep;
441
+ node_t *set;
442
+
443
+ /* fast graph */
444
+ char node_type;
445
+ size_t mark;
446
+ char onstack;
447
+ char ranktype;
448
+ char weight_class;
449
+ node_t *next;
450
+ node_t *prev;
451
+ elist in;
452
+ elist out;
453
+ elist flat_out;
454
+ elist flat_in;
455
+ elist other;
456
+ graph_t *clust;
457
+
458
+ /* for union-find and collapsing nodes */
459
+ int UF_size;
460
+ node_t *UF_parent;
461
+ node_t *inleaf;
462
+ node_t *outleaf;
463
+
464
+ /* for placing nodes */
465
+ int rank;
466
+ int order; /* initially, order = 1 for ordered edges */
467
+ double mval;
468
+ elist save_in;
469
+ elist save_out;
470
+
471
+ /* for network-simplex */
472
+ elist tree_in;
473
+ elist tree_out;
474
+ edge_t *par;
475
+ int low;
476
+ int lim;
477
+ int priority;
478
+
479
+ double pad[1];
480
+ #endif
481
+
482
+ } Agnodeinfo_t;
483
+
484
+ #define ND_id(n) (((Agnodeinfo_t*)AGDATA(n))->id)
485
+ #define ND_alg(n) (((Agnodeinfo_t*)AGDATA(n))->alg)
486
+ #define ND_UF_parent(n) (((Agnodeinfo_t*)AGDATA(n))->UF_parent)
487
+ #define ND_set(n) (((Agnodeinfo_t*)AGDATA(n))->set)
488
+ #define ND_UF_size(n) (((Agnodeinfo_t*)AGDATA(n))->UF_size)
489
+ #define ND_bb(n) (((Agnodeinfo_t*)AGDATA(n))->bb)
490
+ #define ND_clust(n) (((Agnodeinfo_t*)AGDATA(n))->clust)
491
+ #define ND_coord(n) (((Agnodeinfo_t*)AGDATA(n))->coord)
492
+ #define ND_dist(n) (((Agnodeinfo_t*)AGDATA(n))->dist)
493
+ #define ND_flat_in(n) (((Agnodeinfo_t*)AGDATA(n))->flat_in)
494
+ #define ND_flat_out(n) (((Agnodeinfo_t*)AGDATA(n))->flat_out)
495
+ #define ND_gui_state(n) (((Agnodeinfo_t*)AGDATA(n))->gui_state)
496
+ #define ND_has_port(n) (((Agnodeinfo_t*)AGDATA(n))->has_port)
497
+ #define ND_rep(n) (((Agnodeinfo_t*)AGDATA(n))->rep)
498
+ #define ND_heapindex(n) (((Agnodeinfo_t*)AGDATA(n))->heapindex)
499
+ #define ND_height(n) (((Agnodeinfo_t*)AGDATA(n))->height)
500
+ #define ND_hops(n) (((Agnodeinfo_t*)AGDATA(n))->hops)
501
+ #define ND_ht(n) (((Agnodeinfo_t*)AGDATA(n))->ht)
502
+ #define ND_in(n) (((Agnodeinfo_t*)AGDATA(n))->in)
503
+ #define ND_inleaf(n) (((Agnodeinfo_t*)AGDATA(n))->inleaf)
504
+ #define ND_label(n) (((Agnodeinfo_t*)AGDATA(n))->label)
505
+ #define ND_xlabel(n) (((Agnodeinfo_t*)AGDATA(n))->xlabel)
506
+ #define ND_lim(n) (((Agnodeinfo_t*)AGDATA(n))->lim)
507
+ #define ND_low(n) (((Agnodeinfo_t*)AGDATA(n))->low)
508
+ #define ND_lw(n) (((Agnodeinfo_t*)AGDATA(n))->lw)
509
+ #define ND_mark(n) (((Agnodeinfo_t*)AGDATA(n))->mark)
510
+ #define ND_mval(n) (((Agnodeinfo_t*)AGDATA(n))->mval)
511
+ #define ND_n_cluster(n) (((Agnodeinfo_t*)AGDATA(n))->n_cluster)
512
+ #define ND_next(n) (((Agnodeinfo_t*)AGDATA(n))->next)
513
+ #define ND_node_type(n) (((Agnodeinfo_t*)AGDATA(n))->node_type)
514
+ #define ND_onstack(n) (((Agnodeinfo_t*)AGDATA(n))->onstack)
515
+ #define ND_order(n) (((Agnodeinfo_t*)AGDATA(n))->order)
516
+ #define ND_other(n) (((Agnodeinfo_t*)AGDATA(n))->other)
517
+ #define ND_out(n) (((Agnodeinfo_t*)AGDATA(n))->out)
518
+ #define ND_outleaf(n) (((Agnodeinfo_t*)AGDATA(n))->outleaf)
519
+ #define ND_outline_width(n) (((Agnodeinfo_t*)AGDATA(n))->outline_width)
520
+ #define ND_outline_height(n) (((Agnodeinfo_t*)AGDATA(n))->outline_height)
521
+ #define ND_par(n) (((Agnodeinfo_t*)AGDATA(n))->par)
522
+ #define ND_pinned(n) (((Agnodeinfo_t*)AGDATA(n))->pinned)
523
+ #define ND_pos(n) (((Agnodeinfo_t*)AGDATA(n))->pos)
524
+ #define ND_prev(n) (((Agnodeinfo_t*)AGDATA(n))->prev)
525
+ #define ND_priority(n) (((Agnodeinfo_t*)AGDATA(n))->priority)
526
+ #define ND_rank(n) (((Agnodeinfo_t*)AGDATA(n))->rank)
527
+ #define ND_ranktype(n) (((Agnodeinfo_t*)AGDATA(n))->ranktype)
528
+ #define ND_rw(n) (((Agnodeinfo_t*)AGDATA(n))->rw)
529
+ #define ND_save_in(n) (((Agnodeinfo_t*)AGDATA(n))->save_in)
530
+ #define ND_save_out(n) (((Agnodeinfo_t*)AGDATA(n))->save_out)
531
+ #define ND_shape(n) (((Agnodeinfo_t*)AGDATA(n))->shape)
532
+ #define ND_shape_info(n) (((Agnodeinfo_t*)AGDATA(n))->shape_info)
533
+ #define ND_showboxes(n) (((Agnodeinfo_t*)AGDATA(n))->showboxes)
534
+ #define ND_state(n) (((Agnodeinfo_t*)AGDATA(n))->state)
535
+ #define ND_clustnode(n) (((Agnodeinfo_t*)AGDATA(n))->clustnode)
536
+ #define ND_tree_in(n) (((Agnodeinfo_t*)AGDATA(n))->tree_in)
537
+ #define ND_tree_out(n) (((Agnodeinfo_t*)AGDATA(n))->tree_out)
538
+ #define ND_weight_class(n) (((Agnodeinfo_t*)AGDATA(n))->weight_class)
539
+ #define ND_width(n) (((Agnodeinfo_t*)AGDATA(n))->width)
540
+ #define ND_xsize(n) (ND_lw(n)+ND_rw(n))
541
+ #define ND_ysize(n) (ND_ht(n))
542
+
543
+ typedef struct Agedgeinfo_t {
544
+ Agrec_t hdr;
545
+ splines *spl;
546
+ port tail_port;
547
+ port head_port;
548
+ textlabel_t *label;
549
+ textlabel_t *head_label;
550
+ textlabel_t *tail_label;
551
+ textlabel_t *xlabel;
552
+ char edge_type;
553
+ char compound;
554
+ char adjacent; /* true for flat edge with adjacent nodes */
555
+ char label_ontop;
556
+ unsigned char gui_state; /* Edge state for GUI ops */
557
+ edge_t *to_orig; /* for dot's shapes.c */
558
+ void *alg;
559
+
560
+ #ifndef DOT_ONLY
561
+ double factor;
562
+ double dist;
563
+ Ppolyline_t path;
564
+ #endif
565
+ #ifndef NEATO_ONLY
566
+ unsigned char showboxes;
567
+ bool conc_opp_flag;
568
+ short xpenalty;
569
+ int weight;
570
+ int cutvalue;
571
+ int tree_index;
572
+ short count;
573
+ unsigned short minlen;
574
+ edge_t *to_virt;
575
+ #endif
576
+ } Agedgeinfo_t;
577
+
578
+ #define ED_alg(e) (((Agedgeinfo_t*)AGDATA(e))->alg)
579
+ #define ED_conc_opp_flag(e) (((Agedgeinfo_t*)AGDATA(e))->conc_opp_flag)
580
+ #define ED_count(e) (((Agedgeinfo_t*)AGDATA(e))->count)
581
+ #define ED_cutvalue(e) (((Agedgeinfo_t*)AGDATA(e))->cutvalue)
582
+ #define ED_edge_type(e) (((Agedgeinfo_t*)AGDATA(e))->edge_type)
583
+ #define ED_compound(e) (((Agedgeinfo_t*)AGDATA(e))->compound)
584
+ #define ED_adjacent(e) (((Agedgeinfo_t*)AGDATA(e))->adjacent)
585
+ #define ED_factor(e) (((Agedgeinfo_t*)AGDATA(e))->factor)
586
+ #define ED_gui_state(e) (((Agedgeinfo_t*)AGDATA(e))->gui_state)
587
+ #define ED_head_label(e) (((Agedgeinfo_t*)AGDATA(e))->head_label)
588
+ #define ED_head_port(e) (((Agedgeinfo_t*)AGDATA(e))->head_port)
589
+ #define ED_label(e) (((Agedgeinfo_t*)AGDATA(e))->label)
590
+ #define ED_xlabel(e) (((Agedgeinfo_t*)AGDATA(e))->xlabel)
591
+ #define ED_label_ontop(e) (((Agedgeinfo_t*)AGDATA(e))->label_ontop)
592
+ #define ED_minlen(e) (((Agedgeinfo_t*)AGDATA(e))->minlen)
593
+ #define ED_path(e) (((Agedgeinfo_t*)AGDATA(e))->path)
594
+ #define ED_showboxes(e) (((Agedgeinfo_t*)AGDATA(e))->showboxes)
595
+ #define ED_spl(e) (((Agedgeinfo_t*)AGDATA(e))->spl)
596
+ #define ED_tail_label(e) (((Agedgeinfo_t*)AGDATA(e))->tail_label)
597
+ #define ED_tail_port(e) (((Agedgeinfo_t*)AGDATA(e))->tail_port)
598
+ #define ED_to_orig(e) (((Agedgeinfo_t*)AGDATA(e))->to_orig)
599
+ #define ED_to_virt(e) (((Agedgeinfo_t*)AGDATA(e))->to_virt)
600
+ #define ED_tree_index(e) (((Agedgeinfo_t*)AGDATA(e))->tree_index)
601
+ #define ED_xpenalty(e) (((Agedgeinfo_t*)AGDATA(e))->xpenalty)
602
+ #define ED_dist(e) (((Agedgeinfo_t*)AGDATA(e))->dist)
603
+ #define ED_weight(e) (((Agedgeinfo_t*)AGDATA(e))->weight)
604
+
605
+ #define ag_xget(x,a) agxget(x,a)
606
+ #define SET_RANKDIR(g,rd) (GD_rankdir2(g) = rd)
607
+ #define agfindedge(g,t,h) (agedge(g,t,h,NULL,0))
608
+ #define agfindnode(g,n) (agnode(g,n,0))
609
+ #define agfindgraphattr(g,a) (agattr(g,AGRAPH,a,NULL))
610
+ #define agfindnodeattr(g,a) (agattr(g,AGNODE,a,NULL))
611
+ #define agfindedgeattr(g,a) (agattr(g,AGEDGE,a,NULL))
612
+
613
+ typedef struct {
614
+ int flags;
615
+ } gvlayout_features_t;
616
+
617
+ #ifdef __cplusplus
618
+ }
619
+ #endif
data/miniconda3/include/graphviz/usershape.h ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*************************************************************************
2
+ * Copyright (c) 2011 AT&T Intellectual Property
3
+ * All rights reserved. This program and the accompanying materials
4
+ * are made available under the terms of the Eclipse Public License v1.0
5
+ * which accompanies this distribution, and is available at
6
+ * http://www.eclipse.org/legal/epl-v10.html
7
+ *
8
+ * Contributors: Details at https://graphviz.org
9
+ *************************************************************************/
10
+
11
+ #pragma once
12
+
13
+ #include "cdt.h"
14
+ #include <stdbool.h>
15
+
16
+ #ifdef __cplusplus
17
+ extern "C" {
18
+ #endif
19
+
20
+ typedef enum { FT_NULL,
21
+ FT_BMP, FT_GIF, FT_PNG, FT_JPEG,
22
+ FT_PDF, FT_PS, FT_EPS, FT_SVG, FT_XML,
23
+ FT_RIFF, FT_WEBP, FT_ICO, FT_TIFF
24
+ } imagetype_t;
25
+
26
+ typedef enum {
27
+ IMAGESCALE_FALSE, /* no image scaling */
28
+ IMAGESCALE_TRUE, /* scale image to fit but keep aspect ratio */
29
+ IMAGESCALE_WIDTH, /* scale image width to fit, keep height fixed */
30
+ IMAGESCALE_HEIGHT, /* scale image height to fit, keep width fixed */
31
+ IMAGESCALE_BOTH /* scale image to fit without regard for aspect ratio */
32
+ } imagescale_t;
33
+
34
+ typedef enum {
35
+ IMAGEPOS_TOP_LEFT, /* top left */
36
+ IMAGEPOS_TOP_CENTER, /* top center */
37
+ IMAGEPOS_TOP_RIGHT, /* top right */
38
+ IMAGEPOS_MIDDLE_LEFT, /* middle left */
39
+ IMAGEPOS_MIDDLE_CENTER, /* middle center (true center, the default)*/
40
+ IMAGEPOS_MIDDLE_RIGHT, /* middle right */
41
+ IMAGEPOS_BOTTOM_LEFT, /* bottom left */
42
+ IMAGEPOS_BOTTOM_CENTER, /* bottom center */
43
+ IMAGEPOS_BOTTOM_RIGHT /* bottom right */
44
+ } imagepos_t;
45
+
46
+ typedef struct usershape_s usershape_t;
47
+
48
+ struct usershape_s {
49
+ Dtlink_t link;
50
+ const char *name;
51
+ int macro_id;
52
+ bool must_inline;
53
+ bool nocache;
54
+ FILE *f;
55
+ imagetype_t type;
56
+ char *stringtype;
57
+ int x, y, w, h, dpi;
58
+ void *data; /* data loaded by a renderer */
59
+ size_t datasize; /* size of data (if mmap'ed) */
60
+ void (*datafree)(usershape_t *us); /* renderer's function for freeing data */
61
+ };
62
+
63
+ #ifdef __cplusplus
64
+ }
65
+ #endif
data/miniconda3/include/graphviz/xdot.h ADDED
@@ -0,0 +1,187 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*************************************************************************
2
+ * Copyright (c) 2011 AT&T Intellectual Property
3
+ * All rights reserved. This program and the accompanying materials
4
+ * are made available under the terms of the Eclipse Public License v1.0
5
+ * which accompanies this distribution, and is available at
6
+ * http://www.eclipse.org/legal/epl-v10.html
7
+ *
8
+ * Contributors: Details at https://graphviz.org
9
+ *************************************************************************/
10
+
11
+ #pragma once
12
+
13
+ #include <stddef.h>
14
+ #include <stdio.h>
15
+
16
+ #ifdef __cplusplus
17
+ extern "C" {
18
+ #endif
19
+
20
+ #ifdef GVDLL
21
+ #ifdef EXPORT_XDOT
22
+ #define XDOT_API __declspec(dllexport)
23
+ #else
24
+ #define XDOT_API __declspec(dllimport)
25
+ #endif
26
+ #endif
27
+
28
+ #ifndef XDOT_API
29
+ #define XDOT_API /* nothing */
30
+ #endif
31
+
32
+ #define INITIAL_XDOT_CAPACITY 512
33
+
34
+ typedef enum {
35
+ xd_none,
36
+ xd_linear,
37
+ xd_radial
38
+ } xdot_grad_type;
39
+
40
+ typedef struct {
41
+ float frac;
42
+ char* color;
43
+ } xdot_color_stop;
44
+
45
+ typedef struct {
46
+ double x0, y0;
47
+ double x1, y1;
48
+ int n_stops;
49
+ xdot_color_stop* stops;
50
+ } xdot_linear_grad;
51
+
52
+ typedef struct {
53
+ double x0, y0, r0;
54
+ double x1, y1, r1;
55
+ int n_stops;
56
+ xdot_color_stop* stops;
57
+ } xdot_radial_grad;
58
+
59
+ typedef struct {
60
+ xdot_grad_type type;
61
+ union {
62
+ char* clr;
63
+ xdot_linear_grad ling;
64
+ xdot_radial_grad ring;
65
+ } u;
66
+ } xdot_color;
67
+
68
+ typedef enum {
69
+ xd_left, xd_center, xd_right
70
+ } xdot_align;
71
+
72
+ typedef struct {
73
+ double x, y, z;
74
+ } xdot_point;
75
+
76
+ typedef struct {
77
+ double x, y, w, h;
78
+ } xdot_rect;
79
+
80
+ typedef struct {
81
+ size_t cnt;
82
+ xdot_point* pts;
83
+ } xdot_polyline;
84
+
85
+ typedef struct {
86
+ double x, y;
87
+ xdot_align align;
88
+ double width;
89
+ char* text;
90
+ } xdot_text;
91
+
92
+ typedef struct {
93
+ xdot_rect pos;
94
+ char* name;
95
+ } xdot_image;
96
+
97
+ typedef struct {
98
+ double size;
99
+ char* name;
100
+ } xdot_font;
101
+
102
+ typedef enum {
103
+ xd_filled_ellipse, xd_unfilled_ellipse,
104
+ xd_filled_polygon, xd_unfilled_polygon,
105
+ xd_filled_bezier, xd_unfilled_bezier,
106
+ xd_polyline, xd_text,
107
+ xd_fill_color, xd_pen_color, xd_font, xd_style, xd_image,
108
+ xd_grad_fill_color, xd_grad_pen_color,
109
+ xd_fontchar
110
+ } xdot_kind;
111
+
112
+ typedef enum {
113
+ xop_ellipse,
114
+ xop_polygon,
115
+ xop_bezier,
116
+ xop_polyline, xop_text,
117
+ xop_fill_color, xop_pen_color, xop_font, xop_style, xop_image,
118
+ xop_grad_color,
119
+ xop_fontchar
120
+ } xop_kind;
121
+
122
+ typedef struct _xdot_op xdot_op;
123
+ typedef void (*drawfunc_t)(xdot_op*, int);
124
+ typedef void (*freefunc_t)(xdot_op*);
125
+
126
+ struct _xdot_op {
127
+ xdot_kind kind;
128
+ union {
129
+ xdot_rect ellipse; /* xd_filled_ellipse, xd_unfilled_ellipse */
130
+ xdot_polyline polygon; /* xd_filled_polygon, xd_unfilled_polygon */
131
+ xdot_polyline polyline; /* xd_polyline */
132
+ xdot_polyline bezier; /* xd_filled_bezier, xd_unfilled_bezier */
133
+ xdot_text text; /* xd_text */
134
+ xdot_image image; /* xd_image */
135
+ char* color; /* xd_fill_color, xd_pen_color */
136
+ xdot_color grad_color; /* xd_grad_fill_color, xd_grad_pen_color */
137
+ xdot_font font; /* xd_font */
138
+ char* style; /* xd_style */
139
+ unsigned int fontchar; /* xd_fontchar */
140
+ } u;
141
+ drawfunc_t drawfunc;
142
+ };
143
+
144
+ #define XDOT_PARSE_ERROR 1
145
+
146
+ typedef struct {
147
+ size_t cnt; /* no. of xdot ops */
148
+ size_t sz; /* sizeof structure containing xdot_op as first field */
149
+ xdot_op* ops;
150
+ freefunc_t freefunc;
151
+ int flags;
152
+ } xdot;
153
+
154
+ typedef struct {
155
+ size_t cnt; /* no. of xdot ops */
156
+ size_t n_ellipse;
157
+ size_t n_polygon;
158
+ size_t n_polygon_pts;
159
+ size_t n_polyline;
160
+ size_t n_polyline_pts;
161
+ size_t n_bezier;
162
+ size_t n_bezier_pts;
163
+ size_t n_text;
164
+ size_t n_font;
165
+ size_t n_style;
166
+ size_t n_color;
167
+ size_t n_image;
168
+ size_t n_gradcolor;
169
+ size_t n_fontchar;
170
+ } xdot_stats;
171
+
172
+ /* ops are indexed by xop_kind */
173
+ XDOT_API xdot *parseXDotF(char*, drawfunc_t opfns[], size_t sz);
174
+ XDOT_API xdot *parseXDotFOn(char*, drawfunc_t opfns[], size_t sz, xdot*);
175
+ XDOT_API xdot* parseXDot (char*);
176
+ XDOT_API char* sprintXDot (xdot*);
177
+ XDOT_API void fprintXDot (FILE*, xdot*);
178
+ XDOT_API void jsonXDot (FILE*, xdot*);
179
+ XDOT_API void freeXDot (xdot*);
180
+ XDOT_API int statXDot (xdot*, xdot_stats*);
181
+ XDOT_API xdot_grad_type colorTypeXDot (char*);
182
+ XDOT_API char* parseXDotColor (char* cp, xdot_color* clr);
183
+ XDOT_API void freeXDotColor (xdot_color*);
184
+
185
+ #ifdef __cplusplus
186
+ }
187
+ #endif
data/miniconda3/include/gtest/gtest-death-test.h ADDED
@@ -0,0 +1,346 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright 2005, Google Inc.
2
+ // All rights reserved.
3
+ //
4
+ // Redistribution and use in source and binary forms, with or without
5
+ // modification, are permitted provided that the following conditions are
6
+ // met:
7
+ //
8
+ // * Redistributions of source code must retain the above copyright
9
+ // notice, this list of conditions and the following disclaimer.
10
+ // * Redistributions in binary form must reproduce the above
11
+ // copyright notice, this list of conditions and the following disclaimer
12
+ // in the documentation and/or other materials provided with the
13
+ // distribution.
14
+ // * Neither the name of Google Inc. nor the names of its
15
+ // contributors may be used to endorse or promote products derived from
16
+ // this software without specific prior written permission.
17
+ //
18
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+
30
+ //
31
+ // The Google C++ Testing and Mocking Framework (Google Test)
32
+ //
33
+ // This header file defines the public API for death tests. It is
34
+ // #included by gtest.h so a user doesn't need to include this
35
+ // directly.
36
+ // GOOGLETEST_CM0001 DO NOT DELETE
37
+
38
+ #ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
39
+ #define GOOGLETEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
40
+
41
+ #include "gtest/internal/gtest-death-test-internal.h"
42
+
43
+ namespace testing {
44
+
45
+ // This flag controls the style of death tests. Valid values are "threadsafe",
46
+ // meaning that the death test child process will re-execute the test binary
47
+ // from the start, running only a single death test, or "fast",
48
+ // meaning that the child process will execute the test logic immediately
49
+ // after forking.
50
+ GTEST_DECLARE_string_(death_test_style);
51
+
52
+ #if GTEST_HAS_DEATH_TEST
53
+
54
+ namespace internal {
55
+
56
+ // Returns a Boolean value indicating whether the caller is currently
57
+ // executing in the context of the death test child process. Tools such as
58
+ // Valgrind heap checkers may need this to modify their behavior in death
59
+ // tests. IMPORTANT: This is an internal utility. Using it may break the
60
+ // implementation of death tests. User code MUST NOT use it.
61
+ GTEST_API_ bool InDeathTestChild();
62
+
63
+ } // namespace internal
64
+
65
+ // The following macros are useful for writing death tests.
66
+
67
+ // Here's what happens when an ASSERT_DEATH* or EXPECT_DEATH* is
68
+ // executed:
69
+ //
70
+ // 1. It generates a warning if there is more than one active
71
+ // thread. This is because it's safe to fork() or clone() only
72
+ // when there is a single thread.
73
+ //
74
+ // 2. The parent process clone()s a sub-process and runs the death
75
+ // test in it; the sub-process exits with code 0 at the end of the
76
+ // death test, if it hasn't exited already.
77
+ //
78
+ // 3. The parent process waits for the sub-process to terminate.
79
+ //
80
+ // 4. The parent process checks the exit code and error message of
81
+ // the sub-process.
82
+ //
83
+ // Examples:
84
+ //
85
+ // ASSERT_DEATH(server.SendMessage(56, "Hello"), "Invalid port number");
86
+ // for (int i = 0; i < 5; i++) {
87
+ // EXPECT_DEATH(server.ProcessRequest(i),
88
+ // "Invalid request .* in ProcessRequest()")
89
+ // << "Failed to die on request " << i;
90
+ // }
91
+ //
92
+ // ASSERT_EXIT(server.ExitNow(), ::testing::ExitedWithCode(0), "Exiting");
93
+ //
94
+ // bool KilledBySIGHUP(int exit_code) {
95
+ // return WIFSIGNALED(exit_code) && WTERMSIG(exit_code) == SIGHUP;
96
+ // }
97
+ //
98
+ // ASSERT_EXIT(client.HangUpServer(), KilledBySIGHUP, "Hanging up!");
99
+ //
100
+ // The final parameter to each of these macros is a matcher applied to any data
101
+ // the sub-process wrote to stderr. For compatibility with existing tests, a
102
+ // bare string is interpreted as a regular expression matcher.
103
+ //
104
+ // On the regular expressions used in death tests:
105
+ //
106
+ // GOOGLETEST_CM0005 DO NOT DELETE
107
+ // On POSIX-compliant systems (*nix), we use the <regex.h> library,
108
+ // which uses the POSIX extended regex syntax.
109
+ //
110
+ // On other platforms (e.g. Windows or Mac), we only support a simple regex
111
+ // syntax implemented as part of Google Test. This limited
112
+ // implementation should be enough most of the time when writing
113
+ // death tests; though it lacks many features you can find in PCRE
114
+ // or POSIX extended regex syntax. For example, we don't support
115
+ // union ("x|y"), grouping ("(xy)"), brackets ("[xy]"), and
116
+ // repetition count ("x{5,7}"), among others.
117
+ //
118
+ // Below is the syntax that we do support. We chose it to be a
119
+ // subset of both PCRE and POSIX extended regex, so it's easy to
120
+ // learn wherever you come from. In the following: 'A' denotes a
121
+ // literal character, period (.), or a single \\ escape sequence;
122
+ // 'x' and 'y' denote regular expressions; 'm' and 'n' are for
123
+ // natural numbers.
124
+ //
125
+ // c matches any literal character c
126
+ // \\d matches any decimal digit
127
+ // \\D matches any character that's not a decimal digit
128
+ // \\f matches \f
129
+ // \\n matches \n
130
+ // \\r matches \r
131
+ // \\s matches any ASCII whitespace, including \n
132
+ // \\S matches any character that's not a whitespace
133
+ // \\t matches \t
134
+ // \\v matches \v
135
+ // \\w matches any letter, _, or decimal digit
136
+ // \\W matches any character that \\w doesn't match
137
+ // \\c matches any literal character c, which must be a punctuation
138
+ // . matches any single character except \n
139
+ // A? matches 0 or 1 occurrences of A
140
+ // A* matches 0 or many occurrences of A
141
+ // A+ matches 1 or many occurrences of A
142
+ // ^ matches the beginning of a string (not that of each line)
143
+ // $ matches the end of a string (not that of each line)
144
+ // xy matches x followed by y
145
+ //
146
+ // If you accidentally use PCRE or POSIX extended regex features
147
+ // not implemented by us, you will get a run-time failure. In that
148
+ // case, please try to rewrite your regular expression within the
149
+ // above syntax.
150
+ //
151
+ // This implementation is *not* meant to be as highly tuned or robust
152
+ // as a compiled regex library, but should perform well enough for a
153
+ // death test, which already incurs significant overhead by launching
154
+ // a child process.
155
+ //
156
+ // Known caveats:
157
+ //
158
+ // A "threadsafe" style death test obtains the path to the test
159
+ // program from argv[0] and re-executes it in the sub-process. For
160
+ // simplicity, the current implementation doesn't search the PATH
161
+ // when launching the sub-process. This means that the user must
162
+ // invoke the test program via a path that contains at least one
163
+ // path separator (e.g. path/to/foo_test and
164
+ // /absolute/path/to/bar_test are fine, but foo_test is not). This
165
+ // is rarely a problem as people usually don't put the test binary
166
+ // directory in PATH.
167
+ //
168
+
169
+ // Asserts that a given `statement` causes the program to exit, with an
170
+ // integer exit status that satisfies `predicate`, and emitting error output
171
+ // that matches `matcher`.
172
+ # define ASSERT_EXIT(statement, predicate, matcher) \
173
+ GTEST_DEATH_TEST_(statement, predicate, matcher, GTEST_FATAL_FAILURE_)
174
+
175
+ // Like `ASSERT_EXIT`, but continues on to successive tests in the
176
+ // test suite, if any:
177
+ # define EXPECT_EXIT(statement, predicate, matcher) \
178
+ GTEST_DEATH_TEST_(statement, predicate, matcher, GTEST_NONFATAL_FAILURE_)
179
+
180
+ // Asserts that a given `statement` causes the program to exit, either by
181
+ // explicitly exiting with a nonzero exit code or being killed by a
182
+ // signal, and emitting error output that matches `matcher`.
183
+ # define ASSERT_DEATH(statement, matcher) \
184
+ ASSERT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, matcher)
185
+
186
+ // Like `ASSERT_DEATH`, but continues on to successive tests in the
187
+ // test suite, if any:
188
+ # define EXPECT_DEATH(statement, matcher) \
189
+ EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, matcher)
190
+
191
+ // Two predicate classes that can be used in {ASSERT,EXPECT}_EXIT*:
192
+
193
+ // Tests that an exit code describes a normal exit with a given exit code.
194
+ class GTEST_API_ ExitedWithCode {
195
+ public:
196
+ explicit ExitedWithCode(int exit_code);
197
+ ExitedWithCode(const ExitedWithCode&) = default;
198
+ void operator=(const ExitedWithCode& other) = delete;
199
+ bool operator()(int exit_status) const;
200
+ private:
201
+ const int exit_code_;
202
+ };
203
+
204
+ # if !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA
205
+ // Tests that an exit code describes an exit due to termination by a
206
+ // given signal.
207
+ // GOOGLETEST_CM0006 DO NOT DELETE
208
+ class GTEST_API_ KilledBySignal {
209
+ public:
210
+ explicit KilledBySignal(int signum);
211
+ bool operator()(int exit_status) const;
212
+ private:
213
+ const int signum_;
214
+ };
215
+ # endif // !GTEST_OS_WINDOWS
216
+
217
+ // EXPECT_DEBUG_DEATH asserts that the given statements die in debug mode.
218
+ // The death testing framework causes this to have interesting semantics,
219
+ // since the sideeffects of the call are only visible in opt mode, and not
220
+ // in debug mode.
221
+ //
222
+ // In practice, this can be used to test functions that utilize the
223
+ // LOG(DFATAL) macro using the following style:
224
+ //
225
+ // int DieInDebugOr12(int* sideeffect) {
226
+ // if (sideeffect) {
227
+ // *sideeffect = 12;
228
+ // }
229
+ // LOG(DFATAL) << "death";
230
+ // return 12;
231
+ // }
232
+ //
233
+ // TEST(TestSuite, TestDieOr12WorksInDgbAndOpt) {
234
+ // int sideeffect = 0;
235
+ // // Only asserts in dbg.
236
+ // EXPECT_DEBUG_DEATH(DieInDebugOr12(&sideeffect), "death");
237
+ //
238
+ // #ifdef NDEBUG
239
+ // // opt-mode has sideeffect visible.
240
+ // EXPECT_EQ(12, sideeffect);
241
+ // #else
242
+ // // dbg-mode no visible sideeffect.
243
+ // EXPECT_EQ(0, sideeffect);
244
+ // #endif
245
+ // }
246
+ //
247
+ // This will assert that DieInDebugReturn12InOpt() crashes in debug
248
+ // mode, usually due to a DCHECK or LOG(DFATAL), but returns the
249
+ // appropriate fallback value (12 in this case) in opt mode. If you
250
+ // need to test that a function has appropriate side-effects in opt
251
+ // mode, include assertions against the side-effects. A general
252
+ // pattern for this is:
253
+ //
254
+ // EXPECT_DEBUG_DEATH({
255
+ // // Side-effects here will have an effect after this statement in
256
+ // // opt mode, but none in debug mode.
257
+ // EXPECT_EQ(12, DieInDebugOr12(&sideeffect));
258
+ // }, "death");
259
+ //
260
+ # ifdef NDEBUG
261
+
262
+ # define EXPECT_DEBUG_DEATH(statement, regex) \
263
+ GTEST_EXECUTE_STATEMENT_(statement, regex)
264
+
265
+ # define ASSERT_DEBUG_DEATH(statement, regex) \
266
+ GTEST_EXECUTE_STATEMENT_(statement, regex)
267
+
268
+ # else
269
+
270
+ # define EXPECT_DEBUG_DEATH(statement, regex) \
271
+ EXPECT_DEATH(statement, regex)
272
+
273
+ # define ASSERT_DEBUG_DEATH(statement, regex) \
274
+ ASSERT_DEATH(statement, regex)
275
+
276
+ # endif // NDEBUG for EXPECT_DEBUG_DEATH
277
+ #endif // GTEST_HAS_DEATH_TEST
278
+
279
+ // This macro is used for implementing macros such as
280
+ // EXPECT_DEATH_IF_SUPPORTED and ASSERT_DEATH_IF_SUPPORTED on systems where
281
+ // death tests are not supported. Those macros must compile on such systems
282
+ // if and only if EXPECT_DEATH and ASSERT_DEATH compile with the same parameters
283
+ // on systems that support death tests. This allows one to write such a macro on
284
+ // a system that does not support death tests and be sure that it will compile
285
+ // on a death-test supporting system. It is exposed publicly so that systems
286
+ // that have death-tests with stricter requirements than GTEST_HAS_DEATH_TEST
287
+ // can write their own equivalent of EXPECT_DEATH_IF_SUPPORTED and
288
+ // ASSERT_DEATH_IF_SUPPORTED.
289
+ //
290
+ // Parameters:
291
+ // statement - A statement that a macro such as EXPECT_DEATH would test
292
+ // for program termination. This macro has to make sure this
293
+ // statement is compiled but not executed, to ensure that
294
+ // EXPECT_DEATH_IF_SUPPORTED compiles with a certain
295
+ // parameter if and only if EXPECT_DEATH compiles with it.
296
+ // regex - A regex that a macro such as EXPECT_DEATH would use to test
297
+ // the output of statement. This parameter has to be
298
+ // compiled but not evaluated by this macro, to ensure that
299
+ // this macro only accepts expressions that a macro such as
300
+ // EXPECT_DEATH would accept.
301
+ // terminator - Must be an empty statement for EXPECT_DEATH_IF_SUPPORTED
302
+ // and a return statement for ASSERT_DEATH_IF_SUPPORTED.
303
+ // This ensures that ASSERT_DEATH_IF_SUPPORTED will not
304
+ // compile inside functions where ASSERT_DEATH doesn't
305
+ // compile.
306
+ //
307
+ // The branch that has an always false condition is used to ensure that
308
+ // statement and regex are compiled (and thus syntactically correct) but
309
+ // never executed. The unreachable code macro protects the terminator
310
+ // statement from generating an 'unreachable code' warning in case
311
+ // statement unconditionally returns or throws. The Message constructor at
312
+ // the end allows the syntax of streaming additional messages into the
313
+ // macro, for compilational compatibility with EXPECT_DEATH/ASSERT_DEATH.
314
+ # define GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, terminator) \
315
+ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
316
+ if (::testing::internal::AlwaysTrue()) { \
317
+ GTEST_LOG_(WARNING) \
318
+ << "Death tests are not supported on this platform.\n" \
319
+ << "Statement '" #statement "' cannot be verified."; \
320
+ } else if (::testing::internal::AlwaysFalse()) { \
321
+ ::testing::internal::RE::PartialMatch(".*", (regex)); \
322
+ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
323
+ terminator; \
324
+ } else \
325
+ ::testing::Message()
326
+
327
+ // EXPECT_DEATH_IF_SUPPORTED(statement, regex) and
328
+ // ASSERT_DEATH_IF_SUPPORTED(statement, regex) expand to real death tests if
329
+ // death tests are supported; otherwise they just issue a warning. This is
330
+ // useful when you are combining death test assertions with normal test
331
+ // assertions in one test.
332
+ #if GTEST_HAS_DEATH_TEST
333
+ # define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
334
+ EXPECT_DEATH(statement, regex)
335
+ # define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
336
+ ASSERT_DEATH(statement, regex)
337
+ #else
338
+ # define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
339
+ GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, )
340
+ # define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
341
+ GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, return)
342
+ #endif
343
+
344
+ } // namespace testing
345
+
346
+ #endif // GOOGLETEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
data/miniconda3/include/gtest/gtest-matchers.h ADDED
@@ -0,0 +1,930 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright 2007, Google Inc.
2
+ // All rights reserved.
3
+ //
4
+ // Redistribution and use in source and binary forms, with or without
5
+ // modification, are permitted provided that the following conditions are
6
+ // met:
7
+ //
8
+ // * Redistributions of source code must retain the above copyright
9
+ // notice, this list of conditions and the following disclaimer.
10
+ // * Redistributions in binary form must reproduce the above
11
+ // copyright notice, this list of conditions and the following disclaimer
12
+ // in the documentation and/or other materials provided with the
13
+ // distribution.
14
+ // * Neither the name of Google Inc. nor the names of its
15
+ // contributors may be used to endorse or promote products derived from
16
+ // this software without specific prior written permission.
17
+ //
18
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+
30
+ // The Google C++ Testing and Mocking Framework (Google Test)
31
+ //
32
+ // This file implements just enough of the matcher interface to allow
33
+ // EXPECT_DEATH and friends to accept a matcher argument.
34
+
35
+ #ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_MATCHERS_H_
36
+ #define GOOGLETEST_INCLUDE_GTEST_GTEST_MATCHERS_H_
37
+
38
+ #include <atomic>
39
+ #include <memory>
40
+ #include <ostream>
41
+ #include <string>
42
+ #include <type_traits>
43
+
44
+ #include "gtest/gtest-printers.h"
45
+ #include "gtest/internal/gtest-internal.h"
46
+ #include "gtest/internal/gtest-port.h"
47
+
48
+ // MSVC warning C5046 is new as of VS2017 version 15.8.
49
+ #if defined(_MSC_VER) && _MSC_VER >= 1915
50
+ #define GTEST_MAYBE_5046_ 5046
51
+ #else
52
+ #define GTEST_MAYBE_5046_
53
+ #endif
54
+
55
+ GTEST_DISABLE_MSC_WARNINGS_PUSH_(
56
+ 4251 GTEST_MAYBE_5046_ /* class A needs to have dll-interface to be used by
57
+ clients of class B */
58
+ /* Symbol involving type with internal linkage not defined */)
59
+
60
+ namespace testing {
61
+
62
+ // To implement a matcher Foo for type T, define:
63
+ // 1. a class FooMatcherMatcher that implements the matcher interface:
64
+ // using is_gtest_matcher = void;
65
+ // bool MatchAndExplain(const T&, std::ostream*);
66
+ // (MatchResultListener* can also be used instead of std::ostream*)
67
+ // void DescribeTo(std::ostream*);
68
+ // void DescribeNegationTo(std::ostream*);
69
+ //
70
+ // 2. a factory function that creates a Matcher<T> object from a
71
+ // FooMatcherMatcher.
72
+
73
+ class MatchResultListener {
74
+ public:
75
+ // Creates a listener object with the given underlying ostream. The
76
+ // listener does not own the ostream, and does not dereference it
77
+ // in the constructor or destructor.
78
+ explicit MatchResultListener(::std::ostream* os) : stream_(os) {}
79
+ virtual ~MatchResultListener() = 0; // Makes this class abstract.
80
+
81
+ // Streams x to the underlying ostream; does nothing if the ostream
82
+ // is NULL.
83
+ template <typename T>
84
+ MatchResultListener& operator<<(const T& x) {
85
+ if (stream_ != nullptr) *stream_ << x;
86
+ return *this;
87
+ }
88
+
89
+ // Returns the underlying ostream.
90
+ ::std::ostream* stream() { return stream_; }
91
+
92
+ // Returns true if and only if the listener is interested in an explanation
93
+ // of the match result. A matcher's MatchAndExplain() method can use
94
+ // this information to avoid generating the explanation when no one
95
+ // intends to hear it.
96
+ bool IsInterested() const { return stream_ != nullptr; }
97
+
98
+ private:
99
+ ::std::ostream* const stream_;
100
+
101
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(MatchResultListener);
102
+ };
103
+
104
+ inline MatchResultListener::~MatchResultListener() {
105
+ }
106
+
107
+ // An instance of a subclass of this knows how to describe itself as a
108
+ // matcher.
109
+ class GTEST_API_ MatcherDescriberInterface {
110
+ public:
111
+ virtual ~MatcherDescriberInterface() {}
112
+
113
+ // Describes this matcher to an ostream. The function should print
114
+ // a verb phrase that describes the property a value matching this
115
+ // matcher should have. The subject of the verb phrase is the value
116
+ // being matched. For example, the DescribeTo() method of the Gt(7)
117
+ // matcher prints "is greater than 7".
118
+ virtual void DescribeTo(::std::ostream* os) const = 0;
119
+
120
+ // Describes the negation of this matcher to an ostream. For
121
+ // example, if the description of this matcher is "is greater than
122
+ // 7", the negated description could be "is not greater than 7".
123
+ // You are not required to override this when implementing
124
+ // MatcherInterface, but it is highly advised so that your matcher
125
+ // can produce good error messages.
126
+ virtual void DescribeNegationTo(::std::ostream* os) const {
127
+ *os << "not (";
128
+ DescribeTo(os);
129
+ *os << ")";
130
+ }
131
+ };
132
+
133
+ // The implementation of a matcher.
134
+ template <typename T>
135
+ class MatcherInterface : public MatcherDescriberInterface {
136
+ public:
137
+ // Returns true if and only if the matcher matches x; also explains the
138
+ // match result to 'listener' if necessary (see the next paragraph), in
139
+ // the form of a non-restrictive relative clause ("which ...",
140
+ // "whose ...", etc) that describes x. For example, the
141
+ // MatchAndExplain() method of the Pointee(...) matcher should
142
+ // generate an explanation like "which points to ...".
143
+ //
144
+ // Implementations of MatchAndExplain() should add an explanation of
145
+ // the match result *if and only if* they can provide additional
146
+ // information that's not already present (or not obvious) in the
147
+ // print-out of x and the matcher's description. Whether the match
148
+ // succeeds is not a factor in deciding whether an explanation is
149
+ // needed, as sometimes the caller needs to print a failure message
150
+ // when the match succeeds (e.g. when the matcher is used inside
151
+ // Not()).
152
+ //
153
+ // For example, a "has at least 10 elements" matcher should explain
154
+ // what the actual element count is, regardless of the match result,
155
+ // as it is useful information to the reader; on the other hand, an
156
+ // "is empty" matcher probably only needs to explain what the actual
157
+ // size is when the match fails, as it's redundant to say that the
158
+ // size is 0 when the value is already known to be empty.
159
+ //
160
+ // You should override this method when defining a new matcher.
161
+ //
162
+ // It's the responsibility of the caller (Google Test) to guarantee
163
+ // that 'listener' is not NULL. This helps to simplify a matcher's
164
+ // implementation when it doesn't care about the performance, as it
165
+ // can talk to 'listener' without checking its validity first.
166
+ // However, in order to implement dummy listeners efficiently,
167
+ // listener->stream() may be NULL.
168
+ virtual bool MatchAndExplain(T x, MatchResultListener* listener) const = 0;
169
+
170
+ // Inherits these methods from MatcherDescriberInterface:
171
+ // virtual void DescribeTo(::std::ostream* os) const = 0;
172
+ // virtual void DescribeNegationTo(::std::ostream* os) const;
173
+ };
174
+
175
+ namespace internal {
176
+
177
+ struct AnyEq {
178
+ template <typename A, typename B>
179
+ bool operator()(const A& a, const B& b) const { return a == b; }
180
+ };
181
+ struct AnyNe {
182
+ template <typename A, typename B>
183
+ bool operator()(const A& a, const B& b) const { return a != b; }
184
+ };
185
+ struct AnyLt {
186
+ template <typename A, typename B>
187
+ bool operator()(const A& a, const B& b) const { return a < b; }
188
+ };
189
+ struct AnyGt {
190
+ template <typename A, typename B>
191
+ bool operator()(const A& a, const B& b) const { return a > b; }
192
+ };
193
+ struct AnyLe {
194
+ template <typename A, typename B>
195
+ bool operator()(const A& a, const B& b) const { return a <= b; }
196
+ };
197
+ struct AnyGe {
198
+ template <typename A, typename B>
199
+ bool operator()(const A& a, const B& b) const { return a >= b; }
200
+ };
201
+
202
+ // A match result listener that ignores the explanation.
203
+ class DummyMatchResultListener : public MatchResultListener {
204
+ public:
205
+ DummyMatchResultListener() : MatchResultListener(nullptr) {}
206
+
207
+ private:
208
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(DummyMatchResultListener);
209
+ };
210
+
211
+ // A match result listener that forwards the explanation to a given
212
+ // ostream. The difference between this and MatchResultListener is
213
+ // that the former is concrete.
214
+ class StreamMatchResultListener : public MatchResultListener {
215
+ public:
216
+ explicit StreamMatchResultListener(::std::ostream* os)
217
+ : MatchResultListener(os) {}
218
+
219
+ private:
220
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(StreamMatchResultListener);
221
+ };
222
+
223
+ struct SharedPayloadBase {
224
+ std::atomic<int> ref{1};
225
+ void Ref() { ref.fetch_add(1, std::memory_order_relaxed); }
226
+ bool Unref() { return ref.fetch_sub(1, std::memory_order_acq_rel) == 1; }
227
+ };
228
+
229
+ template <typename T>
230
+ struct SharedPayload : SharedPayloadBase {
231
+ explicit SharedPayload(const T& v) : value(v) {}
232
+ explicit SharedPayload(T&& v) : value(std::move(v)) {}
233
+
234
+ static void Destroy(SharedPayloadBase* shared) {
235
+ delete static_cast<SharedPayload*>(shared);
236
+ }
237
+
238
+ T value;
239
+ };
240
+
241
+ // An internal class for implementing Matcher<T>, which will derive
242
+ // from it. We put functionalities common to all Matcher<T>
243
+ // specializations here to avoid code duplication.
244
+ template <typename T>
245
+ class MatcherBase : private MatcherDescriberInterface {
246
+ public:
247
+ // Returns true if and only if the matcher matches x; also explains the
248
+ // match result to 'listener'.
249
+ bool MatchAndExplain(const T& x, MatchResultListener* listener) const {
250
+ GTEST_CHECK_(vtable_ != nullptr);
251
+ return vtable_->match_and_explain(*this, x, listener);
252
+ }
253
+
254
+ // Returns true if and only if this matcher matches x.
255
+ bool Matches(const T& x) const {
256
+ DummyMatchResultListener dummy;
257
+ return MatchAndExplain(x, &dummy);
258
+ }
259
+
260
+ // Describes this matcher to an ostream.
261
+ void DescribeTo(::std::ostream* os) const final {
262
+ GTEST_CHECK_(vtable_ != nullptr);
263
+ vtable_->describe(*this, os, false);
264
+ }
265
+
266
+ // Describes the negation of this matcher to an ostream.
267
+ void DescribeNegationTo(::std::ostream* os) const final {
268
+ GTEST_CHECK_(vtable_ != nullptr);
269
+ vtable_->describe(*this, os, true);
270
+ }
271
+
272
+ // Explains why x matches, or doesn't match, the matcher.
273
+ void ExplainMatchResultTo(const T& x, ::std::ostream* os) const {
274
+ StreamMatchResultListener listener(os);
275
+ MatchAndExplain(x, &listener);
276
+ }
277
+
278
+ // Returns the describer for this matcher object; retains ownership
279
+ // of the describer, which is only guaranteed to be alive when
280
+ // this matcher object is alive.
281
+ const MatcherDescriberInterface* GetDescriber() const {
282
+ if (vtable_ == nullptr) return nullptr;
283
+ return vtable_->get_describer(*this);
284
+ }
285
+
286
+ protected:
287
+ MatcherBase() : vtable_(nullptr) {}
288
+
289
+ // Constructs a matcher from its implementation.
290
+ template <typename U>
291
+ explicit MatcherBase(const MatcherInterface<U>* impl) {
292
+ Init(impl);
293
+ }
294
+
295
+ template <typename M, typename = typename std::remove_reference<
296
+ M>::type::is_gtest_matcher>
297
+ MatcherBase(M&& m) { // NOLINT
298
+ Init(std::forward<M>(m));
299
+ }
300
+
301
+ MatcherBase(const MatcherBase& other)
302
+ : vtable_(other.vtable_), buffer_(other.buffer_) {
303
+ if (IsShared()) buffer_.shared->Ref();
304
+ }
305
+
306
+ MatcherBase& operator=(const MatcherBase& other) {
307
+ if (this == &other) return *this;
308
+ Destroy();
309
+ vtable_ = other.vtable_;
310
+ buffer_ = other.buffer_;
311
+ if (IsShared()) buffer_.shared->Ref();
312
+ return *this;
313
+ }
314
+
315
+ MatcherBase(MatcherBase&& other)
316
+ : vtable_(other.vtable_), buffer_(other.buffer_) {
317
+ other.vtable_ = nullptr;
318
+ }
319
+
320
+ MatcherBase& operator=(MatcherBase&& other) {
321
+ if (this == &other) return *this;
322
+ Destroy();
323
+ vtable_ = other.vtable_;
324
+ buffer_ = other.buffer_;
325
+ other.vtable_ = nullptr;
326
+ return *this;
327
+ }
328
+
329
+ ~MatcherBase() override { Destroy(); }
330
+
331
+ private:
332
+ struct VTable {
333
+ bool (*match_and_explain)(const MatcherBase&, const T&,
334
+ MatchResultListener*);
335
+ void (*describe)(const MatcherBase&, std::ostream*, bool negation);
336
+ // Returns the captured object if it implements the interface, otherwise
337
+ // returns the MatcherBase itself.
338
+ const MatcherDescriberInterface* (*get_describer)(const MatcherBase&);
339
+ // Called on shared instances when the reference count reaches 0.
340
+ void (*shared_destroy)(SharedPayloadBase*);
341
+ };
342
+
343
+ bool IsShared() const {
344
+ return vtable_ != nullptr && vtable_->shared_destroy != nullptr;
345
+ }
346
+
347
+ // If the implementation uses a listener, call that.
348
+ template <typename P>
349
+ static auto MatchAndExplainImpl(const MatcherBase& m, const T& value,
350
+ MatchResultListener* listener)
351
+ -> decltype(P::Get(m).MatchAndExplain(value, listener->stream())) {
352
+ return P::Get(m).MatchAndExplain(value, listener->stream());
353
+ }
354
+
355
+ template <typename P>
356
+ static auto MatchAndExplainImpl(const MatcherBase& m, const T& value,
357
+ MatchResultListener* listener)
358
+ -> decltype(P::Get(m).MatchAndExplain(value, listener)) {
359
+ return P::Get(m).MatchAndExplain(value, listener);
360
+ }
361
+
362
+ template <typename P>
363
+ static void DescribeImpl(const MatcherBase& m, std::ostream* os,
364
+ bool negation) {
365
+ if (negation) {
366
+ P::Get(m).DescribeNegationTo(os);
367
+ } else {
368
+ P::Get(m).DescribeTo(os);
369
+ }
370
+ }
371
+
372
+ template <typename P>
373
+ static const MatcherDescriberInterface* GetDescriberImpl(
374
+ const MatcherBase& m) {
375
+ // If the impl is a MatcherDescriberInterface, then return it.
376
+ // Otherwise use MatcherBase itself.
377
+ // This allows us to implement the GetDescriber() function without support
378
+ // from the impl, but some users really want to get their impl back when
379
+ // they call GetDescriber().
380
+ // We use std::get on a tuple as a workaround of not having `if constexpr`.
381
+ return std::get<(
382
+ std::is_convertible<decltype(&P::Get(m)),
383
+ const MatcherDescriberInterface*>::value
384
+ ? 1
385
+ : 0)>(std::make_tuple(&m, &P::Get(m)));
386
+ }
387
+
388
+ template <typename P>
389
+ const VTable* GetVTable() {
390
+ static constexpr VTable kVTable = {&MatchAndExplainImpl<P>,
391
+ &DescribeImpl<P>, &GetDescriberImpl<P>,
392
+ P::shared_destroy};
393
+ return &kVTable;
394
+ }
395
+
396
+ union Buffer {
397
+ // Add some types to give Buffer some common alignment/size use cases.
398
+ void* ptr;
399
+ double d;
400
+ int64_t i;
401
+ // And add one for the out-of-line cases.
402
+ SharedPayloadBase* shared;
403
+ };
404
+
405
+ void Destroy() {
406
+ if (IsShared() && buffer_.shared->Unref()) {
407
+ vtable_->shared_destroy(buffer_.shared);
408
+ }
409
+ }
410
+
411
+ template <typename M>
412
+ static constexpr bool IsInlined() {
413
+ return sizeof(M) <= sizeof(Buffer) && alignof(M) <= alignof(Buffer) &&
414
+ std::is_trivially_copy_constructible<M>::value &&
415
+ std::is_trivially_destructible<M>::value;
416
+ }
417
+
418
+ template <typename M, bool = MatcherBase::IsInlined<M>()>
419
+ struct ValuePolicy {
420
+ static const M& Get(const MatcherBase& m) {
421
+ // When inlined along with Init, need to be explicit to avoid violating
422
+ // strict aliasing rules.
423
+ const M *ptr = static_cast<const M*>(
424
+ static_cast<const void*>(&m.buffer_));
425
+ return *ptr;
426
+ }
427
+ static void Init(MatcherBase& m, M impl) {
428
+ ::new (static_cast<void*>(&m.buffer_)) M(impl);
429
+ }
430
+ static constexpr auto shared_destroy = nullptr;
431
+ };
432
+
433
+ template <typename M>
434
+ struct ValuePolicy<M, false> {
435
+ using Shared = SharedPayload<M>;
436
+ static const M& Get(const MatcherBase& m) {
437
+ return static_cast<Shared*>(m.buffer_.shared)->value;
438
+ }
439
+ template <typename Arg>
440
+ static void Init(MatcherBase& m, Arg&& arg) {
441
+ m.buffer_.shared = new Shared(std::forward<Arg>(arg));
442
+ }
443
+ static constexpr auto shared_destroy = &Shared::Destroy;
444
+ };
445
+
446
+ template <typename U, bool B>
447
+ struct ValuePolicy<const MatcherInterface<U>*, B> {
448
+ using M = const MatcherInterface<U>;
449
+ using Shared = SharedPayload<std::unique_ptr<M>>;
450
+ static const M& Get(const MatcherBase& m) {
451
+ return *static_cast<Shared*>(m.buffer_.shared)->value;
452
+ }
453
+ static void Init(MatcherBase& m, M* impl) {
454
+ m.buffer_.shared = new Shared(std::unique_ptr<M>(impl));
455
+ }
456
+
457
+ static constexpr auto shared_destroy = &Shared::Destroy;
458
+ };
459
+
460
+ template <typename M>
461
+ void Init(M&& m) {
462
+ using MM = typename std::decay<M>::type;
463
+ using Policy = ValuePolicy<MM>;
464
+ vtable_ = GetVTable<Policy>();
465
+ Policy::Init(*this, std::forward<M>(m));
466
+ }
467
+
468
+ const VTable* vtable_;
469
+ Buffer buffer_;
470
+ };
471
+
472
+ } // namespace internal
473
+
474
+ // A Matcher<T> is a copyable and IMMUTABLE (except by assignment)
475
+ // object that can check whether a value of type T matches. The
476
+ // implementation of Matcher<T> is just a std::shared_ptr to const
477
+ // MatcherInterface<T>. Don't inherit from Matcher!
478
+ template <typename T>
479
+ class Matcher : public internal::MatcherBase<T> {
480
+ public:
481
+ // Constructs a null matcher. Needed for storing Matcher objects in STL
482
+ // containers. A default-constructed matcher is not yet initialized. You
483
+ // cannot use it until a valid value has been assigned to it.
484
+ explicit Matcher() {} // NOLINT
485
+
486
+ // Constructs a matcher from its implementation.
487
+ explicit Matcher(const MatcherInterface<const T&>* impl)
488
+ : internal::MatcherBase<T>(impl) {}
489
+
490
+ template <typename U>
491
+ explicit Matcher(
492
+ const MatcherInterface<U>* impl,
493
+ typename std::enable_if<!std::is_same<U, const U&>::value>::type* =
494
+ nullptr)
495
+ : internal::MatcherBase<T>(impl) {}
496
+
497
+ template <typename M, typename = typename std::remove_reference<
498
+ M>::type::is_gtest_matcher>
499
+ Matcher(M&& m) : internal::MatcherBase<T>(std::forward<M>(m)) {} // NOLINT
500
+
501
+ // Implicit constructor here allows people to write
502
+ // EXPECT_CALL(foo, Bar(5)) instead of EXPECT_CALL(foo, Bar(Eq(5))) sometimes
503
+ Matcher(T value); // NOLINT
504
+ };
505
+
506
+ // The following two specializations allow the user to write str
507
+ // instead of Eq(str) and "foo" instead of Eq("foo") when a std::string
508
+ // matcher is expected.
509
+ template <>
510
+ class GTEST_API_ Matcher<const std::string&>
511
+ : public internal::MatcherBase<const std::string&> {
512
+ public:
513
+ Matcher() {}
514
+
515
+ explicit Matcher(const MatcherInterface<const std::string&>* impl)
516
+ : internal::MatcherBase<const std::string&>(impl) {}
517
+
518
+ template <typename M, typename = typename std::remove_reference<
519
+ M>::type::is_gtest_matcher>
520
+ Matcher(M&& m) // NOLINT
521
+ : internal::MatcherBase<const std::string&>(std::forward<M>(m)) {}
522
+
523
+ // Allows the user to write str instead of Eq(str) sometimes, where
524
+ // str is a std::string object.
525
+ Matcher(const std::string& s); // NOLINT
526
+
527
+ // Allows the user to write "foo" instead of Eq("foo") sometimes.
528
+ Matcher(const char* s); // NOLINT
529
+ };
530
+
531
+ template <>
532
+ class GTEST_API_ Matcher<std::string>
533
+ : public internal::MatcherBase<std::string> {
534
+ public:
535
+ Matcher() {}
536
+
537
+ explicit Matcher(const MatcherInterface<const std::string&>* impl)
538
+ : internal::MatcherBase<std::string>(impl) {}
539
+ explicit Matcher(const MatcherInterface<std::string>* impl)
540
+ : internal::MatcherBase<std::string>(impl) {}
541
+
542
+ template <typename M, typename = typename std::remove_reference<
543
+ M>::type::is_gtest_matcher>
544
+ Matcher(M&& m) // NOLINT
545
+ : internal::MatcherBase<std::string>(std::forward<M>(m)) {}
546
+
547
+ // Allows the user to write str instead of Eq(str) sometimes, where
548
+ // str is a string object.
549
+ Matcher(const std::string& s); // NOLINT
550
+
551
+ // Allows the user to write "foo" instead of Eq("foo") sometimes.
552
+ Matcher(const char* s); // NOLINT
553
+ };
554
+
555
+ #if GTEST_INTERNAL_HAS_STRING_VIEW
556
+ // The following two specializations allow the user to write str
557
+ // instead of Eq(str) and "foo" instead of Eq("foo") when a absl::string_view
558
+ // matcher is expected.
559
+ template <>
560
+ class GTEST_API_ Matcher<const internal::StringView&>
561
+ : public internal::MatcherBase<const internal::StringView&> {
562
+ public:
563
+ Matcher() {}
564
+
565
+ explicit Matcher(const MatcherInterface<const internal::StringView&>* impl)
566
+ : internal::MatcherBase<const internal::StringView&>(impl) {}
567
+
568
+ template <typename M, typename = typename std::remove_reference<
569
+ M>::type::is_gtest_matcher>
570
+ Matcher(M&& m) // NOLINT
571
+ : internal::MatcherBase<const internal::StringView&>(std::forward<M>(m)) {
572
+ }
573
+
574
+ // Allows the user to write str instead of Eq(str) sometimes, where
575
+ // str is a std::string object.
576
+ Matcher(const std::string& s); // NOLINT
577
+
578
+ // Allows the user to write "foo" instead of Eq("foo") sometimes.
579
+ Matcher(const char* s); // NOLINT
580
+
581
+ // Allows the user to pass absl::string_views or std::string_views directly.
582
+ Matcher(internal::StringView s); // NOLINT
583
+ };
584
+
585
+ template <>
586
+ class GTEST_API_ Matcher<internal::StringView>
587
+ : public internal::MatcherBase<internal::StringView> {
588
+ public:
589
+ Matcher() {}
590
+
591
+ explicit Matcher(const MatcherInterface<const internal::StringView&>* impl)
592
+ : internal::MatcherBase<internal::StringView>(impl) {}
593
+ explicit Matcher(const MatcherInterface<internal::StringView>* impl)
594
+ : internal::MatcherBase<internal::StringView>(impl) {}
595
+
596
+ template <typename M, typename = typename std::remove_reference<
597
+ M>::type::is_gtest_matcher>
598
+ Matcher(M&& m) // NOLINT
599
+ : internal::MatcherBase<internal::StringView>(std::forward<M>(m)) {}
600
+
601
+ // Allows the user to write str instead of Eq(str) sometimes, where
602
+ // str is a std::string object.
603
+ Matcher(const std::string& s); // NOLINT
604
+
605
+ // Allows the user to write "foo" instead of Eq("foo") sometimes.
606
+ Matcher(const char* s); // NOLINT
607
+
608
+ // Allows the user to pass absl::string_views or std::string_views directly.
609
+ Matcher(internal::StringView s); // NOLINT
610
+ };
611
+ #endif // GTEST_INTERNAL_HAS_STRING_VIEW
612
+
613
+ // Prints a matcher in a human-readable format.
614
+ template <typename T>
615
+ std::ostream& operator<<(std::ostream& os, const Matcher<T>& matcher) {
616
+ matcher.DescribeTo(&os);
617
+ return os;
618
+ }
619
+
620
+ // The PolymorphicMatcher class template makes it easy to implement a
621
+ // polymorphic matcher (i.e. a matcher that can match values of more
622
+ // than one type, e.g. Eq(n) and NotNull()).
623
+ //
624
+ // To define a polymorphic matcher, a user should provide an Impl
625
+ // class that has a DescribeTo() method and a DescribeNegationTo()
626
+ // method, and define a member function (or member function template)
627
+ //
628
+ // bool MatchAndExplain(const Value& value,
629
+ // MatchResultListener* listener) const;
630
+ //
631
+ // See the definition of NotNull() for a complete example.
632
+ template <class Impl>
633
+ class PolymorphicMatcher {
634
+ public:
635
+ explicit PolymorphicMatcher(const Impl& an_impl) : impl_(an_impl) {}
636
+
637
+ // Returns a mutable reference to the underlying matcher
638
+ // implementation object.
639
+ Impl& mutable_impl() { return impl_; }
640
+
641
+ // Returns an immutable reference to the underlying matcher
642
+ // implementation object.
643
+ const Impl& impl() const { return impl_; }
644
+
645
+ template <typename T>
646
+ operator Matcher<T>() const {
647
+ return Matcher<T>(new MonomorphicImpl<const T&>(impl_));
648
+ }
649
+
650
+ private:
651
+ template <typename T>
652
+ class MonomorphicImpl : public MatcherInterface<T> {
653
+ public:
654
+ explicit MonomorphicImpl(const Impl& impl) : impl_(impl) {}
655
+
656
+ void DescribeTo(::std::ostream* os) const override { impl_.DescribeTo(os); }
657
+
658
+ void DescribeNegationTo(::std::ostream* os) const override {
659
+ impl_.DescribeNegationTo(os);
660
+ }
661
+
662
+ bool MatchAndExplain(T x, MatchResultListener* listener) const override {
663
+ return impl_.MatchAndExplain(x, listener);
664
+ }
665
+
666
+ private:
667
+ const Impl impl_;
668
+ };
669
+
670
+ Impl impl_;
671
+ };
672
+
673
+ // Creates a matcher from its implementation.
674
+ // DEPRECATED: Especially in the generic code, prefer:
675
+ // Matcher<T>(new MyMatcherImpl<const T&>(...));
676
+ //
677
+ // MakeMatcher may create a Matcher that accepts its argument by value, which
678
+ // leads to unnecessary copies & lack of support for non-copyable types.
679
+ template <typename T>
680
+ inline Matcher<T> MakeMatcher(const MatcherInterface<T>* impl) {
681
+ return Matcher<T>(impl);
682
+ }
683
+
684
+ // Creates a polymorphic matcher from its implementation. This is
685
+ // easier to use than the PolymorphicMatcher<Impl> constructor as it
686
+ // doesn't require you to explicitly write the template argument, e.g.
687
+ //
688
+ // MakePolymorphicMatcher(foo);
689
+ // vs
690
+ // PolymorphicMatcher<TypeOfFoo>(foo);
691
+ template <class Impl>
692
+ inline PolymorphicMatcher<Impl> MakePolymorphicMatcher(const Impl& impl) {
693
+ return PolymorphicMatcher<Impl>(impl);
694
+ }
695
+
696
+ namespace internal {
697
+ // Implements a matcher that compares a given value with a
698
+ // pre-supplied value using one of the ==, <=, <, etc, operators. The
699
+ // two values being compared don't have to have the same type.
700
+ //
701
+ // The matcher defined here is polymorphic (for example, Eq(5) can be
702
+ // used to match an int, a short, a double, etc). Therefore we use
703
+ // a template type conversion operator in the implementation.
704
+ //
705
+ // The following template definition assumes that the Rhs parameter is
706
+ // a "bare" type (i.e. neither 'const T' nor 'T&').
707
+ template <typename D, typename Rhs, typename Op>
708
+ class ComparisonBase {
709
+ public:
710
+ explicit ComparisonBase(const Rhs& rhs) : rhs_(rhs) {}
711
+
712
+ using is_gtest_matcher = void;
713
+
714
+ template <typename Lhs>
715
+ bool MatchAndExplain(const Lhs& lhs, std::ostream*) const {
716
+ return Op()(lhs, Unwrap(rhs_));
717
+ }
718
+ void DescribeTo(std::ostream* os) const {
719
+ *os << D::Desc() << " ";
720
+ UniversalPrint(Unwrap(rhs_), os);
721
+ }
722
+ void DescribeNegationTo(std::ostream* os) const {
723
+ *os << D::NegatedDesc() << " ";
724
+ UniversalPrint(Unwrap(rhs_), os);
725
+ }
726
+
727
+ private:
728
+ template <typename T>
729
+ static const T& Unwrap(const T& v) {
730
+ return v;
731
+ }
732
+ template <typename T>
733
+ static const T& Unwrap(std::reference_wrapper<T> v) {
734
+ return v;
735
+ }
736
+
737
+ Rhs rhs_;
738
+ };
739
+
740
+ template <typename Rhs>
741
+ class EqMatcher : public ComparisonBase<EqMatcher<Rhs>, Rhs, AnyEq> {
742
+ public:
743
+ explicit EqMatcher(const Rhs& rhs)
744
+ : ComparisonBase<EqMatcher<Rhs>, Rhs, AnyEq>(rhs) { }
745
+ static const char* Desc() { return "is equal to"; }
746
+ static const char* NegatedDesc() { return "isn't equal to"; }
747
+ };
748
+ template <typename Rhs>
749
+ class NeMatcher : public ComparisonBase<NeMatcher<Rhs>, Rhs, AnyNe> {
750
+ public:
751
+ explicit NeMatcher(const Rhs& rhs)
752
+ : ComparisonBase<NeMatcher<Rhs>, Rhs, AnyNe>(rhs) { }
753
+ static const char* Desc() { return "isn't equal to"; }
754
+ static const char* NegatedDesc() { return "is equal to"; }
755
+ };
756
+ template <typename Rhs>
757
+ class LtMatcher : public ComparisonBase<LtMatcher<Rhs>, Rhs, AnyLt> {
758
+ public:
759
+ explicit LtMatcher(const Rhs& rhs)
760
+ : ComparisonBase<LtMatcher<Rhs>, Rhs, AnyLt>(rhs) { }
761
+ static const char* Desc() { return "is <"; }
762
+ static const char* NegatedDesc() { return "isn't <"; }
763
+ };
764
+ template <typename Rhs>
765
+ class GtMatcher : public ComparisonBase<GtMatcher<Rhs>, Rhs, AnyGt> {
766
+ public:
767
+ explicit GtMatcher(const Rhs& rhs)
768
+ : ComparisonBase<GtMatcher<Rhs>, Rhs, AnyGt>(rhs) { }
769
+ static const char* Desc() { return "is >"; }
770
+ static const char* NegatedDesc() { return "isn't >"; }
771
+ };
772
+ template <typename Rhs>
773
+ class LeMatcher : public ComparisonBase<LeMatcher<Rhs>, Rhs, AnyLe> {
774
+ public:
775
+ explicit LeMatcher(const Rhs& rhs)
776
+ : ComparisonBase<LeMatcher<Rhs>, Rhs, AnyLe>(rhs) { }
777
+ static const char* Desc() { return "is <="; }
778
+ static const char* NegatedDesc() { return "isn't <="; }
779
+ };
780
+ template <typename Rhs>
781
+ class GeMatcher : public ComparisonBase<GeMatcher<Rhs>, Rhs, AnyGe> {
782
+ public:
783
+ explicit GeMatcher(const Rhs& rhs)
784
+ : ComparisonBase<GeMatcher<Rhs>, Rhs, AnyGe>(rhs) { }
785
+ static const char* Desc() { return "is >="; }
786
+ static const char* NegatedDesc() { return "isn't >="; }
787
+ };
788
+
789
+ template <typename T, typename = typename std::enable_if<
790
+ std::is_constructible<std::string, T>::value>::type>
791
+ using StringLike = T;
792
+
793
+ // Implements polymorphic matchers MatchesRegex(regex) and
794
+ // ContainsRegex(regex), which can be used as a Matcher<T> as long as
795
+ // T can be converted to a string.
796
+ class MatchesRegexMatcher {
797
+ public:
798
+ MatchesRegexMatcher(const RE* regex, bool full_match)
799
+ : regex_(regex), full_match_(full_match) {}
800
+
801
+ #if GTEST_INTERNAL_HAS_STRING_VIEW
802
+ bool MatchAndExplain(const internal::StringView& s,
803
+ MatchResultListener* listener) const {
804
+ return MatchAndExplain(std::string(s), listener);
805
+ }
806
+ #endif // GTEST_INTERNAL_HAS_STRING_VIEW
807
+
808
+ // Accepts pointer types, particularly:
809
+ // const char*
810
+ // char*
811
+ // const wchar_t*
812
+ // wchar_t*
813
+ template <typename CharType>
814
+ bool MatchAndExplain(CharType* s, MatchResultListener* listener) const {
815
+ return s != nullptr && MatchAndExplain(std::string(s), listener);
816
+ }
817
+
818
+ // Matches anything that can convert to std::string.
819
+ //
820
+ // This is a template, not just a plain function with const std::string&,
821
+ // because absl::string_view has some interfering non-explicit constructors.
822
+ template <class MatcheeStringType>
823
+ bool MatchAndExplain(const MatcheeStringType& s,
824
+ MatchResultListener* /* listener */) const {
825
+ const std::string& s2(s);
826
+ return full_match_ ? RE::FullMatch(s2, *regex_)
827
+ : RE::PartialMatch(s2, *regex_);
828
+ }
829
+
830
+ void DescribeTo(::std::ostream* os) const {
831
+ *os << (full_match_ ? "matches" : "contains") << " regular expression ";
832
+ UniversalPrinter<std::string>::Print(regex_->pattern(), os);
833
+ }
834
+
835
+ void DescribeNegationTo(::std::ostream* os) const {
836
+ *os << "doesn't " << (full_match_ ? "match" : "contain")
837
+ << " regular expression ";
838
+ UniversalPrinter<std::string>::Print(regex_->pattern(), os);
839
+ }
840
+
841
+ private:
842
+ const std::shared_ptr<const RE> regex_;
843
+ const bool full_match_;
844
+ };
845
+ } // namespace internal
846
+
847
+ // Matches a string that fully matches regular expression 'regex'.
848
+ // The matcher takes ownership of 'regex'.
849
+ inline PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
850
+ const internal::RE* regex) {
851
+ return MakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, true));
852
+ }
853
+ template <typename T = std::string>
854
+ PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
855
+ const internal::StringLike<T>& regex) {
856
+ return MatchesRegex(new internal::RE(std::string(regex)));
857
+ }
858
+
859
+ // Matches a string that contains regular expression 'regex'.
860
+ // The matcher takes ownership of 'regex'.
861
+ inline PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
862
+ const internal::RE* regex) {
863
+ return MakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, false));
864
+ }
865
+ template <typename T = std::string>
866
+ PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
867
+ const internal::StringLike<T>& regex) {
868
+ return ContainsRegex(new internal::RE(std::string(regex)));
869
+ }
870
+
871
+ // Creates a polymorphic matcher that matches anything equal to x.
872
+ // Note: if the parameter of Eq() were declared as const T&, Eq("foo")
873
+ // wouldn't compile.
874
+ template <typename T>
875
+ inline internal::EqMatcher<T> Eq(T x) { return internal::EqMatcher<T>(x); }
876
+
877
+ // Constructs a Matcher<T> from a 'value' of type T. The constructed
878
+ // matcher matches any value that's equal to 'value'.
879
+ template <typename T>
880
+ Matcher<T>::Matcher(T value) { *this = Eq(value); }
881
+
882
+ // Creates a monomorphic matcher that matches anything with type Lhs
883
+ // and equal to rhs. A user may need to use this instead of Eq(...)
884
+ // in order to resolve an overloading ambiguity.
885
+ //
886
+ // TypedEq<T>(x) is just a convenient short-hand for Matcher<T>(Eq(x))
887
+ // or Matcher<T>(x), but more readable than the latter.
888
+ //
889
+ // We could define similar monomorphic matchers for other comparison
890
+ // operations (e.g. TypedLt, TypedGe, and etc), but decided not to do
891
+ // it yet as those are used much less than Eq() in practice. A user
892
+ // can always write Matcher<T>(Lt(5)) to be explicit about the type,
893
+ // for example.
894
+ template <typename Lhs, typename Rhs>
895
+ inline Matcher<Lhs> TypedEq(const Rhs& rhs) { return Eq(rhs); }
896
+
897
+ // Creates a polymorphic matcher that matches anything >= x.
898
+ template <typename Rhs>
899
+ inline internal::GeMatcher<Rhs> Ge(Rhs x) {
900
+ return internal::GeMatcher<Rhs>(x);
901
+ }
902
+
903
+ // Creates a polymorphic matcher that matches anything > x.
904
+ template <typename Rhs>
905
+ inline internal::GtMatcher<Rhs> Gt(Rhs x) {
906
+ return internal::GtMatcher<Rhs>(x);
907
+ }
908
+
909
+ // Creates a polymorphic matcher that matches anything <= x.
910
+ template <typename Rhs>
911
+ inline internal::LeMatcher<Rhs> Le(Rhs x) {
912
+ return internal::LeMatcher<Rhs>(x);
913
+ }
914
+
915
+ // Creates a polymorphic matcher that matches anything < x.
916
+ template <typename Rhs>
917
+ inline internal::LtMatcher<Rhs> Lt(Rhs x) {
918
+ return internal::LtMatcher<Rhs>(x);
919
+ }
920
+
921
+ // Creates a polymorphic matcher that matches anything != x.
922
+ template <typename Rhs>
923
+ inline internal::NeMatcher<Rhs> Ne(Rhs x) {
924
+ return internal::NeMatcher<Rhs>(x);
925
+ }
926
+ } // namespace testing
927
+
928
+ GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 5046
929
+
930
+ #endif // GOOGLETEST_INCLUDE_GTEST_GTEST_MATCHERS_H_
data/miniconda3/include/gtest/gtest-message.h ADDED
@@ -0,0 +1,219 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright 2005, Google Inc.
2
+ // All rights reserved.
3
+ //
4
+ // Redistribution and use in source and binary forms, with or without
5
+ // modification, are permitted provided that the following conditions are
6
+ // met:
7
+ //
8
+ // * Redistributions of source code must retain the above copyright
9
+ // notice, this list of conditions and the following disclaimer.
10
+ // * Redistributions in binary form must reproduce the above
11
+ // copyright notice, this list of conditions and the following disclaimer
12
+ // in the documentation and/or other materials provided with the
13
+ // distribution.
14
+ // * Neither the name of Google Inc. nor the names of its
15
+ // contributors may be used to endorse or promote products derived from
16
+ // this software without specific prior written permission.
17
+ //
18
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+
30
+ //
31
+ // The Google C++ Testing and Mocking Framework (Google Test)
32
+ //
33
+ // This header file defines the Message class.
34
+ //
35
+ // IMPORTANT NOTE: Due to limitation of the C++ language, we have to
36
+ // leave some internal implementation details in this header file.
37
+ // They are clearly marked by comments like this:
38
+ //
39
+ // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
40
+ //
41
+ // Such code is NOT meant to be used by a user directly, and is subject
42
+ // to CHANGE WITHOUT NOTICE. Therefore DO NOT DEPEND ON IT in a user
43
+ // program!
44
+
45
+ // GOOGLETEST_CM0001 DO NOT DELETE
46
+
47
+ #ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
48
+ #define GOOGLETEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
49
+
50
+ #include <limits>
51
+ #include <memory>
52
+ #include <sstream>
53
+
54
+ #include "gtest/internal/gtest-port.h"
55
+
56
+ GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
57
+ /* class A needs to have dll-interface to be used by clients of class B */)
58
+
59
+ // Ensures that there is at least one operator<< in the global namespace.
60
+ // See Message& operator<<(...) below for why.
61
+ void operator<<(const testing::internal::Secret&, int);
62
+
63
+ namespace testing {
64
+
65
+ // The Message class works like an ostream repeater.
66
+ //
67
+ // Typical usage:
68
+ //
69
+ // 1. You stream a bunch of values to a Message object.
70
+ // It will remember the text in a stringstream.
71
+ // 2. Then you stream the Message object to an ostream.
72
+ // This causes the text in the Message to be streamed
73
+ // to the ostream.
74
+ //
75
+ // For example;
76
+ //
77
+ // testing::Message foo;
78
+ // foo << 1 << " != " << 2;
79
+ // std::cout << foo;
80
+ //
81
+ // will print "1 != 2".
82
+ //
83
+ // Message is not intended to be inherited from. In particular, its
84
+ // destructor is not virtual.
85
+ //
86
+ // Note that stringstream behaves differently in gcc and in MSVC. You
87
+ // can stream a NULL char pointer to it in the former, but not in the
88
+ // latter (it causes an access violation if you do). The Message
89
+ // class hides this difference by treating a NULL char pointer as
90
+ // "(null)".
91
+ class GTEST_API_ Message {
92
+ private:
93
+ // The type of basic IO manipulators (endl, ends, and flush) for
94
+ // narrow streams.
95
+ typedef std::ostream& (*BasicNarrowIoManip)(std::ostream&);
96
+
97
+ public:
98
+ // Constructs an empty Message.
99
+ Message();
100
+
101
+ // Copy constructor.
102
+ Message(const Message& msg) : ss_(new ::std::stringstream) { // NOLINT
103
+ *ss_ << msg.GetString();
104
+ }
105
+
106
+ // Constructs a Message from a C-string.
107
+ explicit Message(const char* str) : ss_(new ::std::stringstream) {
108
+ *ss_ << str;
109
+ }
110
+
111
+ // Streams a non-pointer value to this object.
112
+ template <typename T>
113
+ inline Message& operator <<(const T& val) {
114
+ // Some libraries overload << for STL containers. These
115
+ // overloads are defined in the global namespace instead of ::std.
116
+ //
117
+ // C++'s symbol lookup rule (i.e. Koenig lookup) says that these
118
+ // overloads are visible in either the std namespace or the global
119
+ // namespace, but not other namespaces, including the testing
120
+ // namespace which Google Test's Message class is in.
121
+ //
122
+ // To allow STL containers (and other types that has a << operator
123
+ // defined in the global namespace) to be used in Google Test
124
+ // assertions, testing::Message must access the custom << operator
125
+ // from the global namespace. With this using declaration,
126
+ // overloads of << defined in the global namespace and those
127
+ // visible via Koenig lookup are both exposed in this function.
128
+ using ::operator <<;
129
+ *ss_ << val;
130
+ return *this;
131
+ }
132
+
133
+ // Streams a pointer value to this object.
134
+ //
135
+ // This function is an overload of the previous one. When you
136
+ // stream a pointer to a Message, this definition will be used as it
137
+ // is more specialized. (The C++ Standard, section
138
+ // [temp.func.order].) If you stream a non-pointer, then the
139
+ // previous definition will be used.
140
+ //
141
+ // The reason for this overload is that streaming a NULL pointer to
142
+ // ostream is undefined behavior. Depending on the compiler, you
143
+ // may get "0", "(nil)", "(null)", or an access violation. To
144
+ // ensure consistent result across compilers, we always treat NULL
145
+ // as "(null)".
146
+ template <typename T>
147
+ inline Message& operator <<(T* const& pointer) { // NOLINT
148
+ if (pointer == nullptr) {
149
+ *ss_ << "(null)";
150
+ } else {
151
+ *ss_ << pointer;
152
+ }
153
+ return *this;
154
+ }
155
+
156
+ // Since the basic IO manipulators are overloaded for both narrow
157
+ // and wide streams, we have to provide this specialized definition
158
+ // of operator <<, even though its body is the same as the
159
+ // templatized version above. Without this definition, streaming
160
+ // endl or other basic IO manipulators to Message will confuse the
161
+ // compiler.
162
+ Message& operator <<(BasicNarrowIoManip val) {
163
+ *ss_ << val;
164
+ return *this;
165
+ }
166
+
167
+ // Instead of 1/0, we want to see true/false for bool values.
168
+ Message& operator <<(bool b) {
169
+ return *this << (b ? "true" : "false");
170
+ }
171
+
172
+ // These two overloads allow streaming a wide C string to a Message
173
+ // using the UTF-8 encoding.
174
+ Message& operator <<(const wchar_t* wide_c_str);
175
+ Message& operator <<(wchar_t* wide_c_str);
176
+
177
+ #if GTEST_HAS_STD_WSTRING
178
+ // Converts the given wide string to a narrow string using the UTF-8
179
+ // encoding, and streams the result to this Message object.
180
+ Message& operator <<(const ::std::wstring& wstr);
181
+ #endif // GTEST_HAS_STD_WSTRING
182
+
183
+ // Gets the text streamed to this object so far as an std::string.
184
+ // Each '\0' character in the buffer is replaced with "\\0".
185
+ //
186
+ // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
187
+ std::string GetString() const;
188
+
189
+ private:
190
+ // We'll hold the text streamed to this object here.
191
+ const std::unique_ptr< ::std::stringstream> ss_;
192
+
193
+ // We declare (but don't implement) this to prevent the compiler
194
+ // from implementing the assignment operator.
195
+ void operator=(const Message&);
196
+ };
197
+
198
+ // Streams a Message to an ostream.
199
+ inline std::ostream& operator <<(std::ostream& os, const Message& sb) {
200
+ return os << sb.GetString();
201
+ }
202
+
203
+ namespace internal {
204
+
205
+ // Converts a streamable value to an std::string. A NULL pointer is
206
+ // converted to "(null)". When the input value is a ::string,
207
+ // ::std::string, ::wstring, or ::std::wstring object, each NUL
208
+ // character in it is replaced with "\\0".
209
+ template <typename T>
210
+ std::string StreamableToString(const T& streamable) {
211
+ return (Message() << streamable).GetString();
212
+ }
213
+
214
+ } // namespace internal
215
+ } // namespace testing
216
+
217
+ GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
218
+
219
+ #endif // GOOGLETEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
data/miniconda3/include/gtest/gtest-param-test.h ADDED
@@ -0,0 +1,507 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright 2008, Google Inc.
2
+ // All rights reserved.
3
+ //
4
+ // Redistribution and use in source and binary forms, with or without
5
+ // modification, are permitted provided that the following conditions are
6
+ // met:
7
+ //
8
+ // * Redistributions of source code must retain the above copyright
9
+ // notice, this list of conditions and the following disclaimer.
10
+ // * Redistributions in binary form must reproduce the above
11
+ // copyright notice, this list of conditions and the following disclaimer
12
+ // in the documentation and/or other materials provided with the
13
+ // distribution.
14
+ // * Neither the name of Google Inc. nor the names of its
15
+ // contributors may be used to endorse or promote products derived from
16
+ // this software without specific prior written permission.
17
+ //
18
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ //
30
+ // Macros and functions for implementing parameterized tests
31
+ // in Google C++ Testing and Mocking Framework (Google Test)
32
+ //
33
+ // GOOGLETEST_CM0001 DO NOT DELETE
34
+ #ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
35
+ #define GOOGLETEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
36
+
37
+ // Value-parameterized tests allow you to test your code with different
38
+ // parameters without writing multiple copies of the same test.
39
+ //
40
+ // Here is how you use value-parameterized tests:
41
+
42
+ #if 0
43
+
44
+ // To write value-parameterized tests, first you should define a fixture
45
+ // class. It is usually derived from testing::TestWithParam<T> (see below for
46
+ // another inheritance scheme that's sometimes useful in more complicated
47
+ // class hierarchies), where the type of your parameter values.
48
+ // TestWithParam<T> is itself derived from testing::Test. T can be any
49
+ // copyable type. If it's a raw pointer, you are responsible for managing the
50
+ // lifespan of the pointed values.
51
+
52
+ class FooTest : public ::testing::TestWithParam<const char*> {
53
+ // You can implement all the usual class fixture members here.
54
+ };
55
+
56
+ // Then, use the TEST_P macro to define as many parameterized tests
57
+ // for this fixture as you want. The _P suffix is for "parameterized"
58
+ // or "pattern", whichever you prefer to think.
59
+
60
+ TEST_P(FooTest, DoesBlah) {
61
+ // Inside a test, access the test parameter with the GetParam() method
62
+ // of the TestWithParam<T> class:
63
+ EXPECT_TRUE(foo.Blah(GetParam()));
64
+ ...
65
+ }
66
+
67
+ TEST_P(FooTest, HasBlahBlah) {
68
+ ...
69
+ }
70
+
71
+ // Finally, you can use INSTANTIATE_TEST_SUITE_P to instantiate the test
72
+ // case with any set of parameters you want. Google Test defines a number
73
+ // of functions for generating test parameters. They return what we call
74
+ // (surprise!) parameter generators. Here is a summary of them, which
75
+ // are all in the testing namespace:
76
+ //
77
+ //
78
+ // Range(begin, end [, step]) - Yields values {begin, begin+step,
79
+ // begin+step+step, ...}. The values do not
80
+ // include end. step defaults to 1.
81
+ // Values(v1, v2, ..., vN) - Yields values {v1, v2, ..., vN}.
82
+ // ValuesIn(container) - Yields values from a C-style array, an STL
83
+ // ValuesIn(begin,end) container, or an iterator range [begin, end).
84
+ // Bool() - Yields sequence {false, true}.
85
+ // Combine(g1, g2, ..., gN) - Yields all combinations (the Cartesian product
86
+ // for the math savvy) of the values generated
87
+ // by the N generators.
88
+ //
89
+ // For more details, see comments at the definitions of these functions below
90
+ // in this file.
91
+ //
92
+ // The following statement will instantiate tests from the FooTest test suite
93
+ // each with parameter values "meeny", "miny", and "moe".
94
+
95
+ INSTANTIATE_TEST_SUITE_P(InstantiationName,
96
+ FooTest,
97
+ Values("meeny", "miny", "moe"));
98
+
99
+ // To distinguish different instances of the pattern, (yes, you
100
+ // can instantiate it more than once) the first argument to the
101
+ // INSTANTIATE_TEST_SUITE_P macro is a prefix that will be added to the
102
+ // actual test suite name. Remember to pick unique prefixes for different
103
+ // instantiations. The tests from the instantiation above will have
104
+ // these names:
105
+ //
106
+ // * InstantiationName/FooTest.DoesBlah/0 for "meeny"
107
+ // * InstantiationName/FooTest.DoesBlah/1 for "miny"
108
+ // * InstantiationName/FooTest.DoesBlah/2 for "moe"
109
+ // * InstantiationName/FooTest.HasBlahBlah/0 for "meeny"
110
+ // * InstantiationName/FooTest.HasBlahBlah/1 for "miny"
111
+ // * InstantiationName/FooTest.HasBlahBlah/2 for "moe"
112
+ //
113
+ // You can use these names in --gtest_filter.
114
+ //
115
+ // This statement will instantiate all tests from FooTest again, each
116
+ // with parameter values "cat" and "dog":
117
+
118
+ const char* pets[] = {"cat", "dog"};
119
+ INSTANTIATE_TEST_SUITE_P(AnotherInstantiationName, FooTest, ValuesIn(pets));
120
+
121
+ // The tests from the instantiation above will have these names:
122
+ //
123
+ // * AnotherInstantiationName/FooTest.DoesBlah/0 for "cat"
124
+ // * AnotherInstantiationName/FooTest.DoesBlah/1 for "dog"
125
+ // * AnotherInstantiationName/FooTest.HasBlahBlah/0 for "cat"
126
+ // * AnotherInstantiationName/FooTest.HasBlahBlah/1 for "dog"
127
+ //
128
+ // Please note that INSTANTIATE_TEST_SUITE_P will instantiate all tests
129
+ // in the given test suite, whether their definitions come before or
130
+ // AFTER the INSTANTIATE_TEST_SUITE_P statement.
131
+ //
132
+ // Please also note that generator expressions (including parameters to the
133
+ // generators) are evaluated in InitGoogleTest(), after main() has started.
134
+ // This allows the user on one hand, to adjust generator parameters in order
135
+ // to dynamically determine a set of tests to run and on the other hand,
136
+ // give the user a chance to inspect the generated tests with Google Test
137
+ // reflection API before RUN_ALL_TESTS() is executed.
138
+ //
139
+ // You can see samples/sample7_unittest.cc and samples/sample8_unittest.cc
140
+ // for more examples.
141
+ //
142
+ // In the future, we plan to publish the API for defining new parameter
143
+ // generators. But for now this interface remains part of the internal
144
+ // implementation and is subject to change.
145
+ //
146
+ //
147
+ // A parameterized test fixture must be derived from testing::Test and from
148
+ // testing::WithParamInterface<T>, where T is the type of the parameter
149
+ // values. Inheriting from TestWithParam<T> satisfies that requirement because
150
+ // TestWithParam<T> inherits from both Test and WithParamInterface. In more
151
+ // complicated hierarchies, however, it is occasionally useful to inherit
152
+ // separately from Test and WithParamInterface. For example:
153
+
154
+ class BaseTest : public ::testing::Test {
155
+ // You can inherit all the usual members for a non-parameterized test
156
+ // fixture here.
157
+ };
158
+
159
+ class DerivedTest : public BaseTest, public ::testing::WithParamInterface<int> {
160
+ // The usual test fixture members go here too.
161
+ };
162
+
163
+ TEST_F(BaseTest, HasFoo) {
164
+ // This is an ordinary non-parameterized test.
165
+ }
166
+
167
+ TEST_P(DerivedTest, DoesBlah) {
168
+ // GetParam works just the same here as if you inherit from TestWithParam.
169
+ EXPECT_TRUE(foo.Blah(GetParam()));
170
+ }
171
+
172
+ #endif // 0
173
+
174
+ #include <iterator>
175
+ #include <utility>
176
+
177
+ #include "gtest/internal/gtest-internal.h"
178
+ #include "gtest/internal/gtest-param-util.h"
179
+ #include "gtest/internal/gtest-port.h"
180
+
181
+ namespace testing {
182
+
183
+ // Functions producing parameter generators.
184
+ //
185
+ // Google Test uses these generators to produce parameters for value-
186
+ // parameterized tests. When a parameterized test suite is instantiated
187
+ // with a particular generator, Google Test creates and runs tests
188
+ // for each element in the sequence produced by the generator.
189
+ //
190
+ // In the following sample, tests from test suite FooTest are instantiated
191
+ // each three times with parameter values 3, 5, and 8:
192
+ //
193
+ // class FooTest : public TestWithParam<int> { ... };
194
+ //
195
+ // TEST_P(FooTest, TestThis) {
196
+ // }
197
+ // TEST_P(FooTest, TestThat) {
198
+ // }
199
+ // INSTANTIATE_TEST_SUITE_P(TestSequence, FooTest, Values(3, 5, 8));
200
+ //
201
+
202
+ // Range() returns generators providing sequences of values in a range.
203
+ //
204
+ // Synopsis:
205
+ // Range(start, end)
206
+ // - returns a generator producing a sequence of values {start, start+1,
207
+ // start+2, ..., }.
208
+ // Range(start, end, step)
209
+ // - returns a generator producing a sequence of values {start, start+step,
210
+ // start+step+step, ..., }.
211
+ // Notes:
212
+ // * The generated sequences never include end. For example, Range(1, 5)
213
+ // returns a generator producing a sequence {1, 2, 3, 4}. Range(1, 9, 2)
214
+ // returns a generator producing {1, 3, 5, 7}.
215
+ // * start and end must have the same type. That type may be any integral or
216
+ // floating-point type or a user defined type satisfying these conditions:
217
+ // * It must be assignable (have operator=() defined).
218
+ // * It must have operator+() (operator+(int-compatible type) for
219
+ // two-operand version).
220
+ // * It must have operator<() defined.
221
+ // Elements in the resulting sequences will also have that type.
222
+ // * Condition start < end must be satisfied in order for resulting sequences
223
+ // to contain any elements.
224
+ //
225
+ template <typename T, typename IncrementT>
226
+ internal::ParamGenerator<T> Range(T start, T end, IncrementT step) {
227
+ return internal::ParamGenerator<T>(
228
+ new internal::RangeGenerator<T, IncrementT>(start, end, step));
229
+ }
230
+
231
+ template <typename T>
232
+ internal::ParamGenerator<T> Range(T start, T end) {
233
+ return Range(start, end, 1);
234
+ }
235
+
236
+ // ValuesIn() function allows generation of tests with parameters coming from
237
+ // a container.
238
+ //
239
+ // Synopsis:
240
+ // ValuesIn(const T (&array)[N])
241
+ // - returns a generator producing sequences with elements from
242
+ // a C-style array.
243
+ // ValuesIn(const Container& container)
244
+ // - returns a generator producing sequences with elements from
245
+ // an STL-style container.
246
+ // ValuesIn(Iterator begin, Iterator end)
247
+ // - returns a generator producing sequences with elements from
248
+ // a range [begin, end) defined by a pair of STL-style iterators. These
249
+ // iterators can also be plain C pointers.
250
+ //
251
+ // Please note that ValuesIn copies the values from the containers
252
+ // passed in and keeps them to generate tests in RUN_ALL_TESTS().
253
+ //
254
+ // Examples:
255
+ //
256
+ // This instantiates tests from test suite StringTest
257
+ // each with C-string values of "foo", "bar", and "baz":
258
+ //
259
+ // const char* strings[] = {"foo", "bar", "baz"};
260
+ // INSTANTIATE_TEST_SUITE_P(StringSequence, StringTest, ValuesIn(strings));
261
+ //
262
+ // This instantiates tests from test suite StlStringTest
263
+ // each with STL strings with values "a" and "b":
264
+ //
265
+ // ::std::vector< ::std::string> GetParameterStrings() {
266
+ // ::std::vector< ::std::string> v;
267
+ // v.push_back("a");
268
+ // v.push_back("b");
269
+ // return v;
270
+ // }
271
+ //
272
+ // INSTANTIATE_TEST_SUITE_P(CharSequence,
273
+ // StlStringTest,
274
+ // ValuesIn(GetParameterStrings()));
275
+ //
276
+ //
277
+ // This will also instantiate tests from CharTest
278
+ // each with parameter values 'a' and 'b':
279
+ //
280
+ // ::std::list<char> GetParameterChars() {
281
+ // ::std::list<char> list;
282
+ // list.push_back('a');
283
+ // list.push_back('b');
284
+ // return list;
285
+ // }
286
+ // ::std::list<char> l = GetParameterChars();
287
+ // INSTANTIATE_TEST_SUITE_P(CharSequence2,
288
+ // CharTest,
289
+ // ValuesIn(l.begin(), l.end()));
290
+ //
291
+ template <typename ForwardIterator>
292
+ internal::ParamGenerator<
293
+ typename std::iterator_traits<ForwardIterator>::value_type>
294
+ ValuesIn(ForwardIterator begin, ForwardIterator end) {
295
+ typedef typename std::iterator_traits<ForwardIterator>::value_type ParamType;
296
+ return internal::ParamGenerator<ParamType>(
297
+ new internal::ValuesInIteratorRangeGenerator<ParamType>(begin, end));
298
+ }
299
+
300
+ template <typename T, size_t N>
301
+ internal::ParamGenerator<T> ValuesIn(const T (&array)[N]) {
302
+ return ValuesIn(array, array + N);
303
+ }
304
+
305
+ template <class Container>
306
+ internal::ParamGenerator<typename Container::value_type> ValuesIn(
307
+ const Container& container) {
308
+ return ValuesIn(container.begin(), container.end());
309
+ }
310
+
311
+ // Values() allows generating tests from explicitly specified list of
312
+ // parameters.
313
+ //
314
+ // Synopsis:
315
+ // Values(T v1, T v2, ..., T vN)
316
+ // - returns a generator producing sequences with elements v1, v2, ..., vN.
317
+ //
318
+ // For example, this instantiates tests from test suite BarTest each
319
+ // with values "one", "two", and "three":
320
+ //
321
+ // INSTANTIATE_TEST_SUITE_P(NumSequence,
322
+ // BarTest,
323
+ // Values("one", "two", "three"));
324
+ //
325
+ // This instantiates tests from test suite BazTest each with values 1, 2, 3.5.
326
+ // The exact type of values will depend on the type of parameter in BazTest.
327
+ //
328
+ // INSTANTIATE_TEST_SUITE_P(FloatingNumbers, BazTest, Values(1, 2, 3.5));
329
+ //
330
+ //
331
+ template <typename... T>
332
+ internal::ValueArray<T...> Values(T... v) {
333
+ return internal::ValueArray<T...>(std::move(v)...);
334
+ }
335
+
336
+ // Bool() allows generating tests with parameters in a set of (false, true).
337
+ //
338
+ // Synopsis:
339
+ // Bool()
340
+ // - returns a generator producing sequences with elements {false, true}.
341
+ //
342
+ // It is useful when testing code that depends on Boolean flags. Combinations
343
+ // of multiple flags can be tested when several Bool()'s are combined using
344
+ // Combine() function.
345
+ //
346
+ // In the following example all tests in the test suite FlagDependentTest
347
+ // will be instantiated twice with parameters false and true.
348
+ //
349
+ // class FlagDependentTest : public testing::TestWithParam<bool> {
350
+ // virtual void SetUp() {
351
+ // external_flag = GetParam();
352
+ // }
353
+ // }
354
+ // INSTANTIATE_TEST_SUITE_P(BoolSequence, FlagDependentTest, Bool());
355
+ //
356
+ inline internal::ParamGenerator<bool> Bool() {
357
+ return Values(false, true);
358
+ }
359
+
360
+ // Combine() allows the user to combine two or more sequences to produce
361
+ // values of a Cartesian product of those sequences' elements.
362
+ //
363
+ // Synopsis:
364
+ // Combine(gen1, gen2, ..., genN)
365
+ // - returns a generator producing sequences with elements coming from
366
+ // the Cartesian product of elements from the sequences generated by
367
+ // gen1, gen2, ..., genN. The sequence elements will have a type of
368
+ // std::tuple<T1, T2, ..., TN> where T1, T2, ..., TN are the types
369
+ // of elements from sequences produces by gen1, gen2, ..., genN.
370
+ //
371
+ // Example:
372
+ //
373
+ // This will instantiate tests in test suite AnimalTest each one with
374
+ // the parameter values tuple("cat", BLACK), tuple("cat", WHITE),
375
+ // tuple("dog", BLACK), and tuple("dog", WHITE):
376
+ //
377
+ // enum Color { BLACK, GRAY, WHITE };
378
+ // class AnimalTest
379
+ // : public testing::TestWithParam<std::tuple<const char*, Color> > {...};
380
+ //
381
+ // TEST_P(AnimalTest, AnimalLooksNice) {...}
382
+ //
383
+ // INSTANTIATE_TEST_SUITE_P(AnimalVariations, AnimalTest,
384
+ // Combine(Values("cat", "dog"),
385
+ // Values(BLACK, WHITE)));
386
+ //
387
+ // This will instantiate tests in FlagDependentTest with all variations of two
388
+ // Boolean flags:
389
+ //
390
+ // class FlagDependentTest
391
+ // : public testing::TestWithParam<std::tuple<bool, bool> > {
392
+ // virtual void SetUp() {
393
+ // // Assigns external_flag_1 and external_flag_2 values from the tuple.
394
+ // std::tie(external_flag_1, external_flag_2) = GetParam();
395
+ // }
396
+ // };
397
+ //
398
+ // TEST_P(FlagDependentTest, TestFeature1) {
399
+ // // Test your code using external_flag_1 and external_flag_2 here.
400
+ // }
401
+ // INSTANTIATE_TEST_SUITE_P(TwoBoolSequence, FlagDependentTest,
402
+ // Combine(Bool(), Bool()));
403
+ //
404
+ template <typename... Generator>
405
+ internal::CartesianProductHolder<Generator...> Combine(const Generator&... g) {
406
+ return internal::CartesianProductHolder<Generator...>(g...);
407
+ }
408
+
409
+ #define TEST_P(test_suite_name, test_name) \
410
+ class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
411
+ : public test_suite_name { \
412
+ public: \
413
+ GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() {} \
414
+ void TestBody() override; \
415
+ \
416
+ private: \
417
+ static int AddToRegistry() { \
418
+ ::testing::UnitTest::GetInstance() \
419
+ ->parameterized_test_registry() \
420
+ .GetTestSuitePatternHolder<test_suite_name>( \
421
+ GTEST_STRINGIFY_(test_suite_name), \
422
+ ::testing::internal::CodeLocation(__FILE__, __LINE__)) \
423
+ ->AddTestPattern( \
424
+ GTEST_STRINGIFY_(test_suite_name), GTEST_STRINGIFY_(test_name), \
425
+ new ::testing::internal::TestMetaFactory<GTEST_TEST_CLASS_NAME_( \
426
+ test_suite_name, test_name)>(), \
427
+ ::testing::internal::CodeLocation(__FILE__, __LINE__)); \
428
+ return 0; \
429
+ } \
430
+ static int gtest_registering_dummy_ GTEST_ATTRIBUTE_UNUSED_; \
431
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(GTEST_TEST_CLASS_NAME_(test_suite_name, \
432
+ test_name)); \
433
+ }; \
434
+ int GTEST_TEST_CLASS_NAME_(test_suite_name, \
435
+ test_name)::gtest_registering_dummy_ = \
436
+ GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::AddToRegistry(); \
437
+ void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::TestBody()
438
+
439
+ // The last argument to INSTANTIATE_TEST_SUITE_P allows the user to specify
440
+ // generator and an optional function or functor that generates custom test name
441
+ // suffixes based on the test parameters. Such a function or functor should
442
+ // accept one argument of type testing::TestParamInfo<class ParamType>, and
443
+ // return std::string.
444
+ //
445
+ // testing::PrintToStringParamName is a builtin test suffix generator that
446
+ // returns the value of testing::PrintToString(GetParam()).
447
+ //
448
+ // Note: test names must be non-empty, unique, and may only contain ASCII
449
+ // alphanumeric characters or underscore. Because PrintToString adds quotes
450
+ // to std::string and C strings, it won't work for these types.
451
+
452
+ #define GTEST_EXPAND_(arg) arg
453
+ #define GTEST_GET_FIRST_(first, ...) first
454
+ #define GTEST_GET_SECOND_(first, second, ...) second
455
+
456
+ #define INSTANTIATE_TEST_SUITE_P(prefix, test_suite_name, ...) \
457
+ static ::testing::internal::ParamGenerator<test_suite_name::ParamType> \
458
+ gtest_##prefix##test_suite_name##_EvalGenerator_() { \
459
+ return GTEST_EXPAND_(GTEST_GET_FIRST_(__VA_ARGS__, DUMMY_PARAM_)); \
460
+ } \
461
+ static ::std::string gtest_##prefix##test_suite_name##_EvalGenerateName_( \
462
+ const ::testing::TestParamInfo<test_suite_name::ParamType>& info) { \
463
+ if (::testing::internal::AlwaysFalse()) { \
464
+ ::testing::internal::TestNotEmpty(GTEST_EXPAND_(GTEST_GET_SECOND_( \
465
+ __VA_ARGS__, \
466
+ ::testing::internal::DefaultParamName<test_suite_name::ParamType>, \
467
+ DUMMY_PARAM_))); \
468
+ auto t = std::make_tuple(__VA_ARGS__); \
469
+ static_assert(std::tuple_size<decltype(t)>::value <= 2, \
470
+ "Too Many Args!"); \
471
+ } \
472
+ return ((GTEST_EXPAND_(GTEST_GET_SECOND_( \
473
+ __VA_ARGS__, \
474
+ ::testing::internal::DefaultParamName<test_suite_name::ParamType>, \
475
+ DUMMY_PARAM_))))(info); \
476
+ } \
477
+ static int gtest_##prefix##test_suite_name##_dummy_ \
478
+ GTEST_ATTRIBUTE_UNUSED_ = \
479
+ ::testing::UnitTest::GetInstance() \
480
+ ->parameterized_test_registry() \
481
+ .GetTestSuitePatternHolder<test_suite_name>( \
482
+ GTEST_STRINGIFY_(test_suite_name), \
483
+ ::testing::internal::CodeLocation(__FILE__, __LINE__)) \
484
+ ->AddTestSuiteInstantiation( \
485
+ GTEST_STRINGIFY_(prefix), \
486
+ &gtest_##prefix##test_suite_name##_EvalGenerator_, \
487
+ &gtest_##prefix##test_suite_name##_EvalGenerateName_, \
488
+ __FILE__, __LINE__)
489
+
490
+
491
+ // Allow Marking a Parameterized test class as not needing to be instantiated.
492
+ #define GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(T) \
493
+ namespace gtest_do_not_use_outside_namespace_scope {} \
494
+ static const ::testing::internal::MarkAsIgnored gtest_allow_ignore_##T( \
495
+ GTEST_STRINGIFY_(T))
496
+
497
+ // Legacy API is deprecated but still available
498
+ #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
499
+ #define INSTANTIATE_TEST_CASE_P \
500
+ static_assert(::testing::internal::InstantiateTestCase_P_IsDeprecated(), \
501
+ ""); \
502
+ INSTANTIATE_TEST_SUITE_P
503
+ #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
504
+
505
+ } // namespace testing
506
+
507
+ #endif // GOOGLETEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_
data/miniconda3/include/gtest/gtest-spi.h ADDED
@@ -0,0 +1,238 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright 2007, Google Inc.
2
+ // All rights reserved.
3
+ //
4
+ // Redistribution and use in source and binary forms, with or without
5
+ // modification, are permitted provided that the following conditions are
6
+ // met:
7
+ //
8
+ // * Redistributions of source code must retain the above copyright
9
+ // notice, this list of conditions and the following disclaimer.
10
+ // * Redistributions in binary form must reproduce the above
11
+ // copyright notice, this list of conditions and the following disclaimer
12
+ // in the documentation and/or other materials provided with the
13
+ // distribution.
14
+ // * Neither the name of Google Inc. nor the names of its
15
+ // contributors may be used to endorse or promote products derived from
16
+ // this software without specific prior written permission.
17
+ //
18
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+
30
+ //
31
+ // Utilities for testing Google Test itself and code that uses Google Test
32
+ // (e.g. frameworks built on top of Google Test).
33
+
34
+ // GOOGLETEST_CM0004 DO NOT DELETE
35
+
36
+ #ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_SPI_H_
37
+ #define GOOGLETEST_INCLUDE_GTEST_GTEST_SPI_H_
38
+
39
+ #include "gtest/gtest.h"
40
+
41
+ GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
42
+ /* class A needs to have dll-interface to be used by clients of class B */)
43
+
44
+ namespace testing {
45
+
46
+ // This helper class can be used to mock out Google Test failure reporting
47
+ // so that we can test Google Test or code that builds on Google Test.
48
+ //
49
+ // An object of this class appends a TestPartResult object to the
50
+ // TestPartResultArray object given in the constructor whenever a Google Test
51
+ // failure is reported. It can either intercept only failures that are
52
+ // generated in the same thread that created this object or it can intercept
53
+ // all generated failures. The scope of this mock object can be controlled with
54
+ // the second argument to the two arguments constructor.
55
+ class GTEST_API_ ScopedFakeTestPartResultReporter
56
+ : public TestPartResultReporterInterface {
57
+ public:
58
+ // The two possible mocking modes of this object.
59
+ enum InterceptMode {
60
+ INTERCEPT_ONLY_CURRENT_THREAD, // Intercepts only thread local failures.
61
+ INTERCEPT_ALL_THREADS // Intercepts all failures.
62
+ };
63
+
64
+ // The c'tor sets this object as the test part result reporter used
65
+ // by Google Test. The 'result' parameter specifies where to report the
66
+ // results. This reporter will only catch failures generated in the current
67
+ // thread. DEPRECATED
68
+ explicit ScopedFakeTestPartResultReporter(TestPartResultArray* result);
69
+
70
+ // Same as above, but you can choose the interception scope of this object.
71
+ ScopedFakeTestPartResultReporter(InterceptMode intercept_mode,
72
+ TestPartResultArray* result);
73
+
74
+ // The d'tor restores the previous test part result reporter.
75
+ ~ScopedFakeTestPartResultReporter() override;
76
+
77
+ // Appends the TestPartResult object to the TestPartResultArray
78
+ // received in the constructor.
79
+ //
80
+ // This method is from the TestPartResultReporterInterface
81
+ // interface.
82
+ void ReportTestPartResult(const TestPartResult& result) override;
83
+
84
+ private:
85
+ void Init();
86
+
87
+ const InterceptMode intercept_mode_;
88
+ TestPartResultReporterInterface* old_reporter_;
89
+ TestPartResultArray* const result_;
90
+
91
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedFakeTestPartResultReporter);
92
+ };
93
+
94
+ namespace internal {
95
+
96
+ // A helper class for implementing EXPECT_FATAL_FAILURE() and
97
+ // EXPECT_NONFATAL_FAILURE(). Its destructor verifies that the given
98
+ // TestPartResultArray contains exactly one failure that has the given
99
+ // type and contains the given substring. If that's not the case, a
100
+ // non-fatal failure will be generated.
101
+ class GTEST_API_ SingleFailureChecker {
102
+ public:
103
+ // The constructor remembers the arguments.
104
+ SingleFailureChecker(const TestPartResultArray* results,
105
+ TestPartResult::Type type, const std::string& substr);
106
+ ~SingleFailureChecker();
107
+ private:
108
+ const TestPartResultArray* const results_;
109
+ const TestPartResult::Type type_;
110
+ const std::string substr_;
111
+
112
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(SingleFailureChecker);
113
+ };
114
+
115
+ } // namespace internal
116
+
117
+ } // namespace testing
118
+
119
+ GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
120
+
121
+ // A set of macros for testing Google Test assertions or code that's expected
122
+ // to generate Google Test fatal failures. It verifies that the given
123
+ // statement will cause exactly one fatal Google Test failure with 'substr'
124
+ // being part of the failure message.
125
+ //
126
+ // There are two different versions of this macro. EXPECT_FATAL_FAILURE only
127
+ // affects and considers failures generated in the current thread and
128
+ // EXPECT_FATAL_FAILURE_ON_ALL_THREADS does the same but for all threads.
129
+ //
130
+ // The verification of the assertion is done correctly even when the statement
131
+ // throws an exception or aborts the current function.
132
+ //
133
+ // Known restrictions:
134
+ // - 'statement' cannot reference local non-static variables or
135
+ // non-static members of the current object.
136
+ // - 'statement' cannot return a value.
137
+ // - You cannot stream a failure message to this macro.
138
+ //
139
+ // Note that even though the implementations of the following two
140
+ // macros are much alike, we cannot refactor them to use a common
141
+ // helper macro, due to some peculiarity in how the preprocessor
142
+ // works. The AcceptsMacroThatExpandsToUnprotectedComma test in
143
+ // gtest_unittest.cc will fail to compile if we do that.
144
+ #define EXPECT_FATAL_FAILURE(statement, substr) \
145
+ do { \
146
+ class GTestExpectFatalFailureHelper {\
147
+ public:\
148
+ static void Execute() { statement; }\
149
+ };\
150
+ ::testing::TestPartResultArray gtest_failures;\
151
+ ::testing::internal::SingleFailureChecker gtest_checker(\
152
+ &gtest_failures, ::testing::TestPartResult::kFatalFailure, (substr));\
153
+ {\
154
+ ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
155
+ ::testing::ScopedFakeTestPartResultReporter:: \
156
+ INTERCEPT_ONLY_CURRENT_THREAD, &gtest_failures);\
157
+ GTestExpectFatalFailureHelper::Execute();\
158
+ }\
159
+ } while (::testing::internal::AlwaysFalse())
160
+
161
+ #define EXPECT_FATAL_FAILURE_ON_ALL_THREADS(statement, substr) \
162
+ do { \
163
+ class GTestExpectFatalFailureHelper {\
164
+ public:\
165
+ static void Execute() { statement; }\
166
+ };\
167
+ ::testing::TestPartResultArray gtest_failures;\
168
+ ::testing::internal::SingleFailureChecker gtest_checker(\
169
+ &gtest_failures, ::testing::TestPartResult::kFatalFailure, (substr));\
170
+ {\
171
+ ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
172
+ ::testing::ScopedFakeTestPartResultReporter:: \
173
+ INTERCEPT_ALL_THREADS, &gtest_failures);\
174
+ GTestExpectFatalFailureHelper::Execute();\
175
+ }\
176
+ } while (::testing::internal::AlwaysFalse())
177
+
178
+ // A macro for testing Google Test assertions or code that's expected to
179
+ // generate Google Test non-fatal failures. It asserts that the given
180
+ // statement will cause exactly one non-fatal Google Test failure with 'substr'
181
+ // being part of the failure message.
182
+ //
183
+ // There are two different versions of this macro. EXPECT_NONFATAL_FAILURE only
184
+ // affects and considers failures generated in the current thread and
185
+ // EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS does the same but for all threads.
186
+ //
187
+ // 'statement' is allowed to reference local variables and members of
188
+ // the current object.
189
+ //
190
+ // The verification of the assertion is done correctly even when the statement
191
+ // throws an exception or aborts the current function.
192
+ //
193
+ // Known restrictions:
194
+ // - You cannot stream a failure message to this macro.
195
+ //
196
+ // Note that even though the implementations of the following two
197
+ // macros are much alike, we cannot refactor them to use a common
198
+ // helper macro, due to some peculiarity in how the preprocessor
199
+ // works. If we do that, the code won't compile when the user gives
200
+ // EXPECT_NONFATAL_FAILURE() a statement that contains a macro that
201
+ // expands to code containing an unprotected comma. The
202
+ // AcceptsMacroThatExpandsToUnprotectedComma test in gtest_unittest.cc
203
+ // catches that.
204
+ //
205
+ // For the same reason, we have to write
206
+ // if (::testing::internal::AlwaysTrue()) { statement; }
207
+ // instead of
208
+ // GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
209
+ // to avoid an MSVC warning on unreachable code.
210
+ #define EXPECT_NONFATAL_FAILURE(statement, substr) \
211
+ do {\
212
+ ::testing::TestPartResultArray gtest_failures;\
213
+ ::testing::internal::SingleFailureChecker gtest_checker(\
214
+ &gtest_failures, ::testing::TestPartResult::kNonFatalFailure, \
215
+ (substr));\
216
+ {\
217
+ ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
218
+ ::testing::ScopedFakeTestPartResultReporter:: \
219
+ INTERCEPT_ONLY_CURRENT_THREAD, &gtest_failures);\
220
+ if (::testing::internal::AlwaysTrue()) { statement; }\
221
+ }\
222
+ } while (::testing::internal::AlwaysFalse())
223
+
224
+ #define EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(statement, substr) \
225
+ do {\
226
+ ::testing::TestPartResultArray gtest_failures;\
227
+ ::testing::internal::SingleFailureChecker gtest_checker(\
228
+ &gtest_failures, ::testing::TestPartResult::kNonFatalFailure, \
229
+ (substr));\
230
+ {\
231
+ ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
232
+ ::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS, \
233
+ &gtest_failures);\
234
+ if (::testing::internal::AlwaysTrue()) { statement; }\
235
+ }\
236
+ } while (::testing::internal::AlwaysFalse())
237
+
238
+ #endif // GOOGLETEST_INCLUDE_GTEST_GTEST_SPI_H_
data/miniconda3/include/gtest/gtest-test-part.h ADDED
@@ -0,0 +1,184 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright 2008, Google Inc.
2
+ // All rights reserved.
3
+ //
4
+ // Redistribution and use in source and binary forms, with or without
5
+ // modification, are permitted provided that the following conditions are
6
+ // met:
7
+ //
8
+ // * Redistributions of source code must retain the above copyright
9
+ // notice, this list of conditions and the following disclaimer.
10
+ // * Redistributions in binary form must reproduce the above
11
+ // copyright notice, this list of conditions and the following disclaimer
12
+ // in the documentation and/or other materials provided with the
13
+ // distribution.
14
+ // * Neither the name of Google Inc. nor the names of its
15
+ // contributors may be used to endorse or promote products derived from
16
+ // this software without specific prior written permission.
17
+ //
18
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ //
30
+ // GOOGLETEST_CM0001 DO NOT DELETE
31
+
32
+ #ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
33
+ #define GOOGLETEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
34
+
35
+ #include <iosfwd>
36
+ #include <vector>
37
+ #include "gtest/internal/gtest-internal.h"
38
+ #include "gtest/internal/gtest-string.h"
39
+
40
+ GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
41
+ /* class A needs to have dll-interface to be used by clients of class B */)
42
+
43
+ namespace testing {
44
+
45
+ // A copyable object representing the result of a test part (i.e. an
46
+ // assertion or an explicit FAIL(), ADD_FAILURE(), or SUCCESS()).
47
+ //
48
+ // Don't inherit from TestPartResult as its destructor is not virtual.
49
+ class GTEST_API_ TestPartResult {
50
+ public:
51
+ // The possible outcomes of a test part (i.e. an assertion or an
52
+ // explicit SUCCEED(), FAIL(), or ADD_FAILURE()).
53
+ enum Type {
54
+ kSuccess, // Succeeded.
55
+ kNonFatalFailure, // Failed but the test can continue.
56
+ kFatalFailure, // Failed and the test should be terminated.
57
+ kSkip // Skipped.
58
+ };
59
+
60
+ // C'tor. TestPartResult does NOT have a default constructor.
61
+ // Always use this constructor (with parameters) to create a
62
+ // TestPartResult object.
63
+ TestPartResult(Type a_type, const char* a_file_name, int a_line_number,
64
+ const char* a_message)
65
+ : type_(a_type),
66
+ file_name_(a_file_name == nullptr ? "" : a_file_name),
67
+ line_number_(a_line_number),
68
+ summary_(ExtractSummary(a_message)),
69
+ message_(a_message) {}
70
+
71
+ // Gets the outcome of the test part.
72
+ Type type() const { return type_; }
73
+
74
+ // Gets the name of the source file where the test part took place, or
75
+ // NULL if it's unknown.
76
+ const char* file_name() const {
77
+ return file_name_.empty() ? nullptr : file_name_.c_str();
78
+ }
79
+
80
+ // Gets the line in the source file where the test part took place,
81
+ // or -1 if it's unknown.
82
+ int line_number() const { return line_number_; }
83
+
84
+ // Gets the summary of the failure message.
85
+ const char* summary() const { return summary_.c_str(); }
86
+
87
+ // Gets the message associated with the test part.
88
+ const char* message() const { return message_.c_str(); }
89
+
90
+ // Returns true if and only if the test part was skipped.
91
+ bool skipped() const { return type_ == kSkip; }
92
+
93
+ // Returns true if and only if the test part passed.
94
+ bool passed() const { return type_ == kSuccess; }
95
+
96
+ // Returns true if and only if the test part non-fatally failed.
97
+ bool nonfatally_failed() const { return type_ == kNonFatalFailure; }
98
+
99
+ // Returns true if and only if the test part fatally failed.
100
+ bool fatally_failed() const { return type_ == kFatalFailure; }
101
+
102
+ // Returns true if and only if the test part failed.
103
+ bool failed() const { return fatally_failed() || nonfatally_failed(); }
104
+
105
+ private:
106
+ Type type_;
107
+
108
+ // Gets the summary of the failure message by omitting the stack
109
+ // trace in it.
110
+ static std::string ExtractSummary(const char* message);
111
+
112
+ // The name of the source file where the test part took place, or
113
+ // "" if the source file is unknown.
114
+ std::string file_name_;
115
+ // The line in the source file where the test part took place, or -1
116
+ // if the line number is unknown.
117
+ int line_number_;
118
+ std::string summary_; // The test failure summary.
119
+ std::string message_; // The test failure message.
120
+ };
121
+
122
+ // Prints a TestPartResult object.
123
+ std::ostream& operator<<(std::ostream& os, const TestPartResult& result);
124
+
125
+ // An array of TestPartResult objects.
126
+ //
127
+ // Don't inherit from TestPartResultArray as its destructor is not
128
+ // virtual.
129
+ class GTEST_API_ TestPartResultArray {
130
+ public:
131
+ TestPartResultArray() {}
132
+
133
+ // Appends the given TestPartResult to the array.
134
+ void Append(const TestPartResult& result);
135
+
136
+ // Returns the TestPartResult at the given index (0-based).
137
+ const TestPartResult& GetTestPartResult(int index) const;
138
+
139
+ // Returns the number of TestPartResult objects in the array.
140
+ int size() const;
141
+
142
+ private:
143
+ std::vector<TestPartResult> array_;
144
+
145
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(TestPartResultArray);
146
+ };
147
+
148
+ // This interface knows how to report a test part result.
149
+ class GTEST_API_ TestPartResultReporterInterface {
150
+ public:
151
+ virtual ~TestPartResultReporterInterface() {}
152
+
153
+ virtual void ReportTestPartResult(const TestPartResult& result) = 0;
154
+ };
155
+
156
+ namespace internal {
157
+
158
+ // This helper class is used by {ASSERT|EXPECT}_NO_FATAL_FAILURE to check if a
159
+ // statement generates new fatal failures. To do so it registers itself as the
160
+ // current test part result reporter. Besides checking if fatal failures were
161
+ // reported, it only delegates the reporting to the former result reporter.
162
+ // The original result reporter is restored in the destructor.
163
+ // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
164
+ class GTEST_API_ HasNewFatalFailureHelper
165
+ : public TestPartResultReporterInterface {
166
+ public:
167
+ HasNewFatalFailureHelper();
168
+ ~HasNewFatalFailureHelper() override;
169
+ void ReportTestPartResult(const TestPartResult& result) override;
170
+ bool has_new_fatal_failure() const { return has_new_fatal_failure_; }
171
+ private:
172
+ bool has_new_fatal_failure_;
173
+ TestPartResultReporterInterface* original_reporter_;
174
+
175
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(HasNewFatalFailureHelper);
176
+ };
177
+
178
+ } // namespace internal
179
+
180
+ } // namespace testing
181
+
182
+ GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
183
+
184
+ #endif // GOOGLETEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
data/miniconda3/include/gtest/gtest-typed-test.h ADDED
@@ -0,0 +1,329 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright 2008 Google Inc.
2
+ // All Rights Reserved.
3
+ //
4
+ // Redistribution and use in source and binary forms, with or without
5
+ // modification, are permitted provided that the following conditions are
6
+ // met:
7
+ //
8
+ // * Redistributions of source code must retain the above copyright
9
+ // notice, this list of conditions and the following disclaimer.
10
+ // * Redistributions in binary form must reproduce the above
11
+ // copyright notice, this list of conditions and the following disclaimer
12
+ // in the documentation and/or other materials provided with the
13
+ // distribution.
14
+ // * Neither the name of Google Inc. nor the names of its
15
+ // contributors may be used to endorse or promote products derived from
16
+ // this software without specific prior written permission.
17
+ //
18
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+
30
+ // GOOGLETEST_CM0001 DO NOT DELETE
31
+
32
+ #ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
33
+ #define GOOGLETEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
34
+
35
+ // This header implements typed tests and type-parameterized tests.
36
+
37
+ // Typed (aka type-driven) tests repeat the same test for types in a
38
+ // list. You must know which types you want to test with when writing
39
+ // typed tests. Here's how you do it:
40
+
41
+ #if 0
42
+
43
+ // First, define a fixture class template. It should be parameterized
44
+ // by a type. Remember to derive it from testing::Test.
45
+ template <typename T>
46
+ class FooTest : public testing::Test {
47
+ public:
48
+ ...
49
+ typedef std::list<T> List;
50
+ static T shared_;
51
+ T value_;
52
+ };
53
+
54
+ // Next, associate a list of types with the test suite, which will be
55
+ // repeated for each type in the list. The typedef is necessary for
56
+ // the macro to parse correctly.
57
+ typedef testing::Types<char, int, unsigned int> MyTypes;
58
+ TYPED_TEST_SUITE(FooTest, MyTypes);
59
+
60
+ // If the type list contains only one type, you can write that type
61
+ // directly without Types<...>:
62
+ // TYPED_TEST_SUITE(FooTest, int);
63
+
64
+ // Then, use TYPED_TEST() instead of TEST_F() to define as many typed
65
+ // tests for this test suite as you want.
66
+ TYPED_TEST(FooTest, DoesBlah) {
67
+ // Inside a test, refer to the special name TypeParam to get the type
68
+ // parameter. Since we are inside a derived class template, C++ requires
69
+ // us to visit the members of FooTest via 'this'.
70
+ TypeParam n = this->value_;
71
+
72
+ // To visit static members of the fixture, add the TestFixture::
73
+ // prefix.
74
+ n += TestFixture::shared_;
75
+
76
+ // To refer to typedefs in the fixture, add the "typename
77
+ // TestFixture::" prefix.
78
+ typename TestFixture::List values;
79
+ values.push_back(n);
80
+ ...
81
+ }
82
+
83
+ TYPED_TEST(FooTest, HasPropertyA) { ... }
84
+
85
+ // TYPED_TEST_SUITE takes an optional third argument which allows to specify a
86
+ // class that generates custom test name suffixes based on the type. This should
87
+ // be a class which has a static template function GetName(int index) returning
88
+ // a string for each type. The provided integer index equals the index of the
89
+ // type in the provided type list. In many cases the index can be ignored.
90
+ //
91
+ // For example:
92
+ // class MyTypeNames {
93
+ // public:
94
+ // template <typename T>
95
+ // static std::string GetName(int) {
96
+ // if (std::is_same<T, char>()) return "char";
97
+ // if (std::is_same<T, int>()) return "int";
98
+ // if (std::is_same<T, unsigned int>()) return "unsignedInt";
99
+ // }
100
+ // };
101
+ // TYPED_TEST_SUITE(FooTest, MyTypes, MyTypeNames);
102
+
103
+ #endif // 0
104
+
105
+ // Type-parameterized tests are abstract test patterns parameterized
106
+ // by a type. Compared with typed tests, type-parameterized tests
107
+ // allow you to define the test pattern without knowing what the type
108
+ // parameters are. The defined pattern can be instantiated with
109
+ // different types any number of times, in any number of translation
110
+ // units.
111
+ //
112
+ // If you are designing an interface or concept, you can define a
113
+ // suite of type-parameterized tests to verify properties that any
114
+ // valid implementation of the interface/concept should have. Then,
115
+ // each implementation can easily instantiate the test suite to verify
116
+ // that it conforms to the requirements, without having to write
117
+ // similar tests repeatedly. Here's an example:
118
+
119
+ #if 0
120
+
121
+ // First, define a fixture class template. It should be parameterized
122
+ // by a type. Remember to derive it from testing::Test.
123
+ template <typename T>
124
+ class FooTest : public testing::Test {
125
+ ...
126
+ };
127
+
128
+ // Next, declare that you will define a type-parameterized test suite
129
+ // (the _P suffix is for "parameterized" or "pattern", whichever you
130
+ // prefer):
131
+ TYPED_TEST_SUITE_P(FooTest);
132
+
133
+ // Then, use TYPED_TEST_P() to define as many type-parameterized tests
134
+ // for this type-parameterized test suite as you want.
135
+ TYPED_TEST_P(FooTest, DoesBlah) {
136
+ // Inside a test, refer to TypeParam to get the type parameter.
137
+ TypeParam n = 0;
138
+ ...
139
+ }
140
+
141
+ TYPED_TEST_P(FooTest, HasPropertyA) { ... }
142
+
143
+ // Now the tricky part: you need to register all test patterns before
144
+ // you can instantiate them. The first argument of the macro is the
145
+ // test suite name; the rest are the names of the tests in this test
146
+ // case.
147
+ REGISTER_TYPED_TEST_SUITE_P(FooTest,
148
+ DoesBlah, HasPropertyA);
149
+
150
+ // Finally, you are free to instantiate the pattern with the types you
151
+ // want. If you put the above code in a header file, you can #include
152
+ // it in multiple C++ source files and instantiate it multiple times.
153
+ //
154
+ // To distinguish different instances of the pattern, the first
155
+ // argument to the INSTANTIATE_* macro is a prefix that will be added
156
+ // to the actual test suite name. Remember to pick unique prefixes for
157
+ // different instances.
158
+ typedef testing::Types<char, int, unsigned int> MyTypes;
159
+ INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes);
160
+
161
+ // If the type list contains only one type, you can write that type
162
+ // directly without Types<...>:
163
+ // INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, int);
164
+ //
165
+ // Similar to the optional argument of TYPED_TEST_SUITE above,
166
+ // INSTANTIATE_TEST_SUITE_P takes an optional fourth argument which allows to
167
+ // generate custom names.
168
+ // INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes, MyTypeNames);
169
+
170
+ #endif // 0
171
+
172
+ #include "gtest/internal/gtest-internal.h"
173
+ #include "gtest/internal/gtest-port.h"
174
+ #include "gtest/internal/gtest-type-util.h"
175
+
176
+ // Implements typed tests.
177
+
178
+ // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
179
+ //
180
+ // Expands to the name of the typedef for the type parameters of the
181
+ // given test suite.
182
+ #define GTEST_TYPE_PARAMS_(TestSuiteName) gtest_type_params_##TestSuiteName##_
183
+
184
+ // Expands to the name of the typedef for the NameGenerator, responsible for
185
+ // creating the suffixes of the name.
186
+ #define GTEST_NAME_GENERATOR_(TestSuiteName) \
187
+ gtest_type_params_##TestSuiteName##_NameGenerator
188
+
189
+ #define TYPED_TEST_SUITE(CaseName, Types, ...) \
190
+ typedef ::testing::internal::GenerateTypeList<Types>::type \
191
+ GTEST_TYPE_PARAMS_(CaseName); \
192
+ typedef ::testing::internal::NameGeneratorSelector<__VA_ARGS__>::type \
193
+ GTEST_NAME_GENERATOR_(CaseName)
194
+
195
+ #define TYPED_TEST(CaseName, TestName) \
196
+ static_assert(sizeof(GTEST_STRINGIFY_(TestName)) > 1, \
197
+ "test-name must not be empty"); \
198
+ template <typename gtest_TypeParam_> \
199
+ class GTEST_TEST_CLASS_NAME_(CaseName, TestName) \
200
+ : public CaseName<gtest_TypeParam_> { \
201
+ private: \
202
+ typedef CaseName<gtest_TypeParam_> TestFixture; \
203
+ typedef gtest_TypeParam_ TypeParam; \
204
+ void TestBody() override; \
205
+ }; \
206
+ static bool gtest_##CaseName##_##TestName##_registered_ \
207
+ GTEST_ATTRIBUTE_UNUSED_ = ::testing::internal::TypeParameterizedTest< \
208
+ CaseName, \
209
+ ::testing::internal::TemplateSel<GTEST_TEST_CLASS_NAME_(CaseName, \
210
+ TestName)>, \
211
+ GTEST_TYPE_PARAMS_( \
212
+ CaseName)>::Register("", \
213
+ ::testing::internal::CodeLocation( \
214
+ __FILE__, __LINE__), \
215
+ GTEST_STRINGIFY_(CaseName), \
216
+ GTEST_STRINGIFY_(TestName), 0, \
217
+ ::testing::internal::GenerateNames< \
218
+ GTEST_NAME_GENERATOR_(CaseName), \
219
+ GTEST_TYPE_PARAMS_(CaseName)>()); \
220
+ template <typename gtest_TypeParam_> \
221
+ void GTEST_TEST_CLASS_NAME_(CaseName, \
222
+ TestName)<gtest_TypeParam_>::TestBody()
223
+
224
+ // Legacy API is deprecated but still available
225
+ #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
226
+ #define TYPED_TEST_CASE \
227
+ static_assert(::testing::internal::TypedTestCaseIsDeprecated(), ""); \
228
+ TYPED_TEST_SUITE
229
+ #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
230
+
231
+ // Implements type-parameterized tests.
232
+
233
+ // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
234
+ //
235
+ // Expands to the namespace name that the type-parameterized tests for
236
+ // the given type-parameterized test suite are defined in. The exact
237
+ // name of the namespace is subject to change without notice.
238
+ #define GTEST_SUITE_NAMESPACE_(TestSuiteName) gtest_suite_##TestSuiteName##_
239
+
240
+ // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
241
+ //
242
+ // Expands to the name of the variable used to remember the names of
243
+ // the defined tests in the given test suite.
244
+ #define GTEST_TYPED_TEST_SUITE_P_STATE_(TestSuiteName) \
245
+ gtest_typed_test_suite_p_state_##TestSuiteName##_
246
+
247
+ // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE DIRECTLY.
248
+ //
249
+ // Expands to the name of the variable used to remember the names of
250
+ // the registered tests in the given test suite.
251
+ #define GTEST_REGISTERED_TEST_NAMES_(TestSuiteName) \
252
+ gtest_registered_test_names_##TestSuiteName##_
253
+
254
+ // The variables defined in the type-parameterized test macros are
255
+ // static as typically these macros are used in a .h file that can be
256
+ // #included in multiple translation units linked together.
257
+ #define TYPED_TEST_SUITE_P(SuiteName) \
258
+ static ::testing::internal::TypedTestSuitePState \
259
+ GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName)
260
+
261
+ // Legacy API is deprecated but still available
262
+ #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
263
+ #define TYPED_TEST_CASE_P \
264
+ static_assert(::testing::internal::TypedTestCase_P_IsDeprecated(), ""); \
265
+ TYPED_TEST_SUITE_P
266
+ #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
267
+
268
+ #define TYPED_TEST_P(SuiteName, TestName) \
269
+ namespace GTEST_SUITE_NAMESPACE_(SuiteName) { \
270
+ template <typename gtest_TypeParam_> \
271
+ class TestName : public SuiteName<gtest_TypeParam_> { \
272
+ private: \
273
+ typedef SuiteName<gtest_TypeParam_> TestFixture; \
274
+ typedef gtest_TypeParam_ TypeParam; \
275
+ void TestBody() override; \
276
+ }; \
277
+ static bool gtest_##TestName##_defined_ GTEST_ATTRIBUTE_UNUSED_ = \
278
+ GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName).AddTestName( \
279
+ __FILE__, __LINE__, GTEST_STRINGIFY_(SuiteName), \
280
+ GTEST_STRINGIFY_(TestName)); \
281
+ } \
282
+ template <typename gtest_TypeParam_> \
283
+ void GTEST_SUITE_NAMESPACE_( \
284
+ SuiteName)::TestName<gtest_TypeParam_>::TestBody()
285
+
286
+ // Note: this won't work correctly if the trailing arguments are macros.
287
+ #define REGISTER_TYPED_TEST_SUITE_P(SuiteName, ...) \
288
+ namespace GTEST_SUITE_NAMESPACE_(SuiteName) { \
289
+ typedef ::testing::internal::Templates<__VA_ARGS__> gtest_AllTests_; \
290
+ } \
291
+ static const char* const GTEST_REGISTERED_TEST_NAMES_( \
292
+ SuiteName) GTEST_ATTRIBUTE_UNUSED_ = \
293
+ GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName).VerifyRegisteredTestNames( \
294
+ GTEST_STRINGIFY_(SuiteName), __FILE__, __LINE__, #__VA_ARGS__)
295
+
296
+ // Legacy API is deprecated but still available
297
+ #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
298
+ #define REGISTER_TYPED_TEST_CASE_P \
299
+ static_assert(::testing::internal::RegisterTypedTestCase_P_IsDeprecated(), \
300
+ ""); \
301
+ REGISTER_TYPED_TEST_SUITE_P
302
+ #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
303
+
304
+ #define INSTANTIATE_TYPED_TEST_SUITE_P(Prefix, SuiteName, Types, ...) \
305
+ static_assert(sizeof(GTEST_STRINGIFY_(Prefix)) > 1, \
306
+ "test-suit-prefix must not be empty"); \
307
+ static bool gtest_##Prefix##_##SuiteName GTEST_ATTRIBUTE_UNUSED_ = \
308
+ ::testing::internal::TypeParameterizedTestSuite< \
309
+ SuiteName, GTEST_SUITE_NAMESPACE_(SuiteName)::gtest_AllTests_, \
310
+ ::testing::internal::GenerateTypeList<Types>::type>:: \
311
+ Register(GTEST_STRINGIFY_(Prefix), \
312
+ ::testing::internal::CodeLocation(__FILE__, __LINE__), \
313
+ &GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName), \
314
+ GTEST_STRINGIFY_(SuiteName), \
315
+ GTEST_REGISTERED_TEST_NAMES_(SuiteName), \
316
+ ::testing::internal::GenerateNames< \
317
+ ::testing::internal::NameGeneratorSelector< \
318
+ __VA_ARGS__>::type, \
319
+ ::testing::internal::GenerateTypeList<Types>::type>())
320
+
321
+ // Legacy API is deprecated but still available
322
+ #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
323
+ #define INSTANTIATE_TYPED_TEST_CASE_P \
324
+ static_assert( \
325
+ ::testing::internal::InstantiateTypedTestCase_P_IsDeprecated(), ""); \
326
+ INSTANTIATE_TYPED_TEST_SUITE_P
327
+ #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
328
+
329
+ #endif // GOOGLETEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
data/miniconda3/include/gtest/gtest.h ADDED
@@ -0,0 +1,2495 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright 2005, Google Inc.
2
+ // All rights reserved.
3
+ //
4
+ // Redistribution and use in source and binary forms, with or without
5
+ // modification, are permitted provided that the following conditions are
6
+ // met:
7
+ //
8
+ // * Redistributions of source code must retain the above copyright
9
+ // notice, this list of conditions and the following disclaimer.
10
+ // * Redistributions in binary form must reproduce the above
11
+ // copyright notice, this list of conditions and the following disclaimer
12
+ // in the documentation and/or other materials provided with the
13
+ // distribution.
14
+ // * Neither the name of Google Inc. nor the names of its
15
+ // contributors may be used to endorse or promote products derived from
16
+ // this software without specific prior written permission.
17
+ //
18
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+
30
+ //
31
+ // The Google C++ Testing and Mocking Framework (Google Test)
32
+ //
33
+ // This header file defines the public API for Google Test. It should be
34
+ // included by any test program that uses Google Test.
35
+ //
36
+ // IMPORTANT NOTE: Due to limitation of the C++ language, we have to
37
+ // leave some internal implementation details in this header file.
38
+ // They are clearly marked by comments like this:
39
+ //
40
+ // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
41
+ //
42
+ // Such code is NOT meant to be used by a user directly, and is subject
43
+ // to CHANGE WITHOUT NOTICE. Therefore DO NOT DEPEND ON IT in a user
44
+ // program!
45
+ //
46
+ // Acknowledgment: Google Test borrowed the idea of automatic test
47
+ // registration from Barthelemy Dagenais' (barthelemy@prologique.com)
48
+ // easyUnit framework.
49
+
50
+ // GOOGLETEST_CM0001 DO NOT DELETE
51
+
52
+ #ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_H_
53
+ #define GOOGLETEST_INCLUDE_GTEST_GTEST_H_
54
+
55
+ #include <cstddef>
56
+ #include <limits>
57
+ #include <memory>
58
+ #include <ostream>
59
+ #include <type_traits>
60
+ #include <vector>
61
+
62
+ #include "gtest/internal/gtest-internal.h"
63
+ #include "gtest/internal/gtest-string.h"
64
+ #include "gtest/gtest-death-test.h"
65
+ #include "gtest/gtest-matchers.h"
66
+ #include "gtest/gtest-message.h"
67
+ #include "gtest/gtest-param-test.h"
68
+ #include "gtest/gtest-printers.h"
69
+ #include "gtest/gtest_prod.h"
70
+ #include "gtest/gtest-test-part.h"
71
+ #include "gtest/gtest-typed-test.h"
72
+
73
+ GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
74
+ /* class A needs to have dll-interface to be used by clients of class B */)
75
+
76
+ namespace testing {
77
+
78
+ // Silence C4100 (unreferenced formal parameter) and 4805
79
+ // unsafe mix of type 'const int' and type 'const bool'
80
+ #ifdef _MSC_VER
81
+ # pragma warning(push)
82
+ # pragma warning(disable:4805)
83
+ # pragma warning(disable:4100)
84
+ #endif
85
+
86
+
87
+ // Declares the flags.
88
+
89
+ // This flag temporary enables the disabled tests.
90
+ GTEST_DECLARE_bool_(also_run_disabled_tests);
91
+
92
+ // This flag brings the debugger on an assertion failure.
93
+ GTEST_DECLARE_bool_(break_on_failure);
94
+
95
+ // This flag controls whether Google Test catches all test-thrown exceptions
96
+ // and logs them as failures.
97
+ GTEST_DECLARE_bool_(catch_exceptions);
98
+
99
+ // This flag enables using colors in terminal output. Available values are
100
+ // "yes" to enable colors, "no" (disable colors), or "auto" (the default)
101
+ // to let Google Test decide.
102
+ GTEST_DECLARE_string_(color);
103
+
104
+ // This flag controls whether the test runner should continue execution past
105
+ // first failure.
106
+ GTEST_DECLARE_bool_(fail_fast);
107
+
108
+ // This flag sets up the filter to select by name using a glob pattern
109
+ // the tests to run. If the filter is not given all tests are executed.
110
+ GTEST_DECLARE_string_(filter);
111
+
112
+ // This flag controls whether Google Test installs a signal handler that dumps
113
+ // debugging information when fatal signals are raised.
114
+ GTEST_DECLARE_bool_(install_failure_signal_handler);
115
+
116
+ // This flag causes the Google Test to list tests. None of the tests listed
117
+ // are actually run if the flag is provided.
118
+ GTEST_DECLARE_bool_(list_tests);
119
+
120
+ // This flag controls whether Google Test emits a detailed XML report to a file
121
+ // in addition to its normal textual output.
122
+ GTEST_DECLARE_string_(output);
123
+
124
+ // This flags control whether Google Test prints only test failures.
125
+ GTEST_DECLARE_bool_(brief);
126
+
127
+ // This flags control whether Google Test prints the elapsed time for each
128
+ // test.
129
+ GTEST_DECLARE_bool_(print_time);
130
+
131
+ // This flags control whether Google Test prints UTF8 characters as text.
132
+ GTEST_DECLARE_bool_(print_utf8);
133
+
134
+ // This flag specifies the random number seed.
135
+ GTEST_DECLARE_int32_(random_seed);
136
+
137
+ // This flag sets how many times the tests are repeated. The default value
138
+ // is 1. If the value is -1 the tests are repeating forever.
139
+ GTEST_DECLARE_int32_(repeat);
140
+
141
+ // This flag controls whether Google Test includes Google Test internal
142
+ // stack frames in failure stack traces.
143
+ GTEST_DECLARE_bool_(show_internal_stack_frames);
144
+
145
+ // When this flag is specified, tests' order is randomized on every iteration.
146
+ GTEST_DECLARE_bool_(shuffle);
147
+
148
+ // This flag specifies the maximum number of stack frames to be
149
+ // printed in a failure message.
150
+ GTEST_DECLARE_int32_(stack_trace_depth);
151
+
152
+ // When this flag is specified, a failed assertion will throw an
153
+ // exception if exceptions are enabled, or exit the program with a
154
+ // non-zero code otherwise. For use with an external test framework.
155
+ GTEST_DECLARE_bool_(throw_on_failure);
156
+
157
+ // When this flag is set with a "host:port" string, on supported
158
+ // platforms test results are streamed to the specified port on
159
+ // the specified host machine.
160
+ GTEST_DECLARE_string_(stream_result_to);
161
+
162
+ #if GTEST_USE_OWN_FLAGFILE_FLAG_
163
+ GTEST_DECLARE_string_(flagfile);
164
+ #endif // GTEST_USE_OWN_FLAGFILE_FLAG_
165
+
166
+ // The upper limit for valid stack trace depths.
167
+ const int kMaxStackTraceDepth = 100;
168
+
169
+ namespace internal {
170
+
171
+ class AssertHelper;
172
+ class DefaultGlobalTestPartResultReporter;
173
+ class ExecDeathTest;
174
+ class NoExecDeathTest;
175
+ class FinalSuccessChecker;
176
+ class GTestFlagSaver;
177
+ class StreamingListenerTest;
178
+ class TestResultAccessor;
179
+ class TestEventListenersAccessor;
180
+ class TestEventRepeater;
181
+ class UnitTestRecordPropertyTestHelper;
182
+ class WindowsDeathTest;
183
+ class FuchsiaDeathTest;
184
+ class UnitTestImpl* GetUnitTestImpl();
185
+ void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
186
+ const std::string& message);
187
+ std::set<std::string>* GetIgnoredParameterizedTestSuites();
188
+
189
+ } // namespace internal
190
+
191
+ // The friend relationship of some of these classes is cyclic.
192
+ // If we don't forward declare them the compiler might confuse the classes
193
+ // in friendship clauses with same named classes on the scope.
194
+ class Test;
195
+ class TestSuite;
196
+
197
+ // Old API is still available but deprecated
198
+ #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
199
+ using TestCase = TestSuite;
200
+ #endif
201
+ class TestInfo;
202
+ class UnitTest;
203
+
204
+ // A class for indicating whether an assertion was successful. When
205
+ // the assertion wasn't successful, the AssertionResult object
206
+ // remembers a non-empty message that describes how it failed.
207
+ //
208
+ // To create an instance of this class, use one of the factory functions
209
+ // (AssertionSuccess() and AssertionFailure()).
210
+ //
211
+ // This class is useful for two purposes:
212
+ // 1. Defining predicate functions to be used with Boolean test assertions
213
+ // EXPECT_TRUE/EXPECT_FALSE and their ASSERT_ counterparts
214
+ // 2. Defining predicate-format functions to be
215
+ // used with predicate assertions (ASSERT_PRED_FORMAT*, etc).
216
+ //
217
+ // For example, if you define IsEven predicate:
218
+ //
219
+ // testing::AssertionResult IsEven(int n) {
220
+ // if ((n % 2) == 0)
221
+ // return testing::AssertionSuccess();
222
+ // else
223
+ // return testing::AssertionFailure() << n << " is odd";
224
+ // }
225
+ //
226
+ // Then the failed expectation EXPECT_TRUE(IsEven(Fib(5)))
227
+ // will print the message
228
+ //
229
+ // Value of: IsEven(Fib(5))
230
+ // Actual: false (5 is odd)
231
+ // Expected: true
232
+ //
233
+ // instead of a more opaque
234
+ //
235
+ // Value of: IsEven(Fib(5))
236
+ // Actual: false
237
+ // Expected: true
238
+ //
239
+ // in case IsEven is a simple Boolean predicate.
240
+ //
241
+ // If you expect your predicate to be reused and want to support informative
242
+ // messages in EXPECT_FALSE and ASSERT_FALSE (negative assertions show up
243
+ // about half as often as positive ones in our tests), supply messages for
244
+ // both success and failure cases:
245
+ //
246
+ // testing::AssertionResult IsEven(int n) {
247
+ // if ((n % 2) == 0)
248
+ // return testing::AssertionSuccess() << n << " is even";
249
+ // else
250
+ // return testing::AssertionFailure() << n << " is odd";
251
+ // }
252
+ //
253
+ // Then a statement EXPECT_FALSE(IsEven(Fib(6))) will print
254
+ //
255
+ // Value of: IsEven(Fib(6))
256
+ // Actual: true (8 is even)
257
+ // Expected: false
258
+ //
259
+ // NB: Predicates that support negative Boolean assertions have reduced
260
+ // performance in positive ones so be careful not to use them in tests
261
+ // that have lots (tens of thousands) of positive Boolean assertions.
262
+ //
263
+ // To use this class with EXPECT_PRED_FORMAT assertions such as:
264
+ //
265
+ // // Verifies that Foo() returns an even number.
266
+ // EXPECT_PRED_FORMAT1(IsEven, Foo());
267
+ //
268
+ // you need to define:
269
+ //
270
+ // testing::AssertionResult IsEven(const char* expr, int n) {
271
+ // if ((n % 2) == 0)
272
+ // return testing::AssertionSuccess();
273
+ // else
274
+ // return testing::AssertionFailure()
275
+ // << "Expected: " << expr << " is even\n Actual: it's " << n;
276
+ // }
277
+ //
278
+ // If Foo() returns 5, you will see the following message:
279
+ //
280
+ // Expected: Foo() is even
281
+ // Actual: it's 5
282
+ //
283
+ class GTEST_API_ AssertionResult {
284
+ public:
285
+ // Copy constructor.
286
+ // Used in EXPECT_TRUE/FALSE(assertion_result).
287
+ AssertionResult(const AssertionResult& other);
288
+
289
+ // C4800 is a level 3 warning in Visual Studio 2015 and earlier.
290
+ // This warning is not emitted in Visual Studio 2017.
291
+ // This warning is off by default starting in Visual Studio 2019 but can be
292
+ // enabled with command-line options.
293
+ #if defined(_MSC_VER) && (_MSC_VER < 1910 || _MSC_VER >= 1920)
294
+ GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 /* forcing value to bool */)
295
+ #endif
296
+
297
+ // Used in the EXPECT_TRUE/FALSE(bool_expression).
298
+ //
299
+ // T must be contextually convertible to bool.
300
+ //
301
+ // The second parameter prevents this overload from being considered if
302
+ // the argument is implicitly convertible to AssertionResult. In that case
303
+ // we want AssertionResult's copy constructor to be used.
304
+ template <typename T>
305
+ explicit AssertionResult(
306
+ const T& success,
307
+ typename std::enable_if<
308
+ !std::is_convertible<T, AssertionResult>::value>::type*
309
+ /*enabler*/
310
+ = nullptr)
311
+ : success_(success) {}
312
+
313
+ #if defined(_MSC_VER) && (_MSC_VER < 1910 || _MSC_VER >= 1920)
314
+ GTEST_DISABLE_MSC_WARNINGS_POP_()
315
+ #endif
316
+
317
+ // Assignment operator.
318
+ AssertionResult& operator=(AssertionResult other) {
319
+ swap(other);
320
+ return *this;
321
+ }
322
+
323
+ // Returns true if and only if the assertion succeeded.
324
+ operator bool() const { return success_; } // NOLINT
325
+
326
+ // Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE.
327
+ AssertionResult operator!() const;
328
+
329
+ // Returns the text streamed into this AssertionResult. Test assertions
330
+ // use it when they fail (i.e., the predicate's outcome doesn't match the
331
+ // assertion's expectation). When nothing has been streamed into the
332
+ // object, returns an empty string.
333
+ const char* message() const {
334
+ return message_.get() != nullptr ? message_->c_str() : "";
335
+ }
336
+ // Deprecated; please use message() instead.
337
+ const char* failure_message() const { return message(); }
338
+
339
+ // Streams a custom failure message into this object.
340
+ template <typename T> AssertionResult& operator<<(const T& value) {
341
+ AppendMessage(Message() << value);
342
+ return *this;
343
+ }
344
+
345
+ // Allows streaming basic output manipulators such as endl or flush into
346
+ // this object.
347
+ AssertionResult& operator<<(
348
+ ::std::ostream& (*basic_manipulator)(::std::ostream& stream)) {
349
+ AppendMessage(Message() << basic_manipulator);
350
+ return *this;
351
+ }
352
+
353
+ private:
354
+ // Appends the contents of message to message_.
355
+ void AppendMessage(const Message& a_message) {
356
+ if (message_.get() == nullptr) message_.reset(new ::std::string);
357
+ message_->append(a_message.GetString().c_str());
358
+ }
359
+
360
+ // Swap the contents of this AssertionResult with other.
361
+ void swap(AssertionResult& other);
362
+
363
+ // Stores result of the assertion predicate.
364
+ bool success_;
365
+ // Stores the message describing the condition in case the expectation
366
+ // construct is not satisfied with the predicate's outcome.
367
+ // Referenced via a pointer to avoid taking too much stack frame space
368
+ // with test assertions.
369
+ std::unique_ptr< ::std::string> message_;
370
+ };
371
+
372
+ // Makes a successful assertion result.
373
+ GTEST_API_ AssertionResult AssertionSuccess();
374
+
375
+ // Makes a failed assertion result.
376
+ GTEST_API_ AssertionResult AssertionFailure();
377
+
378
+ // Makes a failed assertion result with the given failure message.
379
+ // Deprecated; use AssertionFailure() << msg.
380
+ GTEST_API_ AssertionResult AssertionFailure(const Message& msg);
381
+
382
+ } // namespace testing
383
+
384
+ // Includes the auto-generated header that implements a family of generic
385
+ // predicate assertion macros. This include comes late because it relies on
386
+ // APIs declared above.
387
+ #include "gtest/gtest_pred_impl.h"
388
+
389
+ namespace testing {
390
+
391
+ // The abstract class that all tests inherit from.
392
+ //
393
+ // In Google Test, a unit test program contains one or many TestSuites, and
394
+ // each TestSuite contains one or many Tests.
395
+ //
396
+ // When you define a test using the TEST macro, you don't need to
397
+ // explicitly derive from Test - the TEST macro automatically does
398
+ // this for you.
399
+ //
400
+ // The only time you derive from Test is when defining a test fixture
401
+ // to be used in a TEST_F. For example:
402
+ //
403
+ // class FooTest : public testing::Test {
404
+ // protected:
405
+ // void SetUp() override { ... }
406
+ // void TearDown() override { ... }
407
+ // ...
408
+ // };
409
+ //
410
+ // TEST_F(FooTest, Bar) { ... }
411
+ // TEST_F(FooTest, Baz) { ... }
412
+ //
413
+ // Test is not copyable.
414
+ class GTEST_API_ Test {
415
+ public:
416
+ friend class TestInfo;
417
+
418
+ // The d'tor is virtual as we intend to inherit from Test.
419
+ virtual ~Test();
420
+
421
+ // Sets up the stuff shared by all tests in this test suite.
422
+ //
423
+ // Google Test will call Foo::SetUpTestSuite() before running the first
424
+ // test in test suite Foo. Hence a sub-class can define its own
425
+ // SetUpTestSuite() method to shadow the one defined in the super
426
+ // class.
427
+ static void SetUpTestSuite() {}
428
+
429
+ // Tears down the stuff shared by all tests in this test suite.
430
+ //
431
+ // Google Test will call Foo::TearDownTestSuite() after running the last
432
+ // test in test suite Foo. Hence a sub-class can define its own
433
+ // TearDownTestSuite() method to shadow the one defined in the super
434
+ // class.
435
+ static void TearDownTestSuite() {}
436
+
437
+ // Legacy API is deprecated but still available. Use SetUpTestSuite and
438
+ // TearDownTestSuite instead.
439
+ #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
440
+ static void TearDownTestCase() {}
441
+ static void SetUpTestCase() {}
442
+ #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
443
+
444
+ // Returns true if and only if the current test has a fatal failure.
445
+ static bool HasFatalFailure();
446
+
447
+ // Returns true if and only if the current test has a non-fatal failure.
448
+ static bool HasNonfatalFailure();
449
+
450
+ // Returns true if and only if the current test was skipped.
451
+ static bool IsSkipped();
452
+
453
+ // Returns true if and only if the current test has a (either fatal or
454
+ // non-fatal) failure.
455
+ static bool HasFailure() { return HasFatalFailure() || HasNonfatalFailure(); }
456
+
457
+ // Logs a property for the current test, test suite, or for the entire
458
+ // invocation of the test program when used outside of the context of a
459
+ // test suite. Only the last value for a given key is remembered. These
460
+ // are public static so they can be called from utility functions that are
461
+ // not members of the test fixture. Calls to RecordProperty made during
462
+ // lifespan of the test (from the moment its constructor starts to the
463
+ // moment its destructor finishes) will be output in XML as attributes of
464
+ // the <testcase> element. Properties recorded from fixture's
465
+ // SetUpTestSuite or TearDownTestSuite are logged as attributes of the
466
+ // corresponding <testsuite> element. Calls to RecordProperty made in the
467
+ // global context (before or after invocation of RUN_ALL_TESTS and from
468
+ // SetUp/TearDown method of Environment objects registered with Google
469
+ // Test) will be output as attributes of the <testsuites> element.
470
+ static void RecordProperty(const std::string& key, const std::string& value);
471
+ static void RecordProperty(const std::string& key, int value);
472
+
473
+ protected:
474
+ // Creates a Test object.
475
+ Test();
476
+
477
+ // Sets up the test fixture.
478
+ virtual void SetUp();
479
+
480
+ // Tears down the test fixture.
481
+ virtual void TearDown();
482
+
483
+ private:
484
+ // Returns true if and only if the current test has the same fixture class
485
+ // as the first test in the current test suite.
486
+ static bool HasSameFixtureClass();
487
+
488
+ // Runs the test after the test fixture has been set up.
489
+ //
490
+ // A sub-class must implement this to define the test logic.
491
+ //
492
+ // DO NOT OVERRIDE THIS FUNCTION DIRECTLY IN A USER PROGRAM.
493
+ // Instead, use the TEST or TEST_F macro.
494
+ virtual void TestBody() = 0;
495
+
496
+ // Sets up, executes, and tears down the test.
497
+ void Run();
498
+
499
+ // Deletes self. We deliberately pick an unusual name for this
500
+ // internal method to avoid clashing with names used in user TESTs.
501
+ void DeleteSelf_() { delete this; }
502
+
503
+ const std::unique_ptr<GTEST_FLAG_SAVER_> gtest_flag_saver_;
504
+
505
+ // Often a user misspells SetUp() as Setup() and spends a long time
506
+ // wondering why it is never called by Google Test. The declaration of
507
+ // the following method is solely for catching such an error at
508
+ // compile time:
509
+ //
510
+ // - The return type is deliberately chosen to be not void, so it
511
+ // will be a conflict if void Setup() is declared in the user's
512
+ // test fixture.
513
+ //
514
+ // - This method is private, so it will be another compiler error
515
+ // if the method is called from the user's test fixture.
516
+ //
517
+ // DO NOT OVERRIDE THIS FUNCTION.
518
+ //
519
+ // If you see an error about overriding the following function or
520
+ // about it being private, you have mis-spelled SetUp() as Setup().
521
+ struct Setup_should_be_spelled_SetUp {};
522
+ virtual Setup_should_be_spelled_SetUp* Setup() { return nullptr; }
523
+
524
+ // We disallow copying Tests.
525
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(Test);
526
+ };
527
+
528
+ typedef internal::TimeInMillis TimeInMillis;
529
+
530
+ // A copyable object representing a user specified test property which can be
531
+ // output as a key/value string pair.
532
+ //
533
+ // Don't inherit from TestProperty as its destructor is not virtual.
534
+ class TestProperty {
535
+ public:
536
+ // C'tor. TestProperty does NOT have a default constructor.
537
+ // Always use this constructor (with parameters) to create a
538
+ // TestProperty object.
539
+ TestProperty(const std::string& a_key, const std::string& a_value) :
540
+ key_(a_key), value_(a_value) {
541
+ }
542
+
543
+ // Gets the user supplied key.
544
+ const char* key() const {
545
+ return key_.c_str();
546
+ }
547
+
548
+ // Gets the user supplied value.
549
+ const char* value() const {
550
+ return value_.c_str();
551
+ }
552
+
553
+ // Sets a new value, overriding the one supplied in the constructor.
554
+ void SetValue(const std::string& new_value) {
555
+ value_ = new_value;
556
+ }
557
+
558
+ private:
559
+ // The key supplied by the user.
560
+ std::string key_;
561
+ // The value supplied by the user.
562
+ std::string value_;
563
+ };
564
+
565
+ // The result of a single Test. This includes a list of
566
+ // TestPartResults, a list of TestProperties, a count of how many
567
+ // death tests there are in the Test, and how much time it took to run
568
+ // the Test.
569
+ //
570
+ // TestResult is not copyable.
571
+ class GTEST_API_ TestResult {
572
+ public:
573
+ // Creates an empty TestResult.
574
+ TestResult();
575
+
576
+ // D'tor. Do not inherit from TestResult.
577
+ ~TestResult();
578
+
579
+ // Gets the number of all test parts. This is the sum of the number
580
+ // of successful test parts and the number of failed test parts.
581
+ int total_part_count() const;
582
+
583
+ // Returns the number of the test properties.
584
+ int test_property_count() const;
585
+
586
+ // Returns true if and only if the test passed (i.e. no test part failed).
587
+ bool Passed() const { return !Skipped() && !Failed(); }
588
+
589
+ // Returns true if and only if the test was skipped.
590
+ bool Skipped() const;
591
+
592
+ // Returns true if and only if the test failed.
593
+ bool Failed() const;
594
+
595
+ // Returns true if and only if the test fatally failed.
596
+ bool HasFatalFailure() const;
597
+
598
+ // Returns true if and only if the test has a non-fatal failure.
599
+ bool HasNonfatalFailure() const;
600
+
601
+ // Returns the elapsed time, in milliseconds.
602
+ TimeInMillis elapsed_time() const { return elapsed_time_; }
603
+
604
+ // Gets the time of the test case start, in ms from the start of the
605
+ // UNIX epoch.
606
+ TimeInMillis start_timestamp() const { return start_timestamp_; }
607
+
608
+ // Returns the i-th test part result among all the results. i can range from 0
609
+ // to total_part_count() - 1. If i is not in that range, aborts the program.
610
+ const TestPartResult& GetTestPartResult(int i) const;
611
+
612
+ // Returns the i-th test property. i can range from 0 to
613
+ // test_property_count() - 1. If i is not in that range, aborts the
614
+ // program.
615
+ const TestProperty& GetTestProperty(int i) const;
616
+
617
+ private:
618
+ friend class TestInfo;
619
+ friend class TestSuite;
620
+ friend class UnitTest;
621
+ friend class internal::DefaultGlobalTestPartResultReporter;
622
+ friend class internal::ExecDeathTest;
623
+ friend class internal::TestResultAccessor;
624
+ friend class internal::UnitTestImpl;
625
+ friend class internal::WindowsDeathTest;
626
+ friend class internal::FuchsiaDeathTest;
627
+
628
+ // Gets the vector of TestPartResults.
629
+ const std::vector<TestPartResult>& test_part_results() const {
630
+ return test_part_results_;
631
+ }
632
+
633
+ // Gets the vector of TestProperties.
634
+ const std::vector<TestProperty>& test_properties() const {
635
+ return test_properties_;
636
+ }
637
+
638
+ // Sets the start time.
639
+ void set_start_timestamp(TimeInMillis start) { start_timestamp_ = start; }
640
+
641
+ // Sets the elapsed time.
642
+ void set_elapsed_time(TimeInMillis elapsed) { elapsed_time_ = elapsed; }
643
+
644
+ // Adds a test property to the list. The property is validated and may add
645
+ // a non-fatal failure if invalid (e.g., if it conflicts with reserved
646
+ // key names). If a property is already recorded for the same key, the
647
+ // value will be updated, rather than storing multiple values for the same
648
+ // key. xml_element specifies the element for which the property is being
649
+ // recorded and is used for validation.
650
+ void RecordProperty(const std::string& xml_element,
651
+ const TestProperty& test_property);
652
+
653
+ // Adds a failure if the key is a reserved attribute of Google Test
654
+ // testsuite tags. Returns true if the property is valid.
655
+ // FIXME: Validate attribute names are legal and human readable.
656
+ static bool ValidateTestProperty(const std::string& xml_element,
657
+ const TestProperty& test_property);
658
+
659
+ // Adds a test part result to the list.
660
+ void AddTestPartResult(const TestPartResult& test_part_result);
661
+
662
+ // Returns the death test count.
663
+ int death_test_count() const { return death_test_count_; }
664
+
665
+ // Increments the death test count, returning the new count.
666
+ int increment_death_test_count() { return ++death_test_count_; }
667
+
668
+ // Clears the test part results.
669
+ void ClearTestPartResults();
670
+
671
+ // Clears the object.
672
+ void Clear();
673
+
674
+ // Protects mutable state of the property vector and of owned
675
+ // properties, whose values may be updated.
676
+ internal::Mutex test_properties_mutex_;
677
+
678
+ // The vector of TestPartResults
679
+ std::vector<TestPartResult> test_part_results_;
680
+ // The vector of TestProperties
681
+ std::vector<TestProperty> test_properties_;
682
+ // Running count of death tests.
683
+ int death_test_count_;
684
+ // The start time, in milliseconds since UNIX Epoch.
685
+ TimeInMillis start_timestamp_;
686
+ // The elapsed time, in milliseconds.
687
+ TimeInMillis elapsed_time_;
688
+
689
+ // We disallow copying TestResult.
690
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(TestResult);
691
+ }; // class TestResult
692
+
693
+ // A TestInfo object stores the following information about a test:
694
+ //
695
+ // Test suite name
696
+ // Test name
697
+ // Whether the test should be run
698
+ // A function pointer that creates the test object when invoked
699
+ // Test result
700
+ //
701
+ // The constructor of TestInfo registers itself with the UnitTest
702
+ // singleton such that the RUN_ALL_TESTS() macro knows which tests to
703
+ // run.
704
+ class GTEST_API_ TestInfo {
705
+ public:
706
+ // Destructs a TestInfo object. This function is not virtual, so
707
+ // don't inherit from TestInfo.
708
+ ~TestInfo();
709
+
710
+ // Returns the test suite name.
711
+ const char* test_suite_name() const { return test_suite_name_.c_str(); }
712
+
713
+ // Legacy API is deprecated but still available
714
+ #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
715
+ const char* test_case_name() const { return test_suite_name(); }
716
+ #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
717
+
718
+ // Returns the test name.
719
+ const char* name() const { return name_.c_str(); }
720
+
721
+ // Returns the name of the parameter type, or NULL if this is not a typed
722
+ // or a type-parameterized test.
723
+ const char* type_param() const {
724
+ if (type_param_.get() != nullptr) return type_param_->c_str();
725
+ return nullptr;
726
+ }
727
+
728
+ // Returns the text representation of the value parameter, or NULL if this
729
+ // is not a value-parameterized test.
730
+ const char* value_param() const {
731
+ if (value_param_.get() != nullptr) return value_param_->c_str();
732
+ return nullptr;
733
+ }
734
+
735
+ // Returns the file name where this test is defined.
736
+ const char* file() const { return location_.file.c_str(); }
737
+
738
+ // Returns the line where this test is defined.
739
+ int line() const { return location_.line; }
740
+
741
+ // Return true if this test should not be run because it's in another shard.
742
+ bool is_in_another_shard() const { return is_in_another_shard_; }
743
+
744
+ // Returns true if this test should run, that is if the test is not
745
+ // disabled (or it is disabled but the also_run_disabled_tests flag has
746
+ // been specified) and its full name matches the user-specified filter.
747
+ //
748
+ // Google Test allows the user to filter the tests by their full names.
749
+ // The full name of a test Bar in test suite Foo is defined as
750
+ // "Foo.Bar". Only the tests that match the filter will run.
751
+ //
752
+ // A filter is a colon-separated list of glob (not regex) patterns,
753
+ // optionally followed by a '-' and a colon-separated list of
754
+ // negative patterns (tests to exclude). A test is run if it
755
+ // matches one of the positive patterns and does not match any of
756
+ // the negative patterns.
757
+ //
758
+ // For example, *A*:Foo.* is a filter that matches any string that
759
+ // contains the character 'A' or starts with "Foo.".
760
+ bool should_run() const { return should_run_; }
761
+
762
+ // Returns true if and only if this test will appear in the XML report.
763
+ bool is_reportable() const {
764
+ // The XML report includes tests matching the filter, excluding those
765
+ // run in other shards.
766
+ return matches_filter_ && !is_in_another_shard_;
767
+ }
768
+
769
+ // Returns the result of the test.
770
+ const TestResult* result() const { return &result_; }
771
+
772
+ private:
773
+ #if GTEST_HAS_DEATH_TEST
774
+ friend class internal::DefaultDeathTestFactory;
775
+ #endif // GTEST_HAS_DEATH_TEST
776
+ friend class Test;
777
+ friend class TestSuite;
778
+ friend class internal::UnitTestImpl;
779
+ friend class internal::StreamingListenerTest;
780
+ friend TestInfo* internal::MakeAndRegisterTestInfo(
781
+ const char* test_suite_name, const char* name, const char* type_param,
782
+ const char* value_param, internal::CodeLocation code_location,
783
+ internal::TypeId fixture_class_id, internal::SetUpTestSuiteFunc set_up_tc,
784
+ internal::TearDownTestSuiteFunc tear_down_tc,
785
+ internal::TestFactoryBase* factory);
786
+
787
+ // Constructs a TestInfo object. The newly constructed instance assumes
788
+ // ownership of the factory object.
789
+ TestInfo(const std::string& test_suite_name, const std::string& name,
790
+ const char* a_type_param, // NULL if not a type-parameterized test
791
+ const char* a_value_param, // NULL if not a value-parameterized test
792
+ internal::CodeLocation a_code_location,
793
+ internal::TypeId fixture_class_id,
794
+ internal::TestFactoryBase* factory);
795
+
796
+ // Increments the number of death tests encountered in this test so
797
+ // far.
798
+ int increment_death_test_count() {
799
+ return result_.increment_death_test_count();
800
+ }
801
+
802
+ // Creates the test object, runs it, records its result, and then
803
+ // deletes it.
804
+ void Run();
805
+
806
+ // Skip and records the test result for this object.
807
+ void Skip();
808
+
809
+ static void ClearTestResult(TestInfo* test_info) {
810
+ test_info->result_.Clear();
811
+ }
812
+
813
+ // These fields are immutable properties of the test.
814
+ const std::string test_suite_name_; // test suite name
815
+ const std::string name_; // Test name
816
+ // Name of the parameter type, or NULL if this is not a typed or a
817
+ // type-parameterized test.
818
+ const std::unique_ptr<const ::std::string> type_param_;
819
+ // Text representation of the value parameter, or NULL if this is not a
820
+ // value-parameterized test.
821
+ const std::unique_ptr<const ::std::string> value_param_;
822
+ internal::CodeLocation location_;
823
+ const internal::TypeId fixture_class_id_; // ID of the test fixture class
824
+ bool should_run_; // True if and only if this test should run
825
+ bool is_disabled_; // True if and only if this test is disabled
826
+ bool matches_filter_; // True if this test matches the
827
+ // user-specified filter.
828
+ bool is_in_another_shard_; // Will be run in another shard.
829
+ internal::TestFactoryBase* const factory_; // The factory that creates
830
+ // the test object
831
+
832
+ // This field is mutable and needs to be reset before running the
833
+ // test for the second time.
834
+ TestResult result_;
835
+
836
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(TestInfo);
837
+ };
838
+
839
+ // A test suite, which consists of a vector of TestInfos.
840
+ //
841
+ // TestSuite is not copyable.
842
+ class GTEST_API_ TestSuite {
843
+ public:
844
+ // Creates a TestSuite with the given name.
845
+ //
846
+ // TestSuite does NOT have a default constructor. Always use this
847
+ // constructor to create a TestSuite object.
848
+ //
849
+ // Arguments:
850
+ //
851
+ // name: name of the test suite
852
+ // a_type_param: the name of the test's type parameter, or NULL if
853
+ // this is not a type-parameterized test.
854
+ // set_up_tc: pointer to the function that sets up the test suite
855
+ // tear_down_tc: pointer to the function that tears down the test suite
856
+ TestSuite(const char* name, const char* a_type_param,
857
+ internal::SetUpTestSuiteFunc set_up_tc,
858
+ internal::TearDownTestSuiteFunc tear_down_tc);
859
+
860
+ // Destructor of TestSuite.
861
+ virtual ~TestSuite();
862
+
863
+ // Gets the name of the TestSuite.
864
+ const char* name() const { return name_.c_str(); }
865
+
866
+ // Returns the name of the parameter type, or NULL if this is not a
867
+ // type-parameterized test suite.
868
+ const char* type_param() const {
869
+ if (type_param_.get() != nullptr) return type_param_->c_str();
870
+ return nullptr;
871
+ }
872
+
873
+ // Returns true if any test in this test suite should run.
874
+ bool should_run() const { return should_run_; }
875
+
876
+ // Gets the number of successful tests in this test suite.
877
+ int successful_test_count() const;
878
+
879
+ // Gets the number of skipped tests in this test suite.
880
+ int skipped_test_count() const;
881
+
882
+ // Gets the number of failed tests in this test suite.
883
+ int failed_test_count() const;
884
+
885
+ // Gets the number of disabled tests that will be reported in the XML report.
886
+ int reportable_disabled_test_count() const;
887
+
888
+ // Gets the number of disabled tests in this test suite.
889
+ int disabled_test_count() const;
890
+
891
+ // Gets the number of tests to be printed in the XML report.
892
+ int reportable_test_count() const;
893
+
894
+ // Get the number of tests in this test suite that should run.
895
+ int test_to_run_count() const;
896
+
897
+ // Gets the number of all tests in this test suite.
898
+ int total_test_count() const;
899
+
900
+ // Returns true if and only if the test suite passed.
901
+ bool Passed() const { return !Failed(); }
902
+
903
+ // Returns true if and only if the test suite failed.
904
+ bool Failed() const {
905
+ return failed_test_count() > 0 || ad_hoc_test_result().Failed();
906
+ }
907
+
908
+ // Returns the elapsed time, in milliseconds.
909
+ TimeInMillis elapsed_time() const { return elapsed_time_; }
910
+
911
+ // Gets the time of the test suite start, in ms from the start of the
912
+ // UNIX epoch.
913
+ TimeInMillis start_timestamp() const { return start_timestamp_; }
914
+
915
+ // Returns the i-th test among all the tests. i can range from 0 to
916
+ // total_test_count() - 1. If i is not in that range, returns NULL.
917
+ const TestInfo* GetTestInfo(int i) const;
918
+
919
+ // Returns the TestResult that holds test properties recorded during
920
+ // execution of SetUpTestSuite and TearDownTestSuite.
921
+ const TestResult& ad_hoc_test_result() const { return ad_hoc_test_result_; }
922
+
923
+ private:
924
+ friend class Test;
925
+ friend class internal::UnitTestImpl;
926
+
927
+ // Gets the (mutable) vector of TestInfos in this TestSuite.
928
+ std::vector<TestInfo*>& test_info_list() { return test_info_list_; }
929
+
930
+ // Gets the (immutable) vector of TestInfos in this TestSuite.
931
+ const std::vector<TestInfo*>& test_info_list() const {
932
+ return test_info_list_;
933
+ }
934
+
935
+ // Returns the i-th test among all the tests. i can range from 0 to
936
+ // total_test_count() - 1. If i is not in that range, returns NULL.
937
+ TestInfo* GetMutableTestInfo(int i);
938
+
939
+ // Sets the should_run member.
940
+ void set_should_run(bool should) { should_run_ = should; }
941
+
942
+ // Adds a TestInfo to this test suite. Will delete the TestInfo upon
943
+ // destruction of the TestSuite object.
944
+ void AddTestInfo(TestInfo * test_info);
945
+
946
+ // Clears the results of all tests in this test suite.
947
+ void ClearResult();
948
+
949
+ // Clears the results of all tests in the given test suite.
950
+ static void ClearTestSuiteResult(TestSuite* test_suite) {
951
+ test_suite->ClearResult();
952
+ }
953
+
954
+ // Runs every test in this TestSuite.
955
+ void Run();
956
+
957
+ // Skips the execution of tests under this TestSuite
958
+ void Skip();
959
+
960
+ // Runs SetUpTestSuite() for this TestSuite. This wrapper is needed
961
+ // for catching exceptions thrown from SetUpTestSuite().
962
+ void RunSetUpTestSuite() {
963
+ if (set_up_tc_ != nullptr) {
964
+ (*set_up_tc_)();
965
+ }
966
+ }
967
+
968
+ // Runs TearDownTestSuite() for this TestSuite. This wrapper is
969
+ // needed for catching exceptions thrown from TearDownTestSuite().
970
+ void RunTearDownTestSuite() {
971
+ if (tear_down_tc_ != nullptr) {
972
+ (*tear_down_tc_)();
973
+ }
974
+ }
975
+
976
+ // Returns true if and only if test passed.
977
+ static bool TestPassed(const TestInfo* test_info) {
978
+ return test_info->should_run() && test_info->result()->Passed();
979
+ }
980
+
981
+ // Returns true if and only if test skipped.
982
+ static bool TestSkipped(const TestInfo* test_info) {
983
+ return test_info->should_run() && test_info->result()->Skipped();
984
+ }
985
+
986
+ // Returns true if and only if test failed.
987
+ static bool TestFailed(const TestInfo* test_info) {
988
+ return test_info->should_run() && test_info->result()->Failed();
989
+ }
990
+
991
+ // Returns true if and only if the test is disabled and will be reported in
992
+ // the XML report.
993
+ static bool TestReportableDisabled(const TestInfo* test_info) {
994
+ return test_info->is_reportable() && test_info->is_disabled_;
995
+ }
996
+
997
+ // Returns true if and only if test is disabled.
998
+ static bool TestDisabled(const TestInfo* test_info) {
999
+ return test_info->is_disabled_;
1000
+ }
1001
+
1002
+ // Returns true if and only if this test will appear in the XML report.
1003
+ static bool TestReportable(const TestInfo* test_info) {
1004
+ return test_info->is_reportable();
1005
+ }
1006
+
1007
+ // Returns true if the given test should run.
1008
+ static bool ShouldRunTest(const TestInfo* test_info) {
1009
+ return test_info->should_run();
1010
+ }
1011
+
1012
+ // Shuffles the tests in this test suite.
1013
+ void ShuffleTests(internal::Random* random);
1014
+
1015
+ // Restores the test order to before the first shuffle.
1016
+ void UnshuffleTests();
1017
+
1018
+ // Name of the test suite.
1019
+ std::string name_;
1020
+ // Name of the parameter type, or NULL if this is not a typed or a
1021
+ // type-parameterized test.
1022
+ const std::unique_ptr<const ::std::string> type_param_;
1023
+ // The vector of TestInfos in their original order. It owns the
1024
+ // elements in the vector.
1025
+ std::vector<TestInfo*> test_info_list_;
1026
+ // Provides a level of indirection for the test list to allow easy
1027
+ // shuffling and restoring the test order. The i-th element in this
1028
+ // vector is the index of the i-th test in the shuffled test list.
1029
+ std::vector<int> test_indices_;
1030
+ // Pointer to the function that sets up the test suite.
1031
+ internal::SetUpTestSuiteFunc set_up_tc_;
1032
+ // Pointer to the function that tears down the test suite.
1033
+ internal::TearDownTestSuiteFunc tear_down_tc_;
1034
+ // True if and only if any test in this test suite should run.
1035
+ bool should_run_;
1036
+ // The start time, in milliseconds since UNIX Epoch.
1037
+ TimeInMillis start_timestamp_;
1038
+ // Elapsed time, in milliseconds.
1039
+ TimeInMillis elapsed_time_;
1040
+ // Holds test properties recorded during execution of SetUpTestSuite and
1041
+ // TearDownTestSuite.
1042
+ TestResult ad_hoc_test_result_;
1043
+
1044
+ // We disallow copying TestSuites.
1045
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(TestSuite);
1046
+ };
1047
+
1048
+ // An Environment object is capable of setting up and tearing down an
1049
+ // environment. You should subclass this to define your own
1050
+ // environment(s).
1051
+ //
1052
+ // An Environment object does the set-up and tear-down in virtual
1053
+ // methods SetUp() and TearDown() instead of the constructor and the
1054
+ // destructor, as:
1055
+ //
1056
+ // 1. You cannot safely throw from a destructor. This is a problem
1057
+ // as in some cases Google Test is used where exceptions are enabled, and
1058
+ // we may want to implement ASSERT_* using exceptions where they are
1059
+ // available.
1060
+ // 2. You cannot use ASSERT_* directly in a constructor or
1061
+ // destructor.
1062
+ class Environment {
1063
+ public:
1064
+ // The d'tor is virtual as we need to subclass Environment.
1065
+ virtual ~Environment() {}
1066
+
1067
+ // Override this to define how to set up the environment.
1068
+ virtual void SetUp() {}
1069
+
1070
+ // Override this to define how to tear down the environment.
1071
+ virtual void TearDown() {}
1072
+ private:
1073
+ // If you see an error about overriding the following function or
1074
+ // about it being private, you have mis-spelled SetUp() as Setup().
1075
+ struct Setup_should_be_spelled_SetUp {};
1076
+ virtual Setup_should_be_spelled_SetUp* Setup() { return nullptr; }
1077
+ };
1078
+
1079
+ #if GTEST_HAS_EXCEPTIONS
1080
+
1081
+ // Exception which can be thrown from TestEventListener::OnTestPartResult.
1082
+ class GTEST_API_ AssertionException
1083
+ : public internal::GoogleTestFailureException {
1084
+ public:
1085
+ explicit AssertionException(const TestPartResult& result)
1086
+ : GoogleTestFailureException(result) {}
1087
+ };
1088
+
1089
+ #endif // GTEST_HAS_EXCEPTIONS
1090
+
1091
+ // The interface for tracing execution of tests. The methods are organized in
1092
+ // the order the corresponding events are fired.
1093
+ class TestEventListener {
1094
+ public:
1095
+ virtual ~TestEventListener() {}
1096
+
1097
+ // Fired before any test activity starts.
1098
+ virtual void OnTestProgramStart(const UnitTest& unit_test) = 0;
1099
+
1100
+ // Fired before each iteration of tests starts. There may be more than
1101
+ // one iteration if GTEST_FLAG(repeat) is set. iteration is the iteration
1102
+ // index, starting from 0.
1103
+ virtual void OnTestIterationStart(const UnitTest& unit_test,
1104
+ int iteration) = 0;
1105
+
1106
+ // Fired before environment set-up for each iteration of tests starts.
1107
+ virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test) = 0;
1108
+
1109
+ // Fired after environment set-up for each iteration of tests ends.
1110
+ virtual void OnEnvironmentsSetUpEnd(const UnitTest& unit_test) = 0;
1111
+
1112
+ // Fired before the test suite starts.
1113
+ virtual void OnTestSuiteStart(const TestSuite& /*test_suite*/) {}
1114
+
1115
+ // Legacy API is deprecated but still available
1116
+ #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
1117
+ virtual void OnTestCaseStart(const TestCase& /*test_case*/) {}
1118
+ #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
1119
+
1120
+ // Fired before the test starts.
1121
+ virtual void OnTestStart(const TestInfo& test_info) = 0;
1122
+
1123
+ // Fired after a failed assertion or a SUCCEED() invocation.
1124
+ // If you want to throw an exception from this function to skip to the next
1125
+ // TEST, it must be AssertionException defined above, or inherited from it.
1126
+ virtual void OnTestPartResult(const TestPartResult& test_part_result) = 0;
1127
+
1128
+ // Fired after the test ends.
1129
+ virtual void OnTestEnd(const TestInfo& test_info) = 0;
1130
+
1131
+ // Fired after the test suite ends.
1132
+ virtual void OnTestSuiteEnd(const TestSuite& /*test_suite*/) {}
1133
+
1134
+ // Legacy API is deprecated but still available
1135
+ #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
1136
+ virtual void OnTestCaseEnd(const TestCase& /*test_case*/) {}
1137
+ #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
1138
+
1139
+ // Fired before environment tear-down for each iteration of tests starts.
1140
+ virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test) = 0;
1141
+
1142
+ // Fired after environment tear-down for each iteration of tests ends.
1143
+ virtual void OnEnvironmentsTearDownEnd(const UnitTest& unit_test) = 0;
1144
+
1145
+ // Fired after each iteration of tests finishes.
1146
+ virtual void OnTestIterationEnd(const UnitTest& unit_test,
1147
+ int iteration) = 0;
1148
+
1149
+ // Fired after all test activities have ended.
1150
+ virtual void OnTestProgramEnd(const UnitTest& unit_test) = 0;
1151
+ };
1152
+
1153
+ // The convenience class for users who need to override just one or two
1154
+ // methods and are not concerned that a possible change to a signature of
1155
+ // the methods they override will not be caught during the build. For
1156
+ // comments about each method please see the definition of TestEventListener
1157
+ // above.
1158
+ class EmptyTestEventListener : public TestEventListener {
1159
+ public:
1160
+ void OnTestProgramStart(const UnitTest& /*unit_test*/) override {}
1161
+ void OnTestIterationStart(const UnitTest& /*unit_test*/,
1162
+ int /*iteration*/) override {}
1163
+ void OnEnvironmentsSetUpStart(const UnitTest& /*unit_test*/) override {}
1164
+ void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) override {}
1165
+ void OnTestSuiteStart(const TestSuite& /*test_suite*/) override {}
1166
+ // Legacy API is deprecated but still available
1167
+ #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
1168
+ void OnTestCaseStart(const TestCase& /*test_case*/) override {}
1169
+ #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
1170
+
1171
+ void OnTestStart(const TestInfo& /*test_info*/) override {}
1172
+ void OnTestPartResult(const TestPartResult& /*test_part_result*/) override {}
1173
+ void OnTestEnd(const TestInfo& /*test_info*/) override {}
1174
+ void OnTestSuiteEnd(const TestSuite& /*test_suite*/) override {}
1175
+ #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
1176
+ void OnTestCaseEnd(const TestCase& /*test_case*/) override {}
1177
+ #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
1178
+
1179
+ void OnEnvironmentsTearDownStart(const UnitTest& /*unit_test*/) override {}
1180
+ void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) override {}
1181
+ void OnTestIterationEnd(const UnitTest& /*unit_test*/,
1182
+ int /*iteration*/) override {}
1183
+ void OnTestProgramEnd(const UnitTest& /*unit_test*/) override {}
1184
+ };
1185
+
1186
+ // TestEventListeners lets users add listeners to track events in Google Test.
1187
+ class GTEST_API_ TestEventListeners {
1188
+ public:
1189
+ TestEventListeners();
1190
+ ~TestEventListeners();
1191
+
1192
+ // Appends an event listener to the end of the list. Google Test assumes
1193
+ // the ownership of the listener (i.e. it will delete the listener when
1194
+ // the test program finishes).
1195
+ void Append(TestEventListener* listener);
1196
+
1197
+ // Removes the given event listener from the list and returns it. It then
1198
+ // becomes the caller's responsibility to delete the listener. Returns
1199
+ // NULL if the listener is not found in the list.
1200
+ TestEventListener* Release(TestEventListener* listener);
1201
+
1202
+ // Returns the standard listener responsible for the default console
1203
+ // output. Can be removed from the listeners list to shut down default
1204
+ // console output. Note that removing this object from the listener list
1205
+ // with Release transfers its ownership to the caller and makes this
1206
+ // function return NULL the next time.
1207
+ TestEventListener* default_result_printer() const {
1208
+ return default_result_printer_;
1209
+ }
1210
+
1211
+ // Returns the standard listener responsible for the default XML output
1212
+ // controlled by the --gtest_output=xml flag. Can be removed from the
1213
+ // listeners list by users who want to shut down the default XML output
1214
+ // controlled by this flag and substitute it with custom one. Note that
1215
+ // removing this object from the listener list with Release transfers its
1216
+ // ownership to the caller and makes this function return NULL the next
1217
+ // time.
1218
+ TestEventListener* default_xml_generator() const {
1219
+ return default_xml_generator_;
1220
+ }
1221
+
1222
+ private:
1223
+ friend class TestSuite;
1224
+ friend class TestInfo;
1225
+ friend class internal::DefaultGlobalTestPartResultReporter;
1226
+ friend class internal::NoExecDeathTest;
1227
+ friend class internal::TestEventListenersAccessor;
1228
+ friend class internal::UnitTestImpl;
1229
+
1230
+ // Returns repeater that broadcasts the TestEventListener events to all
1231
+ // subscribers.
1232
+ TestEventListener* repeater();
1233
+
1234
+ // Sets the default_result_printer attribute to the provided listener.
1235
+ // The listener is also added to the listener list and previous
1236
+ // default_result_printer is removed from it and deleted. The listener can
1237
+ // also be NULL in which case it will not be added to the list. Does
1238
+ // nothing if the previous and the current listener objects are the same.
1239
+ void SetDefaultResultPrinter(TestEventListener* listener);
1240
+
1241
+ // Sets the default_xml_generator attribute to the provided listener. The
1242
+ // listener is also added to the listener list and previous
1243
+ // default_xml_generator is removed from it and deleted. The listener can
1244
+ // also be NULL in which case it will not be added to the list. Does
1245
+ // nothing if the previous and the current listener objects are the same.
1246
+ void SetDefaultXmlGenerator(TestEventListener* listener);
1247
+
1248
+ // Controls whether events will be forwarded by the repeater to the
1249
+ // listeners in the list.
1250
+ bool EventForwardingEnabled() const;
1251
+ void SuppressEventForwarding();
1252
+
1253
+ // The actual list of listeners.
1254
+ internal::TestEventRepeater* repeater_;
1255
+ // Listener responsible for the standard result output.
1256
+ TestEventListener* default_result_printer_;
1257
+ // Listener responsible for the creation of the XML output file.
1258
+ TestEventListener* default_xml_generator_;
1259
+
1260
+ // We disallow copying TestEventListeners.
1261
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(TestEventListeners);
1262
+ };
1263
+
1264
+ // A UnitTest consists of a vector of TestSuites.
1265
+ //
1266
+ // This is a singleton class. The only instance of UnitTest is
1267
+ // created when UnitTest::GetInstance() is first called. This
1268
+ // instance is never deleted.
1269
+ //
1270
+ // UnitTest is not copyable.
1271
+ //
1272
+ // This class is thread-safe as long as the methods are called
1273
+ // according to their specification.
1274
+ class GTEST_API_ UnitTest {
1275
+ public:
1276
+ // Gets the singleton UnitTest object. The first time this method
1277
+ // is called, a UnitTest object is constructed and returned.
1278
+ // Consecutive calls will return the same object.
1279
+ static UnitTest* GetInstance();
1280
+
1281
+ // Runs all tests in this UnitTest object and prints the result.
1282
+ // Returns 0 if successful, or 1 otherwise.
1283
+ //
1284
+ // This method can only be called from the main thread.
1285
+ //
1286
+ // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
1287
+ int Run() GTEST_MUST_USE_RESULT_;
1288
+
1289
+ // Returns the working directory when the first TEST() or TEST_F()
1290
+ // was executed. The UnitTest object owns the string.
1291
+ const char* original_working_dir() const;
1292
+
1293
+ // Returns the TestSuite object for the test that's currently running,
1294
+ // or NULL if no test is running.
1295
+ const TestSuite* current_test_suite() const GTEST_LOCK_EXCLUDED_(mutex_);
1296
+
1297
+ // Legacy API is still available but deprecated
1298
+ #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
1299
+ const TestCase* current_test_case() const GTEST_LOCK_EXCLUDED_(mutex_);
1300
+ #endif
1301
+
1302
+ // Returns the TestInfo object for the test that's currently running,
1303
+ // or NULL if no test is running.
1304
+ const TestInfo* current_test_info() const
1305
+ GTEST_LOCK_EXCLUDED_(mutex_);
1306
+
1307
+ // Returns the random seed used at the start of the current test run.
1308
+ int random_seed() const;
1309
+
1310
+ // Returns the ParameterizedTestSuiteRegistry object used to keep track of
1311
+ // value-parameterized tests and instantiate and register them.
1312
+ //
1313
+ // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
1314
+ internal::ParameterizedTestSuiteRegistry& parameterized_test_registry()
1315
+ GTEST_LOCK_EXCLUDED_(mutex_);
1316
+
1317
+ // Gets the number of successful test suites.
1318
+ int successful_test_suite_count() const;
1319
+
1320
+ // Gets the number of failed test suites.
1321
+ int failed_test_suite_count() const;
1322
+
1323
+ // Gets the number of all test suites.
1324
+ int total_test_suite_count() const;
1325
+
1326
+ // Gets the number of all test suites that contain at least one test
1327
+ // that should run.
1328
+ int test_suite_to_run_count() const;
1329
+
1330
+ // Legacy API is deprecated but still available
1331
+ #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
1332
+ int successful_test_case_count() const;
1333
+ int failed_test_case_count() const;
1334
+ int total_test_case_count() const;
1335
+ int test_case_to_run_count() const;
1336
+ #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
1337
+
1338
+ // Gets the number of successful tests.
1339
+ int successful_test_count() const;
1340
+
1341
+ // Gets the number of skipped tests.
1342
+ int skipped_test_count() const;
1343
+
1344
+ // Gets the number of failed tests.
1345
+ int failed_test_count() const;
1346
+
1347
+ // Gets the number of disabled tests that will be reported in the XML report.
1348
+ int reportable_disabled_test_count() const;
1349
+
1350
+ // Gets the number of disabled tests.
1351
+ int disabled_test_count() const;
1352
+
1353
+ // Gets the number of tests to be printed in the XML report.
1354
+ int reportable_test_count() const;
1355
+
1356
+ // Gets the number of all tests.
1357
+ int total_test_count() const;
1358
+
1359
+ // Gets the number of tests that should run.
1360
+ int test_to_run_count() const;
1361
+
1362
+ // Gets the time of the test program start, in ms from the start of the
1363
+ // UNIX epoch.
1364
+ TimeInMillis start_timestamp() const;
1365
+
1366
+ // Gets the elapsed time, in milliseconds.
1367
+ TimeInMillis elapsed_time() const;
1368
+
1369
+ // Returns true if and only if the unit test passed (i.e. all test suites
1370
+ // passed).
1371
+ bool Passed() const;
1372
+
1373
+ // Returns true if and only if the unit test failed (i.e. some test suite
1374
+ // failed or something outside of all tests failed).
1375
+ bool Failed() const;
1376
+
1377
+ // Gets the i-th test suite among all the test suites. i can range from 0 to
1378
+ // total_test_suite_count() - 1. If i is not in that range, returns NULL.
1379
+ const TestSuite* GetTestSuite(int i) const;
1380
+
1381
+ // Legacy API is deprecated but still available
1382
+ #ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_
1383
+ const TestCase* GetTestCase(int i) const;
1384
+ #endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
1385
+
1386
+ // Returns the TestResult containing information on test failures and
1387
+ // properties logged outside of individual test suites.
1388
+ const TestResult& ad_hoc_test_result() const;
1389
+
1390
+ // Returns the list of event listeners that can be used to track events
1391
+ // inside Google Test.
1392
+ TestEventListeners& listeners();
1393
+
1394
+ private:
1395
+ // Registers and returns a global test environment. When a test
1396
+ // program is run, all global test environments will be set-up in
1397
+ // the order they were registered. After all tests in the program
1398
+ // have finished, all global test environments will be torn-down in
1399
+ // the *reverse* order they were registered.
1400
+ //
1401
+ // The UnitTest object takes ownership of the given environment.
1402
+ //
1403
+ // This method can only be called from the main thread.
1404
+ Environment* AddEnvironment(Environment* env);
1405
+
1406
+ // Adds a TestPartResult to the current TestResult object. All
1407
+ // Google Test assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc)
1408
+ // eventually call this to report their results. The user code
1409
+ // should use the assertion macros instead of calling this directly.
1410
+ void AddTestPartResult(TestPartResult::Type result_type,
1411
+ const char* file_name,
1412
+ int line_number,
1413
+ const std::string& message,
1414
+ const std::string& os_stack_trace)
1415
+ GTEST_LOCK_EXCLUDED_(mutex_);
1416
+
1417
+ // Adds a TestProperty to the current TestResult object when invoked from
1418
+ // inside a test, to current TestSuite's ad_hoc_test_result_ when invoked
1419
+ // from SetUpTestSuite or TearDownTestSuite, or to the global property set
1420
+ // when invoked elsewhere. If the result already contains a property with
1421
+ // the same key, the value will be updated.
1422
+ void RecordProperty(const std::string& key, const std::string& value);
1423
+
1424
+ // Gets the i-th test suite among all the test suites. i can range from 0 to
1425
+ // total_test_suite_count() - 1. If i is not in that range, returns NULL.
1426
+ TestSuite* GetMutableTestSuite(int i);
1427
+
1428
+ // Accessors for the implementation object.
1429
+ internal::UnitTestImpl* impl() { return impl_; }
1430
+ const internal::UnitTestImpl* impl() const { return impl_; }
1431
+
1432
+ // These classes and functions are friends as they need to access private
1433
+ // members of UnitTest.
1434
+ friend class ScopedTrace;
1435
+ friend class Test;
1436
+ friend class internal::AssertHelper;
1437
+ friend class internal::StreamingListenerTest;
1438
+ friend class internal::UnitTestRecordPropertyTestHelper;
1439
+ friend Environment* AddGlobalTestEnvironment(Environment* env);
1440
+ friend std::set<std::string>* internal::GetIgnoredParameterizedTestSuites();
1441
+ friend internal::UnitTestImpl* internal::GetUnitTestImpl();
1442
+ friend void internal::ReportFailureInUnknownLocation(
1443
+ TestPartResult::Type result_type,
1444
+ const std::string& message);
1445
+
1446
+ // Creates an empty UnitTest.
1447
+ UnitTest();
1448
+
1449
+ // D'tor
1450
+ virtual ~UnitTest();
1451
+
1452
+ // Pushes a trace defined by SCOPED_TRACE() on to the per-thread
1453
+ // Google Test trace stack.
1454
+ void PushGTestTrace(const internal::TraceInfo& trace)
1455
+ GTEST_LOCK_EXCLUDED_(mutex_);
1456
+
1457
+ // Pops a trace from the per-thread Google Test trace stack.
1458
+ void PopGTestTrace()
1459
+ GTEST_LOCK_EXCLUDED_(mutex_);
1460
+
1461
+ // Protects mutable state in *impl_. This is mutable as some const
1462
+ // methods need to lock it too.
1463
+ mutable internal::Mutex mutex_;
1464
+
1465
+ // Opaque implementation object. This field is never changed once
1466
+ // the object is constructed. We don't mark it as const here, as
1467
+ // doing so will cause a warning in the constructor of UnitTest.
1468
+ // Mutable state in *impl_ is protected by mutex_.
1469
+ internal::UnitTestImpl* impl_;
1470
+
1471
+ // We disallow copying UnitTest.
1472
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTest);
1473
+ };
1474
+
1475
+ // A convenient wrapper for adding an environment for the test
1476
+ // program.
1477
+ //
1478
+ // You should call this before RUN_ALL_TESTS() is called, probably in
1479
+ // main(). If you use gtest_main, you need to call this before main()
1480
+ // starts for it to take effect. For example, you can define a global
1481
+ // variable like this:
1482
+ //
1483
+ // testing::Environment* const foo_env =
1484
+ // testing::AddGlobalTestEnvironment(new FooEnvironment);
1485
+ //
1486
+ // However, we strongly recommend you to write your own main() and
1487
+ // call AddGlobalTestEnvironment() there, as relying on initialization
1488
+ // of global variables makes the code harder to read and may cause
1489
+ // problems when you register multiple environments from different
1490
+ // translation units and the environments have dependencies among them
1491
+ // (remember that the compiler doesn't guarantee the order in which
1492
+ // global variables from different translation units are initialized).
1493
+ inline Environment* AddGlobalTestEnvironment(Environment* env) {
1494
+ return UnitTest::GetInstance()->AddEnvironment(env);
1495
+ }
1496
+
1497
+ // Initializes Google Test. This must be called before calling
1498
+ // RUN_ALL_TESTS(). In particular, it parses a command line for the
1499
+ // flags that Google Test recognizes. Whenever a Google Test flag is
1500
+ // seen, it is removed from argv, and *argc is decremented.
1501
+ //
1502
+ // No value is returned. Instead, the Google Test flag variables are
1503
+ // updated.
1504
+ //
1505
+ // Calling the function for the second time has no user-visible effect.
1506
+ GTEST_API_ void InitGoogleTest(int* argc, char** argv);
1507
+
1508
+ // This overloaded version can be used in Windows programs compiled in
1509
+ // UNICODE mode.
1510
+ GTEST_API_ void InitGoogleTest(int* argc, wchar_t** argv);
1511
+
1512
+ // This overloaded version can be used on Arduino/embedded platforms where
1513
+ // there is no argc/argv.
1514
+ GTEST_API_ void InitGoogleTest();
1515
+
1516
+ namespace internal {
1517
+
1518
+ // Separate the error generating code from the code path to reduce the stack
1519
+ // frame size of CmpHelperEQ. This helps reduce the overhead of some sanitizers
1520
+ // when calling EXPECT_* in a tight loop.
1521
+ template <typename T1, typename T2>
1522
+ AssertionResult CmpHelperEQFailure(const char* lhs_expression,
1523
+ const char* rhs_expression,
1524
+ const T1& lhs, const T2& rhs) {
1525
+ return EqFailure(lhs_expression,
1526
+ rhs_expression,
1527
+ FormatForComparisonFailureMessage(lhs, rhs),
1528
+ FormatForComparisonFailureMessage(rhs, lhs),
1529
+ false);
1530
+ }
1531
+
1532
+ // This block of code defines operator==/!=
1533
+ // to block lexical scope lookup.
1534
+ // It prevents using invalid operator==/!= defined at namespace scope.
1535
+ struct faketype {};
1536
+ inline bool operator==(faketype, faketype) { return true; }
1537
+ inline bool operator!=(faketype, faketype) { return false; }
1538
+
1539
+ // The helper function for {ASSERT|EXPECT}_EQ.
1540
+ template <typename T1, typename T2>
1541
+ AssertionResult CmpHelperEQ(const char* lhs_expression,
1542
+ const char* rhs_expression,
1543
+ const T1& lhs,
1544
+ const T2& rhs) {
1545
+ if (lhs == rhs) {
1546
+ return AssertionSuccess();
1547
+ }
1548
+
1549
+ return CmpHelperEQFailure(lhs_expression, rhs_expression, lhs, rhs);
1550
+ }
1551
+
1552
+ class EqHelper {
1553
+ public:
1554
+ // This templatized version is for the general case.
1555
+ template <
1556
+ typename T1, typename T2,
1557
+ // Disable this overload for cases where one argument is a pointer
1558
+ // and the other is the null pointer constant.
1559
+ typename std::enable_if<!std::is_integral<T1>::value ||
1560
+ !std::is_pointer<T2>::value>::type* = nullptr>
1561
+ static AssertionResult Compare(const char* lhs_expression,
1562
+ const char* rhs_expression, const T1& lhs,
1563
+ const T2& rhs) {
1564
+ return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
1565
+ }
1566
+
1567
+ // With this overloaded version, we allow anonymous enums to be used
1568
+ // in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous
1569
+ // enums can be implicitly cast to BiggestInt.
1570
+ //
1571
+ // Even though its body looks the same as the above version, we
1572
+ // cannot merge the two, as it will make anonymous enums unhappy.
1573
+ static AssertionResult Compare(const char* lhs_expression,
1574
+ const char* rhs_expression,
1575
+ BiggestInt lhs,
1576
+ BiggestInt rhs) {
1577
+ return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
1578
+ }
1579
+
1580
+ template <typename T>
1581
+ static AssertionResult Compare(
1582
+ const char* lhs_expression, const char* rhs_expression,
1583
+ // Handle cases where '0' is used as a null pointer literal.
1584
+ std::nullptr_t /* lhs */, T* rhs) {
1585
+ // We already know that 'lhs' is a null pointer.
1586
+ return CmpHelperEQ(lhs_expression, rhs_expression, static_cast<T*>(nullptr),
1587
+ rhs);
1588
+ }
1589
+ };
1590
+
1591
+ // Separate the error generating code from the code path to reduce the stack
1592
+ // frame size of CmpHelperOP. This helps reduce the overhead of some sanitizers
1593
+ // when calling EXPECT_OP in a tight loop.
1594
+ template <typename T1, typename T2>
1595
+ AssertionResult CmpHelperOpFailure(const char* expr1, const char* expr2,
1596
+ const T1& val1, const T2& val2,
1597
+ const char* op) {
1598
+ return AssertionFailure()
1599
+ << "Expected: (" << expr1 << ") " << op << " (" << expr2
1600
+ << "), actual: " << FormatForComparisonFailureMessage(val1, val2)
1601
+ << " vs " << FormatForComparisonFailureMessage(val2, val1);
1602
+ }
1603
+
1604
+ // A macro for implementing the helper functions needed to implement
1605
+ // ASSERT_?? and EXPECT_??. It is here just to avoid copy-and-paste
1606
+ // of similar code.
1607
+ //
1608
+ // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
1609
+
1610
+ #define GTEST_IMPL_CMP_HELPER_(op_name, op)\
1611
+ template <typename T1, typename T2>\
1612
+ AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
1613
+ const T1& val1, const T2& val2) {\
1614
+ if (val1 op val2) {\
1615
+ return AssertionSuccess();\
1616
+ } else {\
1617
+ return CmpHelperOpFailure(expr1, expr2, val1, val2, #op);\
1618
+ }\
1619
+ }
1620
+
1621
+ // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
1622
+
1623
+ // Implements the helper function for {ASSERT|EXPECT}_NE
1624
+ GTEST_IMPL_CMP_HELPER_(NE, !=)
1625
+ // Implements the helper function for {ASSERT|EXPECT}_LE
1626
+ GTEST_IMPL_CMP_HELPER_(LE, <=)
1627
+ // Implements the helper function for {ASSERT|EXPECT}_LT
1628
+ GTEST_IMPL_CMP_HELPER_(LT, <)
1629
+ // Implements the helper function for {ASSERT|EXPECT}_GE
1630
+ GTEST_IMPL_CMP_HELPER_(GE, >=)
1631
+ // Implements the helper function for {ASSERT|EXPECT}_GT
1632
+ GTEST_IMPL_CMP_HELPER_(GT, >)
1633
+
1634
+ #undef GTEST_IMPL_CMP_HELPER_
1635
+
1636
+ // The helper function for {ASSERT|EXPECT}_STREQ.
1637
+ //
1638
+ // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
1639
+ GTEST_API_ AssertionResult CmpHelperSTREQ(const char* s1_expression,
1640
+ const char* s2_expression,
1641
+ const char* s1,
1642
+ const char* s2);
1643
+
1644
+ // The helper function for {ASSERT|EXPECT}_STRCASEEQ.
1645
+ //
1646
+ // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
1647
+ GTEST_API_ AssertionResult CmpHelperSTRCASEEQ(const char* s1_expression,
1648
+ const char* s2_expression,
1649
+ const char* s1,
1650
+ const char* s2);
1651
+
1652
+ // The helper function for {ASSERT|EXPECT}_STRNE.
1653
+ //
1654
+ // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
1655
+ GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
1656
+ const char* s2_expression,
1657
+ const char* s1,
1658
+ const char* s2);
1659
+
1660
+ // The helper function for {ASSERT|EXPECT}_STRCASENE.
1661
+ //
1662
+ // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
1663
+ GTEST_API_ AssertionResult CmpHelperSTRCASENE(const char* s1_expression,
1664
+ const char* s2_expression,
1665
+ const char* s1,
1666
+ const char* s2);
1667
+
1668
+
1669
+ // Helper function for *_STREQ on wide strings.
1670
+ //
1671
+ // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
1672
+ GTEST_API_ AssertionResult CmpHelperSTREQ(const char* s1_expression,
1673
+ const char* s2_expression,
1674
+ const wchar_t* s1,
1675
+ const wchar_t* s2);
1676
+
1677
+ // Helper function for *_STRNE on wide strings.
1678
+ //
1679
+ // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
1680
+ GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
1681
+ const char* s2_expression,
1682
+ const wchar_t* s1,
1683
+ const wchar_t* s2);
1684
+
1685
+ } // namespace internal
1686
+
1687
+ // IsSubstring() and IsNotSubstring() are intended to be used as the
1688
+ // first argument to {EXPECT,ASSERT}_PRED_FORMAT2(), not by
1689
+ // themselves. They check whether needle is a substring of haystack
1690
+ // (NULL is considered a substring of itself only), and return an
1691
+ // appropriate error message when they fail.
1692
+ //
1693
+ // The {needle,haystack}_expr arguments are the stringified
1694
+ // expressions that generated the two real arguments.
1695
+ GTEST_API_ AssertionResult IsSubstring(
1696
+ const char* needle_expr, const char* haystack_expr,
1697
+ const char* needle, const char* haystack);
1698
+ GTEST_API_ AssertionResult IsSubstring(
1699
+ const char* needle_expr, const char* haystack_expr,
1700
+ const wchar_t* needle, const wchar_t* haystack);
1701
+ GTEST_API_ AssertionResult IsNotSubstring(
1702
+ const char* needle_expr, const char* haystack_expr,
1703
+ const char* needle, const char* haystack);
1704
+ GTEST_API_ AssertionResult IsNotSubstring(
1705
+ const char* needle_expr, const char* haystack_expr,
1706
+ const wchar_t* needle, const wchar_t* haystack);
1707
+ GTEST_API_ AssertionResult IsSubstring(
1708
+ const char* needle_expr, const char* haystack_expr,
1709
+ const ::std::string& needle, const ::std::string& haystack);
1710
+ GTEST_API_ AssertionResult IsNotSubstring(
1711
+ const char* needle_expr, const char* haystack_expr,
1712
+ const ::std::string& needle, const ::std::string& haystack);
1713
+
1714
+ #if GTEST_HAS_STD_WSTRING
1715
+ GTEST_API_ AssertionResult IsSubstring(
1716
+ const char* needle_expr, const char* haystack_expr,
1717
+ const ::std::wstring& needle, const ::std::wstring& haystack);
1718
+ GTEST_API_ AssertionResult IsNotSubstring(
1719
+ const char* needle_expr, const char* haystack_expr,
1720
+ const ::std::wstring& needle, const ::std::wstring& haystack);
1721
+ #endif // GTEST_HAS_STD_WSTRING
1722
+
1723
+ namespace internal {
1724
+
1725
+ // Helper template function for comparing floating-points.
1726
+ //
1727
+ // Template parameter:
1728
+ //
1729
+ // RawType: the raw floating-point type (either float or double)
1730
+ //
1731
+ // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
1732
+ template <typename RawType>
1733
+ AssertionResult CmpHelperFloatingPointEQ(const char* lhs_expression,
1734
+ const char* rhs_expression,
1735
+ RawType lhs_value,
1736
+ RawType rhs_value) {
1737
+ const FloatingPoint<RawType> lhs(lhs_value), rhs(rhs_value);
1738
+
1739
+ if (lhs.AlmostEquals(rhs)) {
1740
+ return AssertionSuccess();
1741
+ }
1742
+
1743
+ ::std::stringstream lhs_ss;
1744
+ lhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
1745
+ << lhs_value;
1746
+
1747
+ ::std::stringstream rhs_ss;
1748
+ rhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
1749
+ << rhs_value;
1750
+
1751
+ return EqFailure(lhs_expression,
1752
+ rhs_expression,
1753
+ StringStreamToString(&lhs_ss),
1754
+ StringStreamToString(&rhs_ss),
1755
+ false);
1756
+ }
1757
+
1758
+ // Helper function for implementing ASSERT_NEAR.
1759
+ //
1760
+ // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
1761
+ GTEST_API_ AssertionResult DoubleNearPredFormat(const char* expr1,
1762
+ const char* expr2,
1763
+ const char* abs_error_expr,
1764
+ double val1,
1765
+ double val2,
1766
+ double abs_error);
1767
+
1768
+ // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
1769
+ // A class that enables one to stream messages to assertion macros
1770
+ class GTEST_API_ AssertHelper {
1771
+ public:
1772
+ // Constructor.
1773
+ AssertHelper(TestPartResult::Type type,
1774
+ const char* file,
1775
+ int line,
1776
+ const char* message);
1777
+ ~AssertHelper();
1778
+
1779
+ // Message assignment is a semantic trick to enable assertion
1780
+ // streaming; see the GTEST_MESSAGE_ macro below.
1781
+ void operator=(const Message& message) const;
1782
+
1783
+ private:
1784
+ // We put our data in a struct so that the size of the AssertHelper class can
1785
+ // be as small as possible. This is important because gcc is incapable of
1786
+ // re-using stack space even for temporary variables, so every EXPECT_EQ
1787
+ // reserves stack space for another AssertHelper.
1788
+ struct AssertHelperData {
1789
+ AssertHelperData(TestPartResult::Type t,
1790
+ const char* srcfile,
1791
+ int line_num,
1792
+ const char* msg)
1793
+ : type(t), file(srcfile), line(line_num), message(msg) { }
1794
+
1795
+ TestPartResult::Type const type;
1796
+ const char* const file;
1797
+ int const line;
1798
+ std::string const message;
1799
+
1800
+ private:
1801
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelperData);
1802
+ };
1803
+
1804
+ AssertHelperData* const data_;
1805
+
1806
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelper);
1807
+ };
1808
+
1809
+ } // namespace internal
1810
+
1811
+ // The pure interface class that all value-parameterized tests inherit from.
1812
+ // A value-parameterized class must inherit from both ::testing::Test and
1813
+ // ::testing::WithParamInterface. In most cases that just means inheriting
1814
+ // from ::testing::TestWithParam, but more complicated test hierarchies
1815
+ // may need to inherit from Test and WithParamInterface at different levels.
1816
+ //
1817
+ // This interface has support for accessing the test parameter value via
1818
+ // the GetParam() method.
1819
+ //
1820
+ // Use it with one of the parameter generator defining functions, like Range(),
1821
+ // Values(), ValuesIn(), Bool(), and Combine().
1822
+ //
1823
+ // class FooTest : public ::testing::TestWithParam<int> {
1824
+ // protected:
1825
+ // FooTest() {
1826
+ // // Can use GetParam() here.
1827
+ // }
1828
+ // ~FooTest() override {
1829
+ // // Can use GetParam() here.
1830
+ // }
1831
+ // void SetUp() override {
1832
+ // // Can use GetParam() here.
1833
+ // }
1834
+ // void TearDown override {
1835
+ // // Can use GetParam() here.
1836
+ // }
1837
+ // };
1838
+ // TEST_P(FooTest, DoesBar) {
1839
+ // // Can use GetParam() method here.
1840
+ // Foo foo;
1841
+ // ASSERT_TRUE(foo.DoesBar(GetParam()));
1842
+ // }
1843
+ // INSTANTIATE_TEST_SUITE_P(OneToTenRange, FooTest, ::testing::Range(1, 10));
1844
+
1845
+ template <typename T>
1846
+ class WithParamInterface {
1847
+ public:
1848
+ typedef T ParamType;
1849
+ virtual ~WithParamInterface() {}
1850
+
1851
+ // The current parameter value. Is also available in the test fixture's
1852
+ // constructor.
1853
+ static const ParamType& GetParam() {
1854
+ GTEST_CHECK_(parameter_ != nullptr)
1855
+ << "GetParam() can only be called inside a value-parameterized test "
1856
+ << "-- did you intend to write TEST_P instead of TEST_F?";
1857
+ return *parameter_;
1858
+ }
1859
+
1860
+ private:
1861
+ // Sets parameter value. The caller is responsible for making sure the value
1862
+ // remains alive and unchanged throughout the current test.
1863
+ static void SetParam(const ParamType* parameter) {
1864
+ parameter_ = parameter;
1865
+ }
1866
+
1867
+ // Static value used for accessing parameter during a test lifetime.
1868
+ static const ParamType* parameter_;
1869
+
1870
+ // TestClass must be a subclass of WithParamInterface<T> and Test.
1871
+ template <class TestClass> friend class internal::ParameterizedTestFactory;
1872
+ };
1873
+
1874
+ template <typename T>
1875
+ const T* WithParamInterface<T>::parameter_ = nullptr;
1876
+
1877
+ // Most value-parameterized classes can ignore the existence of
1878
+ // WithParamInterface, and can just inherit from ::testing::TestWithParam.
1879
+
1880
+ template <typename T>
1881
+ class TestWithParam : public Test, public WithParamInterface<T> {
1882
+ };
1883
+
1884
+ // Macros for indicating success/failure in test code.
1885
+
1886
+ // Skips test in runtime.
1887
+ // Skipping test aborts current function.
1888
+ // Skipped tests are neither successful nor failed.
1889
+ #define GTEST_SKIP() GTEST_SKIP_("")
1890
+
1891
+ // ADD_FAILURE unconditionally adds a failure to the current test.
1892
+ // SUCCEED generates a success - it doesn't automatically make the
1893
+ // current test successful, as a test is only successful when it has
1894
+ // no failure.
1895
+ //
1896
+ // EXPECT_* verifies that a certain condition is satisfied. If not,
1897
+ // it behaves like ADD_FAILURE. In particular:
1898
+ //
1899
+ // EXPECT_TRUE verifies that a Boolean condition is true.
1900
+ // EXPECT_FALSE verifies that a Boolean condition is false.
1901
+ //
1902
+ // FAIL and ASSERT_* are similar to ADD_FAILURE and EXPECT_*, except
1903
+ // that they will also abort the current function on failure. People
1904
+ // usually want the fail-fast behavior of FAIL and ASSERT_*, but those
1905
+ // writing data-driven tests often find themselves using ADD_FAILURE
1906
+ // and EXPECT_* more.
1907
+
1908
+ // Generates a nonfatal failure with a generic message.
1909
+ #define ADD_FAILURE() GTEST_NONFATAL_FAILURE_("Failed")
1910
+
1911
+ // Generates a nonfatal failure at the given source file location with
1912
+ // a generic message.
1913
+ #define ADD_FAILURE_AT(file, line) \
1914
+ GTEST_MESSAGE_AT_(file, line, "Failed", \
1915
+ ::testing::TestPartResult::kNonFatalFailure)
1916
+
1917
+ // Generates a fatal failure with a generic message.
1918
+ #define GTEST_FAIL() GTEST_FATAL_FAILURE_("Failed")
1919
+
1920
+ // Like GTEST_FAIL(), but at the given source file location.
1921
+ #define GTEST_FAIL_AT(file, line) \
1922
+ GTEST_MESSAGE_AT_(file, line, "Failed", \
1923
+ ::testing::TestPartResult::kFatalFailure)
1924
+
1925
+ // Define this macro to 1 to omit the definition of FAIL(), which is a
1926
+ // generic name and clashes with some other libraries.
1927
+ #if !GTEST_DONT_DEFINE_FAIL
1928
+ # define FAIL() GTEST_FAIL()
1929
+ #endif
1930
+
1931
+ // Generates a success with a generic message.
1932
+ #define GTEST_SUCCEED() GTEST_SUCCESS_("Succeeded")
1933
+
1934
+ // Define this macro to 1 to omit the definition of SUCCEED(), which
1935
+ // is a generic name and clashes with some other libraries.
1936
+ #if !GTEST_DONT_DEFINE_SUCCEED
1937
+ # define SUCCEED() GTEST_SUCCEED()
1938
+ #endif
1939
+
1940
+ // Macros for testing exceptions.
1941
+ //
1942
+ // * {ASSERT|EXPECT}_THROW(statement, expected_exception):
1943
+ // Tests that the statement throws the expected exception.
1944
+ // * {ASSERT|EXPECT}_NO_THROW(statement):
1945
+ // Tests that the statement doesn't throw any exception.
1946
+ // * {ASSERT|EXPECT}_ANY_THROW(statement):
1947
+ // Tests that the statement throws an exception.
1948
+
1949
+ #define EXPECT_THROW(statement, expected_exception) \
1950
+ GTEST_TEST_THROW_(statement, expected_exception, GTEST_NONFATAL_FAILURE_)
1951
+ #define EXPECT_NO_THROW(statement) \
1952
+ GTEST_TEST_NO_THROW_(statement, GTEST_NONFATAL_FAILURE_)
1953
+ #define EXPECT_ANY_THROW(statement) \
1954
+ GTEST_TEST_ANY_THROW_(statement, GTEST_NONFATAL_FAILURE_)
1955
+ #define ASSERT_THROW(statement, expected_exception) \
1956
+ GTEST_TEST_THROW_(statement, expected_exception, GTEST_FATAL_FAILURE_)
1957
+ #define ASSERT_NO_THROW(statement) \
1958
+ GTEST_TEST_NO_THROW_(statement, GTEST_FATAL_FAILURE_)
1959
+ #define ASSERT_ANY_THROW(statement) \
1960
+ GTEST_TEST_ANY_THROW_(statement, GTEST_FATAL_FAILURE_)
1961
+
1962
+ // Boolean assertions. Condition can be either a Boolean expression or an
1963
+ // AssertionResult. For more information on how to use AssertionResult with
1964
+ // these macros see comments on that class.
1965
+ #define GTEST_EXPECT_TRUE(condition) \
1966
+ GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
1967
+ GTEST_NONFATAL_FAILURE_)
1968
+ #define GTEST_EXPECT_FALSE(condition) \
1969
+ GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
1970
+ GTEST_NONFATAL_FAILURE_)
1971
+ #define GTEST_ASSERT_TRUE(condition) \
1972
+ GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
1973
+ GTEST_FATAL_FAILURE_)
1974
+ #define GTEST_ASSERT_FALSE(condition) \
1975
+ GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
1976
+ GTEST_FATAL_FAILURE_)
1977
+
1978
+ // Define these macros to 1 to omit the definition of the corresponding
1979
+ // EXPECT or ASSERT, which clashes with some users' own code.
1980
+
1981
+ #if !GTEST_DONT_DEFINE_EXPECT_TRUE
1982
+ #define EXPECT_TRUE(condition) GTEST_EXPECT_TRUE(condition)
1983
+ #endif
1984
+
1985
+ #if !GTEST_DONT_DEFINE_EXPECT_FALSE
1986
+ #define EXPECT_FALSE(condition) GTEST_EXPECT_FALSE(condition)
1987
+ #endif
1988
+
1989
+ #if !GTEST_DONT_DEFINE_ASSERT_TRUE
1990
+ #define ASSERT_TRUE(condition) GTEST_ASSERT_TRUE(condition)
1991
+ #endif
1992
+
1993
+ #if !GTEST_DONT_DEFINE_ASSERT_FALSE
1994
+ #define ASSERT_FALSE(condition) GTEST_ASSERT_FALSE(condition)
1995
+ #endif
1996
+
1997
+ // Macros for testing equalities and inequalities.
1998
+ //
1999
+ // * {ASSERT|EXPECT}_EQ(v1, v2): Tests that v1 == v2
2000
+ // * {ASSERT|EXPECT}_NE(v1, v2): Tests that v1 != v2
2001
+ // * {ASSERT|EXPECT}_LT(v1, v2): Tests that v1 < v2
2002
+ // * {ASSERT|EXPECT}_LE(v1, v2): Tests that v1 <= v2
2003
+ // * {ASSERT|EXPECT}_GT(v1, v2): Tests that v1 > v2
2004
+ // * {ASSERT|EXPECT}_GE(v1, v2): Tests that v1 >= v2
2005
+ //
2006
+ // When they are not, Google Test prints both the tested expressions and
2007
+ // their actual values. The values must be compatible built-in types,
2008
+ // or you will get a compiler error. By "compatible" we mean that the
2009
+ // values can be compared by the respective operator.
2010
+ //
2011
+ // Note:
2012
+ //
2013
+ // 1. It is possible to make a user-defined type work with
2014
+ // {ASSERT|EXPECT}_??(), but that requires overloading the
2015
+ // comparison operators and is thus discouraged by the Google C++
2016
+ // Usage Guide. Therefore, you are advised to use the
2017
+ // {ASSERT|EXPECT}_TRUE() macro to assert that two objects are
2018
+ // equal.
2019
+ //
2020
+ // 2. The {ASSERT|EXPECT}_??() macros do pointer comparisons on
2021
+ // pointers (in particular, C strings). Therefore, if you use it
2022
+ // with two C strings, you are testing how their locations in memory
2023
+ // are related, not how their content is related. To compare two C
2024
+ // strings by content, use {ASSERT|EXPECT}_STR*().
2025
+ //
2026
+ // 3. {ASSERT|EXPECT}_EQ(v1, v2) is preferred to
2027
+ // {ASSERT|EXPECT}_TRUE(v1 == v2), as the former tells you
2028
+ // what the actual value is when it fails, and similarly for the
2029
+ // other comparisons.
2030
+ //
2031
+ // 4. Do not depend on the order in which {ASSERT|EXPECT}_??()
2032
+ // evaluate their arguments, which is undefined.
2033
+ //
2034
+ // 5. These macros evaluate their arguments exactly once.
2035
+ //
2036
+ // Examples:
2037
+ //
2038
+ // EXPECT_NE(Foo(), 5);
2039
+ // EXPECT_EQ(a_pointer, NULL);
2040
+ // ASSERT_LT(i, array_size);
2041
+ // ASSERT_GT(records.size(), 0) << "There is no record left.";
2042
+
2043
+ #define EXPECT_EQ(val1, val2) \
2044
+ EXPECT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2)
2045
+ #define EXPECT_NE(val1, val2) \
2046
+ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
2047
+ #define EXPECT_LE(val1, val2) \
2048
+ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)
2049
+ #define EXPECT_LT(val1, val2) \
2050
+ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)
2051
+ #define EXPECT_GE(val1, val2) \
2052
+ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)
2053
+ #define EXPECT_GT(val1, val2) \
2054
+ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
2055
+
2056
+ #define GTEST_ASSERT_EQ(val1, val2) \
2057
+ ASSERT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2)
2058
+ #define GTEST_ASSERT_NE(val1, val2) \
2059
+ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
2060
+ #define GTEST_ASSERT_LE(val1, val2) \
2061
+ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)
2062
+ #define GTEST_ASSERT_LT(val1, val2) \
2063
+ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)
2064
+ #define GTEST_ASSERT_GE(val1, val2) \
2065
+ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)
2066
+ #define GTEST_ASSERT_GT(val1, val2) \
2067
+ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
2068
+
2069
+ // Define macro GTEST_DONT_DEFINE_ASSERT_XY to 1 to omit the definition of
2070
+ // ASSERT_XY(), which clashes with some users' own code.
2071
+
2072
+ #if !GTEST_DONT_DEFINE_ASSERT_EQ
2073
+ # define ASSERT_EQ(val1, val2) GTEST_ASSERT_EQ(val1, val2)
2074
+ #endif
2075
+
2076
+ #if !GTEST_DONT_DEFINE_ASSERT_NE
2077
+ # define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2)
2078
+ #endif
2079
+
2080
+ #if !GTEST_DONT_DEFINE_ASSERT_LE
2081
+ # define ASSERT_LE(val1, val2) GTEST_ASSERT_LE(val1, val2)
2082
+ #endif
2083
+
2084
+ #if !GTEST_DONT_DEFINE_ASSERT_LT
2085
+ # define ASSERT_LT(val1, val2) GTEST_ASSERT_LT(val1, val2)
2086
+ #endif
2087
+
2088
+ #if !GTEST_DONT_DEFINE_ASSERT_GE
2089
+ # define ASSERT_GE(val1, val2) GTEST_ASSERT_GE(val1, val2)
2090
+ #endif
2091
+
2092
+ #if !GTEST_DONT_DEFINE_ASSERT_GT
2093
+ # define ASSERT_GT(val1, val2) GTEST_ASSERT_GT(val1, val2)
2094
+ #endif
2095
+
2096
+ // C-string Comparisons. All tests treat NULL and any non-NULL string
2097
+ // as different. Two NULLs are equal.
2098
+ //
2099
+ // * {ASSERT|EXPECT}_STREQ(s1, s2): Tests that s1 == s2
2100
+ // * {ASSERT|EXPECT}_STRNE(s1, s2): Tests that s1 != s2
2101
+ // * {ASSERT|EXPECT}_STRCASEEQ(s1, s2): Tests that s1 == s2, ignoring case
2102
+ // * {ASSERT|EXPECT}_STRCASENE(s1, s2): Tests that s1 != s2, ignoring case
2103
+ //
2104
+ // For wide or narrow string objects, you can use the
2105
+ // {ASSERT|EXPECT}_??() macros.
2106
+ //
2107
+ // Don't depend on the order in which the arguments are evaluated,
2108
+ // which is undefined.
2109
+ //
2110
+ // These macros evaluate their arguments exactly once.
2111
+
2112
+ #define EXPECT_STREQ(s1, s2) \
2113
+ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, s1, s2)
2114
+ #define EXPECT_STRNE(s1, s2) \
2115
+ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
2116
+ #define EXPECT_STRCASEEQ(s1, s2) \
2117
+ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, s1, s2)
2118
+ #define EXPECT_STRCASENE(s1, s2)\
2119
+ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
2120
+
2121
+ #define ASSERT_STREQ(s1, s2) \
2122
+ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, s1, s2)
2123
+ #define ASSERT_STRNE(s1, s2) \
2124
+ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
2125
+ #define ASSERT_STRCASEEQ(s1, s2) \
2126
+ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, s1, s2)
2127
+ #define ASSERT_STRCASENE(s1, s2)\
2128
+ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
2129
+
2130
+ // Macros for comparing floating-point numbers.
2131
+ //
2132
+ // * {ASSERT|EXPECT}_FLOAT_EQ(val1, val2):
2133
+ // Tests that two float values are almost equal.
2134
+ // * {ASSERT|EXPECT}_DOUBLE_EQ(val1, val2):
2135
+ // Tests that two double values are almost equal.
2136
+ // * {ASSERT|EXPECT}_NEAR(v1, v2, abs_error):
2137
+ // Tests that v1 and v2 are within the given distance to each other.
2138
+ //
2139
+ // Google Test uses ULP-based comparison to automatically pick a default
2140
+ // error bound that is appropriate for the operands. See the
2141
+ // FloatingPoint template class in gtest-internal.h if you are
2142
+ // interested in the implementation details.
2143
+
2144
+ #define EXPECT_FLOAT_EQ(val1, val2)\
2145
+ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
2146
+ val1, val2)
2147
+
2148
+ #define EXPECT_DOUBLE_EQ(val1, val2)\
2149
+ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
2150
+ val1, val2)
2151
+
2152
+ #define ASSERT_FLOAT_EQ(val1, val2)\
2153
+ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \
2154
+ val1, val2)
2155
+
2156
+ #define ASSERT_DOUBLE_EQ(val1, val2)\
2157
+ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
2158
+ val1, val2)
2159
+
2160
+ #define EXPECT_NEAR(val1, val2, abs_error)\
2161
+ EXPECT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
2162
+ val1, val2, abs_error)
2163
+
2164
+ #define ASSERT_NEAR(val1, val2, abs_error)\
2165
+ ASSERT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
2166
+ val1, val2, abs_error)
2167
+
2168
+ // These predicate format functions work on floating-point values, and
2169
+ // can be used in {ASSERT|EXPECT}_PRED_FORMAT2*(), e.g.
2170
+ //
2171
+ // EXPECT_PRED_FORMAT2(testing::DoubleLE, Foo(), 5.0);
2172
+
2173
+ // Asserts that val1 is less than, or almost equal to, val2. Fails
2174
+ // otherwise. In particular, it fails if either val1 or val2 is NaN.
2175
+ GTEST_API_ AssertionResult FloatLE(const char* expr1, const char* expr2,
2176
+ float val1, float val2);
2177
+ GTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2,
2178
+ double val1, double val2);
2179
+
2180
+
2181
+ #if GTEST_OS_WINDOWS
2182
+
2183
+ // Macros that test for HRESULT failure and success, these are only useful
2184
+ // on Windows, and rely on Windows SDK macros and APIs to compile.
2185
+ //
2186
+ // * {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}(expr)
2187
+ //
2188
+ // When expr unexpectedly fails or succeeds, Google Test prints the
2189
+ // expected result and the actual result with both a human-readable
2190
+ // string representation of the error, if available, as well as the
2191
+ // hex result code.
2192
+ # define EXPECT_HRESULT_SUCCEEDED(expr) \
2193
+ EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
2194
+
2195
+ # define ASSERT_HRESULT_SUCCEEDED(expr) \
2196
+ ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
2197
+
2198
+ # define EXPECT_HRESULT_FAILED(expr) \
2199
+ EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
2200
+
2201
+ # define ASSERT_HRESULT_FAILED(expr) \
2202
+ ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
2203
+
2204
+ #endif // GTEST_OS_WINDOWS
2205
+
2206
+ // Macros that execute statement and check that it doesn't generate new fatal
2207
+ // failures in the current thread.
2208
+ //
2209
+ // * {ASSERT|EXPECT}_NO_FATAL_FAILURE(statement);
2210
+ //
2211
+ // Examples:
2212
+ //
2213
+ // EXPECT_NO_FATAL_FAILURE(Process());
2214
+ // ASSERT_NO_FATAL_FAILURE(Process()) << "Process() failed";
2215
+ //
2216
+ #define ASSERT_NO_FATAL_FAILURE(statement) \
2217
+ GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_FATAL_FAILURE_)
2218
+ #define EXPECT_NO_FATAL_FAILURE(statement) \
2219
+ GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_NONFATAL_FAILURE_)
2220
+
2221
+ // Causes a trace (including the given source file path and line number,
2222
+ // and the given message) to be included in every test failure message generated
2223
+ // by code in the scope of the lifetime of an instance of this class. The effect
2224
+ // is undone with the destruction of the instance.
2225
+ //
2226
+ // The message argument can be anything streamable to std::ostream.
2227
+ //
2228
+ // Example:
2229
+ // testing::ScopedTrace trace("file.cc", 123, "message");
2230
+ //
2231
+ class GTEST_API_ ScopedTrace {
2232
+ public:
2233
+ // The c'tor pushes the given source file location and message onto
2234
+ // a trace stack maintained by Google Test.
2235
+
2236
+ // Template version. Uses Message() to convert the values into strings.
2237
+ // Slow, but flexible.
2238
+ template <typename T>
2239
+ ScopedTrace(const char* file, int line, const T& message) {
2240
+ PushTrace(file, line, (Message() << message).GetString());
2241
+ }
2242
+
2243
+ // Optimize for some known types.
2244
+ ScopedTrace(const char* file, int line, const char* message) {
2245
+ PushTrace(file, line, message ? message : "(null)");
2246
+ }
2247
+
2248
+ ScopedTrace(const char* file, int line, const std::string& message) {
2249
+ PushTrace(file, line, message);
2250
+ }
2251
+
2252
+ // The d'tor pops the info pushed by the c'tor.
2253
+ //
2254
+ // Note that the d'tor is not virtual in order to be efficient.
2255
+ // Don't inherit from ScopedTrace!
2256
+ ~ScopedTrace();
2257
+
2258
+ private:
2259
+ void PushTrace(const char* file, int line, std::string message);
2260
+
2261
+ GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedTrace);
2262
+ } GTEST_ATTRIBUTE_UNUSED_; // A ScopedTrace object does its job in its
2263
+ // c'tor and d'tor. Therefore it doesn't
2264
+ // need to be used otherwise.
2265
+
2266
+ // Causes a trace (including the source file path, the current line
2267
+ // number, and the given message) to be included in every test failure
2268
+ // message generated by code in the current scope. The effect is
2269
+ // undone when the control leaves the current scope.
2270
+ //
2271
+ // The message argument can be anything streamable to std::ostream.
2272
+ //
2273
+ // In the implementation, we include the current line number as part
2274
+ // of the dummy variable name, thus allowing multiple SCOPED_TRACE()s
2275
+ // to appear in the same block - as long as they are on different
2276
+ // lines.
2277
+ //
2278
+ // Assuming that each thread maintains its own stack of traces.
2279
+ // Therefore, a SCOPED_TRACE() would (correctly) only affect the
2280
+ // assertions in its own thread.
2281
+ #define SCOPED_TRACE(message) \
2282
+ ::testing::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)(\
2283
+ __FILE__, __LINE__, (message))
2284
+
2285
+ // Compile-time assertion for type equality.
2286
+ // StaticAssertTypeEq<type1, type2>() compiles if and only if type1 and type2
2287
+ // are the same type. The value it returns is not interesting.
2288
+ //
2289
+ // Instead of making StaticAssertTypeEq a class template, we make it a
2290
+ // function template that invokes a helper class template. This
2291
+ // prevents a user from misusing StaticAssertTypeEq<T1, T2> by
2292
+ // defining objects of that type.
2293
+ //
2294
+ // CAVEAT:
2295
+ //
2296
+ // When used inside a method of a class template,
2297
+ // StaticAssertTypeEq<T1, T2>() is effective ONLY IF the method is
2298
+ // instantiated. For example, given:
2299
+ //
2300
+ // template <typename T> class Foo {
2301
+ // public:
2302
+ // void Bar() { testing::StaticAssertTypeEq<int, T>(); }
2303
+ // };
2304
+ //
2305
+ // the code:
2306
+ //
2307
+ // void Test1() { Foo<bool> foo; }
2308
+ //
2309
+ // will NOT generate a compiler error, as Foo<bool>::Bar() is never
2310
+ // actually instantiated. Instead, you need:
2311
+ //
2312
+ // void Test2() { Foo<bool> foo; foo.Bar(); }
2313
+ //
2314
+ // to cause a compiler error.
2315
+ template <typename T1, typename T2>
2316
+ constexpr bool StaticAssertTypeEq() noexcept {
2317
+ static_assert(std::is_same<T1, T2>::value, "T1 and T2 are not the same type");
2318
+ return true;
2319
+ }
2320
+
2321
+ // Defines a test.
2322
+ //
2323
+ // The first parameter is the name of the test suite, and the second
2324
+ // parameter is the name of the test within the test suite.
2325
+ //
2326
+ // The convention is to end the test suite name with "Test". For
2327
+ // example, a test suite for the Foo class can be named FooTest.
2328
+ //
2329
+ // Test code should appear between braces after an invocation of
2330
+ // this macro. Example:
2331
+ //
2332
+ // TEST(FooTest, InitializesCorrectly) {
2333
+ // Foo foo;
2334
+ // EXPECT_TRUE(foo.StatusIsOK());
2335
+ // }
2336
+
2337
+ // Note that we call GetTestTypeId() instead of GetTypeId<
2338
+ // ::testing::Test>() here to get the type ID of testing::Test. This
2339
+ // is to work around a suspected linker bug when using Google Test as
2340
+ // a framework on Mac OS X. The bug causes GetTypeId<
2341
+ // ::testing::Test>() to return different values depending on whether
2342
+ // the call is from the Google Test framework itself or from user test
2343
+ // code. GetTestTypeId() is guaranteed to always return the same
2344
+ // value, as it always calls GetTypeId<>() from the Google Test
2345
+ // framework.
2346
+ #define GTEST_TEST(test_suite_name, test_name) \
2347
+ GTEST_TEST_(test_suite_name, test_name, ::testing::Test, \
2348
+ ::testing::internal::GetTestTypeId())
2349
+
2350
+ // Define this macro to 1 to omit the definition of TEST(), which
2351
+ // is a generic name and clashes with some other libraries.
2352
+ #if !GTEST_DONT_DEFINE_TEST
2353
+ #define TEST(test_suite_name, test_name) GTEST_TEST(test_suite_name, test_name)
2354
+ #endif
2355
+
2356
+ // Defines a test that uses a test fixture.
2357
+ //
2358
+ // The first parameter is the name of the test fixture class, which
2359
+ // also doubles as the test suite name. The second parameter is the
2360
+ // name of the test within the test suite.
2361
+ //
2362
+ // A test fixture class must be declared earlier. The user should put
2363
+ // the test code between braces after using this macro. Example:
2364
+ //
2365
+ // class FooTest : public testing::Test {
2366
+ // protected:
2367
+ // void SetUp() override { b_.AddElement(3); }
2368
+ //
2369
+ // Foo a_;
2370
+ // Foo b_;
2371
+ // };
2372
+ //
2373
+ // TEST_F(FooTest, InitializesCorrectly) {
2374
+ // EXPECT_TRUE(a_.StatusIsOK());
2375
+ // }
2376
+ //
2377
+ // TEST_F(FooTest, ReturnsElementCountCorrectly) {
2378
+ // EXPECT_EQ(a_.size(), 0);
2379
+ // EXPECT_EQ(b_.size(), 1);
2380
+ // }
2381
+ //
2382
+ // GOOGLETEST_CM0011 DO NOT DELETE
2383
+ #if !GTEST_DONT_DEFINE_TEST
2384
+ #define TEST_F(test_fixture, test_name)\
2385
+ GTEST_TEST_(test_fixture, test_name, test_fixture, \
2386
+ ::testing::internal::GetTypeId<test_fixture>())
2387
+ #endif // !GTEST_DONT_DEFINE_TEST
2388
+
2389
+ // Returns a path to temporary directory.
2390
+ // Tries to determine an appropriate directory for the platform.
2391
+ GTEST_API_ std::string TempDir();
2392
+
2393
+ #ifdef _MSC_VER
2394
+ # pragma warning(pop)
2395
+ #endif
2396
+
2397
+ // Dynamically registers a test with the framework.
2398
+ //
2399
+ // This is an advanced API only to be used when the `TEST` macros are
2400
+ // insufficient. The macros should be preferred when possible, as they avoid
2401
+ // most of the complexity of calling this function.
2402
+ //
2403
+ // The `factory` argument is a factory callable (move-constructible) object or
2404
+ // function pointer that creates a new instance of the Test object. It
2405
+ // handles ownership to the caller. The signature of the callable is
2406
+ // `Fixture*()`, where `Fixture` is the test fixture class for the test. All
2407
+ // tests registered with the same `test_suite_name` must return the same
2408
+ // fixture type. This is checked at runtime.
2409
+ //
2410
+ // The framework will infer the fixture class from the factory and will call
2411
+ // the `SetUpTestSuite` and `TearDownTestSuite` for it.
2412
+ //
2413
+ // Must be called before `RUN_ALL_TESTS()` is invoked, otherwise behavior is
2414
+ // undefined.
2415
+ //
2416
+ // Use case example:
2417
+ //
2418
+ // class MyFixture : public ::testing::Test {
2419
+ // public:
2420
+ // // All of these optional, just like in regular macro usage.
2421
+ // static void SetUpTestSuite() { ... }
2422
+ // static void TearDownTestSuite() { ... }
2423
+ // void SetUp() override { ... }
2424
+ // void TearDown() override { ... }
2425
+ // };
2426
+ //
2427
+ // class MyTest : public MyFixture {
2428
+ // public:
2429
+ // explicit MyTest(int data) : data_(data) {}
2430
+ // void TestBody() override { ... }
2431
+ //
2432
+ // private:
2433
+ // int data_;
2434
+ // };
2435
+ //
2436
+ // void RegisterMyTests(const std::vector<int>& values) {
2437
+ // for (int v : values) {
2438
+ // ::testing::RegisterTest(
2439
+ // "MyFixture", ("Test" + std::to_string(v)).c_str(), nullptr,
2440
+ // std::to_string(v).c_str(),
2441
+ // __FILE__, __LINE__,
2442
+ // // Important to use the fixture type as the return type here.
2443
+ // [=]() -> MyFixture* { return new MyTest(v); });
2444
+ // }
2445
+ // }
2446
+ // ...
2447
+ // int main(int argc, char** argv) {
2448
+ // std::vector<int> values_to_test = LoadValuesFromConfig();
2449
+ // RegisterMyTests(values_to_test);
2450
+ // ...
2451
+ // return RUN_ALL_TESTS();
2452
+ // }
2453
+ //
2454
+ template <int&... ExplicitParameterBarrier, typename Factory>
2455
+ TestInfo* RegisterTest(const char* test_suite_name, const char* test_name,
2456
+ const char* type_param, const char* value_param,
2457
+ const char* file, int line, Factory factory) {
2458
+ using TestT = typename std::remove_pointer<decltype(factory())>::type;
2459
+
2460
+ class FactoryImpl : public internal::TestFactoryBase {
2461
+ public:
2462
+ explicit FactoryImpl(Factory f) : factory_(std::move(f)) {}
2463
+ Test* CreateTest() override { return factory_(); }
2464
+
2465
+ private:
2466
+ Factory factory_;
2467
+ };
2468
+
2469
+ return internal::MakeAndRegisterTestInfo(
2470
+ test_suite_name, test_name, type_param, value_param,
2471
+ internal::CodeLocation(file, line), internal::GetTypeId<TestT>(),
2472
+ internal::SuiteApiResolver<TestT>::GetSetUpCaseOrSuite(file, line),
2473
+ internal::SuiteApiResolver<TestT>::GetTearDownCaseOrSuite(file, line),
2474
+ new FactoryImpl{std::move(factory)});
2475
+ }
2476
+
2477
+ } // namespace testing
2478
+
2479
+ // Use this function in main() to run all tests. It returns 0 if all
2480
+ // tests are successful, or 1 otherwise.
2481
+ //
2482
+ // RUN_ALL_TESTS() should be invoked after the command line has been
2483
+ // parsed by InitGoogleTest().
2484
+ //
2485
+ // This function was formerly a macro; thus, it is in the global
2486
+ // namespace and has an all-caps name.
2487
+ int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_;
2488
+
2489
+ inline int RUN_ALL_TESTS() {
2490
+ return ::testing::UnitTest::GetInstance()->Run();
2491
+ }
2492
+
2493
+ GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
2494
+
2495
+ #endif // GOOGLETEST_INCLUDE_GTEST_GTEST_H_
data/miniconda3/include/gtest/gtest_pred_impl.h ADDED
@@ -0,0 +1,359 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright 2006, Google Inc.
2
+ // All rights reserved.
3
+ //
4
+ // Redistribution and use in source and binary forms, with or without
5
+ // modification, are permitted provided that the following conditions are
6
+ // met:
7
+ //
8
+ // * Redistributions of source code must retain the above copyright
9
+ // notice, this list of conditions and the following disclaimer.
10
+ // * Redistributions in binary form must reproduce the above
11
+ // copyright notice, this list of conditions and the following disclaimer
12
+ // in the documentation and/or other materials provided with the
13
+ // distribution.
14
+ // * Neither the name of Google Inc. nor the names of its
15
+ // contributors may be used to endorse or promote products derived from
16
+ // this software without specific prior written permission.
17
+ //
18
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+
30
+ // This file is AUTOMATICALLY GENERATED on 01/02/2019 by command
31
+ // 'gen_gtest_pred_impl.py 5'. DO NOT EDIT BY HAND!
32
+ //
33
+ // Implements a family of generic predicate assertion macros.
34
+ // GOOGLETEST_CM0001 DO NOT DELETE
35
+
36
+ #ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
37
+ #define GOOGLETEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
38
+
39
+ #include "gtest/gtest.h"
40
+
41
+ namespace testing {
42
+
43
+ // This header implements a family of generic predicate assertion
44
+ // macros:
45
+ //
46
+ // ASSERT_PRED_FORMAT1(pred_format, v1)
47
+ // ASSERT_PRED_FORMAT2(pred_format, v1, v2)
48
+ // ...
49
+ //
50
+ // where pred_format is a function or functor that takes n (in the
51
+ // case of ASSERT_PRED_FORMATn) values and their source expression
52
+ // text, and returns a testing::AssertionResult. See the definition
53
+ // of ASSERT_EQ in gtest.h for an example.
54
+ //
55
+ // If you don't care about formatting, you can use the more
56
+ // restrictive version:
57
+ //
58
+ // ASSERT_PRED1(pred, v1)
59
+ // ASSERT_PRED2(pred, v1, v2)
60
+ // ...
61
+ //
62
+ // where pred is an n-ary function or functor that returns bool,
63
+ // and the values v1, v2, ..., must support the << operator for
64
+ // streaming to std::ostream.
65
+ //
66
+ // We also define the EXPECT_* variations.
67
+ //
68
+ // For now we only support predicates whose arity is at most 5.
69
+ // Please email googletestframework@googlegroups.com if you need
70
+ // support for higher arities.
71
+
72
+ // GTEST_ASSERT_ is the basic statement to which all of the assertions
73
+ // in this file reduce. Don't use this in your code.
74
+
75
+ #define GTEST_ASSERT_(expression, on_failure) \
76
+ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
77
+ if (const ::testing::AssertionResult gtest_ar = (expression)) \
78
+ ; \
79
+ else \
80
+ on_failure(gtest_ar.failure_message())
81
+
82
+
83
+ // Helper function for implementing {EXPECT|ASSERT}_PRED1. Don't use
84
+ // this in your code.
85
+ template <typename Pred,
86
+ typename T1>
87
+ AssertionResult AssertPred1Helper(const char* pred_text,
88
+ const char* e1,
89
+ Pred pred,
90
+ const T1& v1) {
91
+ if (pred(v1)) return AssertionSuccess();
92
+
93
+ return AssertionFailure()
94
+ << pred_text << "(" << e1 << ") evaluates to false, where"
95
+ << "\n"
96
+ << e1 << " evaluates to " << ::testing::PrintToString(v1);
97
+ }
98
+
99
+ // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT1.
100
+ // Don't use this in your code.
101
+ #define GTEST_PRED_FORMAT1_(pred_format, v1, on_failure)\
102
+ GTEST_ASSERT_(pred_format(#v1, v1), \
103
+ on_failure)
104
+
105
+ // Internal macro for implementing {EXPECT|ASSERT}_PRED1. Don't use
106
+ // this in your code.
107
+ #define GTEST_PRED1_(pred, v1, on_failure)\
108
+ GTEST_ASSERT_(::testing::AssertPred1Helper(#pred, \
109
+ #v1, \
110
+ pred, \
111
+ v1), on_failure)
112
+
113
+ // Unary predicate assertion macros.
114
+ #define EXPECT_PRED_FORMAT1(pred_format, v1) \
115
+ GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_NONFATAL_FAILURE_)
116
+ #define EXPECT_PRED1(pred, v1) \
117
+ GTEST_PRED1_(pred, v1, GTEST_NONFATAL_FAILURE_)
118
+ #define ASSERT_PRED_FORMAT1(pred_format, v1) \
119
+ GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_FATAL_FAILURE_)
120
+ #define ASSERT_PRED1(pred, v1) \
121
+ GTEST_PRED1_(pred, v1, GTEST_FATAL_FAILURE_)
122
+
123
+
124
+
125
+ // Helper function for implementing {EXPECT|ASSERT}_PRED2. Don't use
126
+ // this in your code.
127
+ template <typename Pred,
128
+ typename T1,
129
+ typename T2>
130
+ AssertionResult AssertPred2Helper(const char* pred_text,
131
+ const char* e1,
132
+ const char* e2,
133
+ Pred pred,
134
+ const T1& v1,
135
+ const T2& v2) {
136
+ if (pred(v1, v2)) return AssertionSuccess();
137
+
138
+ return AssertionFailure()
139
+ << pred_text << "(" << e1 << ", " << e2
140
+ << ") evaluates to false, where"
141
+ << "\n"
142
+ << e1 << " evaluates to " << ::testing::PrintToString(v1) << "\n"
143
+ << e2 << " evaluates to " << ::testing::PrintToString(v2);
144
+ }
145
+
146
+ // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT2.
147
+ // Don't use this in your code.
148
+ #define GTEST_PRED_FORMAT2_(pred_format, v1, v2, on_failure)\
149
+ GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \
150
+ on_failure)
151
+
152
+ // Internal macro for implementing {EXPECT|ASSERT}_PRED2. Don't use
153
+ // this in your code.
154
+ #define GTEST_PRED2_(pred, v1, v2, on_failure)\
155
+ GTEST_ASSERT_(::testing::AssertPred2Helper(#pred, \
156
+ #v1, \
157
+ #v2, \
158
+ pred, \
159
+ v1, \
160
+ v2), on_failure)
161
+
162
+ // Binary predicate assertion macros.
163
+ #define EXPECT_PRED_FORMAT2(pred_format, v1, v2) \
164
+ GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
165
+ #define EXPECT_PRED2(pred, v1, v2) \
166
+ GTEST_PRED2_(pred, v1, v2, GTEST_NONFATAL_FAILURE_)
167
+ #define ASSERT_PRED_FORMAT2(pred_format, v1, v2) \
168
+ GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_FATAL_FAILURE_)
169
+ #define ASSERT_PRED2(pred, v1, v2) \
170
+ GTEST_PRED2_(pred, v1, v2, GTEST_FATAL_FAILURE_)
171
+
172
+
173
+
174
+ // Helper function for implementing {EXPECT|ASSERT}_PRED3. Don't use
175
+ // this in your code.
176
+ template <typename Pred,
177
+ typename T1,
178
+ typename T2,
179
+ typename T3>
180
+ AssertionResult AssertPred3Helper(const char* pred_text,
181
+ const char* e1,
182
+ const char* e2,
183
+ const char* e3,
184
+ Pred pred,
185
+ const T1& v1,
186
+ const T2& v2,
187
+ const T3& v3) {
188
+ if (pred(v1, v2, v3)) return AssertionSuccess();
189
+
190
+ return AssertionFailure()
191
+ << pred_text << "(" << e1 << ", " << e2 << ", " << e3
192
+ << ") evaluates to false, where"
193
+ << "\n"
194
+ << e1 << " evaluates to " << ::testing::PrintToString(v1) << "\n"
195
+ << e2 << " evaluates to " << ::testing::PrintToString(v2) << "\n"
196
+ << e3 << " evaluates to " << ::testing::PrintToString(v3);
197
+ }
198
+
199
+ // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT3.
200
+ // Don't use this in your code.
201
+ #define GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, on_failure)\
202
+ GTEST_ASSERT_(pred_format(#v1, #v2, #v3, v1, v2, v3), \
203
+ on_failure)
204
+
205
+ // Internal macro for implementing {EXPECT|ASSERT}_PRED3. Don't use
206
+ // this in your code.
207
+ #define GTEST_PRED3_(pred, v1, v2, v3, on_failure)\
208
+ GTEST_ASSERT_(::testing::AssertPred3Helper(#pred, \
209
+ #v1, \
210
+ #v2, \
211
+ #v3, \
212
+ pred, \
213
+ v1, \
214
+ v2, \
215
+ v3), on_failure)
216
+
217
+ // Ternary predicate assertion macros.
218
+ #define EXPECT_PRED_FORMAT3(pred_format, v1, v2, v3) \
219
+ GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_NONFATAL_FAILURE_)
220
+ #define EXPECT_PRED3(pred, v1, v2, v3) \
221
+ GTEST_PRED3_(pred, v1, v2, v3, GTEST_NONFATAL_FAILURE_)
222
+ #define ASSERT_PRED_FORMAT3(pred_format, v1, v2, v3) \
223
+ GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_FATAL_FAILURE_)
224
+ #define ASSERT_PRED3(pred, v1, v2, v3) \
225
+ GTEST_PRED3_(pred, v1, v2, v3, GTEST_FATAL_FAILURE_)
226
+
227
+
228
+
229
+ // Helper function for implementing {EXPECT|ASSERT}_PRED4. Don't use
230
+ // this in your code.
231
+ template <typename Pred,
232
+ typename T1,
233
+ typename T2,
234
+ typename T3,
235
+ typename T4>
236
+ AssertionResult AssertPred4Helper(const char* pred_text,
237
+ const char* e1,
238
+ const char* e2,
239
+ const char* e3,
240
+ const char* e4,
241
+ Pred pred,
242
+ const T1& v1,
243
+ const T2& v2,
244
+ const T3& v3,
245
+ const T4& v4) {
246
+ if (pred(v1, v2, v3, v4)) return AssertionSuccess();
247
+
248
+ return AssertionFailure()
249
+ << pred_text << "(" << e1 << ", " << e2 << ", " << e3 << ", " << e4
250
+ << ") evaluates to false, where"
251
+ << "\n"
252
+ << e1 << " evaluates to " << ::testing::PrintToString(v1) << "\n"
253
+ << e2 << " evaluates to " << ::testing::PrintToString(v2) << "\n"
254
+ << e3 << " evaluates to " << ::testing::PrintToString(v3) << "\n"
255
+ << e4 << " evaluates to " << ::testing::PrintToString(v4);
256
+ }
257
+
258
+ // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT4.
259
+ // Don't use this in your code.
260
+ #define GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, on_failure)\
261
+ GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, v1, v2, v3, v4), \
262
+ on_failure)
263
+
264
+ // Internal macro for implementing {EXPECT|ASSERT}_PRED4. Don't use
265
+ // this in your code.
266
+ #define GTEST_PRED4_(pred, v1, v2, v3, v4, on_failure)\
267
+ GTEST_ASSERT_(::testing::AssertPred4Helper(#pred, \
268
+ #v1, \
269
+ #v2, \
270
+ #v3, \
271
+ #v4, \
272
+ pred, \
273
+ v1, \
274
+ v2, \
275
+ v3, \
276
+ v4), on_failure)
277
+
278
+ // 4-ary predicate assertion macros.
279
+ #define EXPECT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \
280
+ GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_)
281
+ #define EXPECT_PRED4(pred, v1, v2, v3, v4) \
282
+ GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_)
283
+ #define ASSERT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \
284
+ GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)
285
+ #define ASSERT_PRED4(pred, v1, v2, v3, v4) \
286
+ GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)
287
+
288
+
289
+
290
+ // Helper function for implementing {EXPECT|ASSERT}_PRED5. Don't use
291
+ // this in your code.
292
+ template <typename Pred,
293
+ typename T1,
294
+ typename T2,
295
+ typename T3,
296
+ typename T4,
297
+ typename T5>
298
+ AssertionResult AssertPred5Helper(const char* pred_text,
299
+ const char* e1,
300
+ const char* e2,
301
+ const char* e3,
302
+ const char* e4,
303
+ const char* e5,
304
+ Pred pred,
305
+ const T1& v1,
306
+ const T2& v2,
307
+ const T3& v3,
308
+ const T4& v4,
309
+ const T5& v5) {
310
+ if (pred(v1, v2, v3, v4, v5)) return AssertionSuccess();
311
+
312
+ return AssertionFailure()
313
+ << pred_text << "(" << e1 << ", " << e2 << ", " << e3 << ", " << e4
314
+ << ", " << e5 << ") evaluates to false, where"
315
+ << "\n"
316
+ << e1 << " evaluates to " << ::testing::PrintToString(v1) << "\n"
317
+ << e2 << " evaluates to " << ::testing::PrintToString(v2) << "\n"
318
+ << e3 << " evaluates to " << ::testing::PrintToString(v3) << "\n"
319
+ << e4 << " evaluates to " << ::testing::PrintToString(v4) << "\n"
320
+ << e5 << " evaluates to " << ::testing::PrintToString(v5);
321
+ }
322
+
323
+ // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT5.
324
+ // Don't use this in your code.
325
+ #define GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, on_failure)\
326
+ GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, #v5, v1, v2, v3, v4, v5), \
327
+ on_failure)
328
+
329
+ // Internal macro for implementing {EXPECT|ASSERT}_PRED5. Don't use
330
+ // this in your code.
331
+ #define GTEST_PRED5_(pred, v1, v2, v3, v4, v5, on_failure)\
332
+ GTEST_ASSERT_(::testing::AssertPred5Helper(#pred, \
333
+ #v1, \
334
+ #v2, \
335
+ #v3, \
336
+ #v4, \
337
+ #v5, \
338
+ pred, \
339
+ v1, \
340
+ v2, \
341
+ v3, \
342
+ v4, \
343
+ v5), on_failure)
344
+
345
+ // 5-ary predicate assertion macros.
346
+ #define EXPECT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \
347
+ GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_)
348
+ #define EXPECT_PRED5(pred, v1, v2, v3, v4, v5) \
349
+ GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_)
350
+ #define ASSERT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \
351
+ GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)
352
+ #define ASSERT_PRED5(pred, v1, v2, v3, v4, v5) \
353
+ GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)
354
+
355
+
356
+
357
+ } // namespace testing
358
+
359
+ #endif // GOOGLETEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
data/miniconda3/include/gtest/gtest_prod.h ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright 2006, Google Inc.
2
+ // All rights reserved.
3
+ //
4
+ // Redistribution and use in source and binary forms, with or without
5
+ // modification, are permitted provided that the following conditions are
6
+ // met:
7
+ //
8
+ // * Redistributions of source code must retain the above copyright
9
+ // notice, this list of conditions and the following disclaimer.
10
+ // * Redistributions in binary form must reproduce the above
11
+ // copyright notice, this list of conditions and the following disclaimer
12
+ // in the documentation and/or other materials provided with the
13
+ // distribution.
14
+ // * Neither the name of Google Inc. nor the names of its
15
+ // contributors may be used to endorse or promote products derived from
16
+ // this software without specific prior written permission.
17
+ //
18
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+
30
+ //
31
+ // Google C++ Testing and Mocking Framework definitions useful in production code.
32
+ // GOOGLETEST_CM0003 DO NOT DELETE
33
+
34
+ #ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_PROD_H_
35
+ #define GOOGLETEST_INCLUDE_GTEST_GTEST_PROD_H_
36
+
37
+ // When you need to test the private or protected members of a class,
38
+ // use the FRIEND_TEST macro to declare your tests as friends of the
39
+ // class. For example:
40
+ //
41
+ // class MyClass {
42
+ // private:
43
+ // void PrivateMethod();
44
+ // FRIEND_TEST(MyClassTest, PrivateMethodWorks);
45
+ // };
46
+ //
47
+ // class MyClassTest : public testing::Test {
48
+ // // ...
49
+ // };
50
+ //
51
+ // TEST_F(MyClassTest, PrivateMethodWorks) {
52
+ // // Can call MyClass::PrivateMethod() here.
53
+ // }
54
+ //
55
+ // Note: The test class must be in the same namespace as the class being tested.
56
+ // For example, putting MyClassTest in an anonymous namespace will not work.
57
+
58
+ #define FRIEND_TEST(test_case_name, test_name)\
59
+ friend class test_case_name##_##test_name##_Test
60
+
61
+ #endif // GOOGLETEST_INCLUDE_GTEST_GTEST_PROD_H_
data/miniconda3/include/nghttp2/nghttp2.h ADDED
The diff for this file is too large to render. See raw diff
 
data/miniconda3/include/nghttp2/nghttp2ver.h ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * nghttp2 - HTTP/2 C Library
3
+ *
4
+ * Copyright (c) 2012, 2013 Tatsuhiro Tsujikawa
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining
7
+ * a copy of this software and associated documentation files (the
8
+ * "Software"), to deal in the Software without restriction, including
9
+ * without limitation the rights to use, copy, modify, merge, publish,
10
+ * distribute, sublicense, and/or sell copies of the Software, and to
11
+ * permit persons to whom the Software is furnished to do so, subject to
12
+ * the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be
15
+ * included in all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
+ */
25
+ #ifndef NGHTTP2VER_H
26
+ #define NGHTTP2VER_H
27
+
28
+ /**
29
+ * @macro
30
+ * Version number of the nghttp2 library release
31
+ */
32
+ #define NGHTTP2_VERSION "1.67.1"
33
+
34
+ /**
35
+ * @macro
36
+ * Numerical representation of the version number of the nghttp2 library
37
+ * release. This is a 24 bit number with 8 bits for major number, 8 bits
38
+ * for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203.
39
+ */
40
+ #define NGHTTP2_VERSION_NUM 0x014301
41
+
42
+ #endif /* NGHTTP2VER_H */
data/miniconda3/include/reproc++/arguments.hpp ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ #include <reproc++/detail/array.hpp>
4
+ #include <reproc++/detail/type_traits.hpp>
5
+
6
+ namespace reproc {
7
+
8
+ class arguments : public detail::array {
9
+ public:
10
+ arguments(const char *const *argv) // NOLINT
11
+ : detail::array(argv, false)
12
+ {}
13
+
14
+ /*!
15
+ `Arguments` must be iterable as a sequence of strings. Examples of types that
16
+ satisfy this requirement are `std::vector<std::string>` and
17
+ `std::array<std::string>`.
18
+
19
+ `arguments` has the same restrictions as `argv` in `reproc_start` except
20
+ that it should not end with `NULL` (`start` allocates a new array which
21
+ includes the missing `NULL` value).
22
+ */
23
+ template <typename Arguments,
24
+ typename = detail::enable_if_not_char_array<Arguments>>
25
+ arguments(const Arguments &arguments) // NOLINT
26
+ : detail::array(from(arguments), true)
27
+ {}
28
+
29
+ private:
30
+ template <typename Arguments>
31
+ static const char *const *from(const Arguments &arguments);
32
+ };
33
+
34
+ template <typename Arguments>
35
+ const char *const *arguments::from(const Arguments &arguments)
36
+ {
37
+ using size_type = typename Arguments::value_type::size_type;
38
+
39
+ const char **argv = new const char *[arguments.size() + 1];
40
+ std::size_t current = 0;
41
+
42
+ for (const auto &argument : arguments) {
43
+ char *string = new char[argument.size() + 1];
44
+
45
+ argv[current++] = string;
46
+
47
+ for (size_type i = 0; i < argument.size(); i++) {
48
+ *string++ = argument[i];
49
+ }
50
+
51
+ *string = '\0';
52
+ }
53
+
54
+ argv[current] = nullptr;
55
+
56
+ return argv;
57
+ }
58
+
59
+ }
data/miniconda3/include/reproc++/drain.hpp ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ #include <mutex>
4
+ #include <ostream>
5
+ #include <string>
6
+
7
+ #include <reproc++/reproc.hpp>
8
+
9
+ namespace reproc {
10
+
11
+ /*!
12
+ `reproc_drain` but takes lambdas as sinks. Return an error code from a sink to
13
+ break out of `drain` early. `out` and `err` expect the following signature:
14
+
15
+ ```c++
16
+ std::error_code sink(stream stream, const uint8_t *buffer, size_t size);
17
+ ```
18
+ */
19
+ template <typename Out, typename Err>
20
+ std::error_code drain(process &process, Out &&out, Err &&err)
21
+ {
22
+ static constexpr uint8_t initial = 0;
23
+ std::error_code ec;
24
+
25
+ // A single call to `read` might contain multiple messages. By always calling
26
+ // both sinks once with no data before reading, we give them the chance to
27
+ // process all previous output before reading from the child process again.
28
+
29
+ ec = out(stream::in, &initial, 0);
30
+ if (ec) {
31
+ return ec;
32
+ }
33
+
34
+ ec = err(stream::in, &initial, 0);
35
+ if (ec) {
36
+ return ec;
37
+ }
38
+
39
+ static constexpr size_t BUFFER_SIZE = 4096;
40
+ uint8_t buffer[BUFFER_SIZE] = {};
41
+
42
+ for (;;) {
43
+ int events = 0;
44
+ std::tie(events, ec) = process.poll(event::out | event::err, infinite);
45
+ if (ec) {
46
+ ec = ec == error::broken_pipe ? std::error_code() : ec;
47
+ break;
48
+ }
49
+
50
+ if (events & event::deadline) {
51
+ ec = std::make_error_code(std::errc::timed_out);
52
+ break;
53
+ }
54
+
55
+ stream stream = events & event::out ? stream::out : stream::err;
56
+
57
+ size_t bytes_read = 0;
58
+ std::tie(bytes_read, ec) = process.read(stream, buffer, BUFFER_SIZE);
59
+ if (ec && ec != error::broken_pipe) {
60
+ break;
61
+ }
62
+
63
+ bytes_read = ec == error::broken_pipe ? 0 : bytes_read;
64
+
65
+ // This used to be `auto &sink = stream == stream::out ? out : err;` but
66
+ // that doesn't actually work if `out` and `err` are not the same type.
67
+ if (stream == stream::out) {
68
+ ec = out(stream, buffer, bytes_read);
69
+ } else {
70
+ ec = err(stream, buffer, bytes_read);
71
+ }
72
+
73
+ if (ec) {
74
+ break;
75
+ }
76
+ }
77
+
78
+ return ec;
79
+ }
80
+
81
+ namespace sink {
82
+
83
+ /*! Reads all output into `string`. */
84
+ class string {
85
+ std::string &string_;
86
+
87
+ public:
88
+ explicit string(std::string &string) noexcept : string_(string) {}
89
+
90
+ std::error_code operator()(stream stream, const uint8_t *buffer, size_t size)
91
+ {
92
+ (void) stream;
93
+ string_.append(reinterpret_cast<const char *>(buffer), size);
94
+ return {};
95
+ }
96
+ };
97
+
98
+ /*! Forwards all output to `ostream`. */
99
+ class ostream {
100
+ std::ostream &ostream_;
101
+
102
+ public:
103
+ explicit ostream(std::ostream &ostream) noexcept : ostream_(ostream) {}
104
+
105
+ std::error_code operator()(stream stream, const uint8_t *buffer, size_t size)
106
+ {
107
+ (void) stream;
108
+ ostream_.write(reinterpret_cast<const char *>(buffer),
109
+ static_cast<std::streamsize>(size));
110
+ return {};
111
+ }
112
+ };
113
+
114
+ /*! Discards all output. */
115
+ class discard {
116
+ public:
117
+ std::error_code
118
+ operator()(stream stream, const uint8_t *buffer, size_t size) const noexcept
119
+ {
120
+ (void) stream;
121
+ (void) buffer;
122
+ (void) size;
123
+
124
+ return {};
125
+ }
126
+ };
127
+
128
+ constexpr discard null = discard();
129
+
130
+ namespace thread_safe {
131
+
132
+ /*! `sink::string` but locks the given mutex before invoking the sink. */
133
+ class string {
134
+ sink::string sink_;
135
+ std::mutex &mutex_;
136
+
137
+ public:
138
+ string(std::string &string, std::mutex &mutex) noexcept
139
+ : sink_(string), mutex_(mutex)
140
+ {}
141
+
142
+ std::error_code operator()(stream stream, const uint8_t *buffer, size_t size)
143
+ {
144
+ std::lock_guard<std::mutex> lock(mutex_);
145
+ return sink_(stream, buffer, size);
146
+ }
147
+ };
148
+
149
+ }
150
+
151
+ }
152
+ }
data/miniconda3/include/reproc++/env.hpp ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ #include <reproc++/detail/array.hpp>
4
+ #include <reproc++/detail/type_traits.hpp>
5
+
6
+ namespace reproc {
7
+
8
+ class env : public detail::array {
9
+ public:
10
+ enum type {
11
+ extend,
12
+ empty,
13
+ };
14
+
15
+ env(const char *const *envp = nullptr) // NOLINT
16
+ : detail::array(envp, false)
17
+ {}
18
+
19
+ /*!
20
+ `Env` must be iterable as a sequence of string pairs. Examples of
21
+ types that satisfy this requirement are `std::vector<std::pair<std::string,
22
+ std::string>>` and `std::map<std::string, std::string>`.
23
+
24
+ The pairs in `env` represent the extra environment variables of the child
25
+ process and are converted to the right format before being passed as the
26
+ environment to `reproc_start` via the `env.extra` field of `reproc_options`.
27
+ */
28
+ template <typename Env,
29
+ typename = detail::enable_if_not_char_array<Env>>
30
+ env(const Env &env) // NOLINT
31
+ : detail::array(from(env), true)
32
+ {}
33
+
34
+ private:
35
+ template <typename Env>
36
+ static const char *const *from(const Env &env);
37
+ };
38
+
39
+ template <typename Env>
40
+ const char *const *env::from(const Env &env)
41
+ {
42
+ using name_size_type = typename Env::value_type::first_type::size_type;
43
+ using value_size_type = typename Env::value_type::second_type::size_type;
44
+
45
+ const char **envp = new const char *[env.size() + 1];
46
+ std::size_t current = 0;
47
+
48
+ for (const auto &entry : env) {
49
+ const auto &name = entry.first;
50
+ const auto &value = entry.second;
51
+
52
+ // We add 2 to the size to reserve space for the '=' sign and the NUL
53
+ // terminator at the end of the string.
54
+ char *string = new char[name.size() + value.size() + 2];
55
+
56
+ envp[current++] = string;
57
+
58
+ for (name_size_type i = 0; i < name.size(); i++) {
59
+ *string++ = name[i];
60
+ }
61
+
62
+ *string++ = '=';
63
+
64
+ for (value_size_type i = 0; i < value.size(); i++) {
65
+ *string++ = value[i];
66
+ }
67
+
68
+ *string = '\0';
69
+ }
70
+
71
+ envp[current] = nullptr;
72
+
73
+ return envp;
74
+ }
75
+
76
+ }
data/miniconda3/include/reproc++/export.hpp ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ #ifndef REPROCXX_EXPORT
4
+ #ifdef _WIN32
5
+ #ifdef REPROCXX_SHARED
6
+ #ifdef REPROCXX_BUILDING
7
+ #define REPROCXX_EXPORT __declspec(dllexport)
8
+ #else
9
+ #define REPROCXX_EXPORT __declspec(dllimport)
10
+ #endif
11
+ #else
12
+ #define REPROCXX_EXPORT
13
+ #endif
14
+ #else
15
+ #ifdef REPROCXX_BUILDING
16
+ #define REPROCXX_EXPORT __attribute__((visibility("default")))
17
+ #else
18
+ #define REPROCXX_EXPORT
19
+ #endif
20
+ #endif
21
+ #endif
data/miniconda3/include/reproc++/input.hpp ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ #include <cstddef>
4
+ #include <cstdint>
5
+
6
+ namespace reproc {
7
+
8
+ class input {
9
+ const uint8_t *data_ = nullptr;
10
+ size_t size_ = 0;
11
+
12
+ public:
13
+ input() = default;
14
+
15
+ input(const uint8_t *data, size_t size) : data_(data), size_(size) {}
16
+
17
+ /*! Implicitly convert from string literals. */
18
+ template <size_t N>
19
+ input(const char (&data)[N]) // NOLINT
20
+ : data_(reinterpret_cast<const uint8_t *>(data)), size_(N)
21
+ {}
22
+
23
+ input(const input &other) = default;
24
+ input &operator=(const input &) = default;
25
+
26
+ const uint8_t *data() const noexcept
27
+ {
28
+ return data_;
29
+ }
30
+
31
+ size_t size() const noexcept
32
+ {
33
+ return size_;
34
+ }
35
+ };
36
+
37
+ }
data/miniconda3/include/reproc++/reproc.hpp ADDED
@@ -0,0 +1,223 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ #include <chrono>
4
+ #include <cstdint>
5
+ #include <cstdio>
6
+ #include <memory>
7
+ #include <system_error>
8
+ #include <utility>
9
+
10
+ #include <reproc++/arguments.hpp>
11
+ #include <reproc++/env.hpp>
12
+ #include <reproc++/export.hpp>
13
+ #include <reproc++/input.hpp>
14
+
15
+ // Forward declare `reproc_t` so we don't have to include reproc.h in the
16
+ // header.
17
+ struct reproc_t;
18
+
19
+ /*! The `reproc` namespace wraps all reproc++ declarations. `process` wraps
20
+ reproc's API inside a C++ class. To avoid exposing reproc's API when using
21
+ reproc++ all structs, enums and constants of reproc have a replacement in
22
+ reproc++. Only differences in behaviour compared to reproc are documented. Refer
23
+ to reproc.h and the examples for general information on how to use reproc. */
24
+ namespace reproc {
25
+
26
+ /*! Conversion from reproc `errno` constants to `std::errc` constants:
27
+ https://en.cppreference.com/w/cpp/error/errc */
28
+ using error = std::errc;
29
+
30
+ namespace signal {
31
+
32
+ REPROCXX_EXPORT extern const int kill;
33
+ REPROCXX_EXPORT extern const int terminate;
34
+
35
+ }
36
+
37
+ /*! Timeout values are passed as `reproc::milliseconds` instead of `int` in
38
+ reproc++. */
39
+ using milliseconds = std::chrono::duration<int, std::milli>;
40
+
41
+ REPROCXX_EXPORT extern const milliseconds infinite;
42
+ REPROCXX_EXPORT extern const milliseconds deadline;
43
+
44
+ enum class stop {
45
+ noop,
46
+ wait,
47
+ terminate,
48
+ kill,
49
+ };
50
+
51
+ struct stop_action {
52
+ stop action;
53
+ milliseconds timeout;
54
+ };
55
+
56
+ struct stop_actions {
57
+ stop_action first;
58
+ stop_action second;
59
+ stop_action third;
60
+ };
61
+
62
+ #if defined(_WIN32)
63
+ using handle = void *;
64
+ #else
65
+ using handle = int;
66
+ #endif
67
+
68
+ struct redirect {
69
+ enum type {
70
+ default_, // Unfortunately, both `default` and `auto` are keywords.
71
+ pipe,
72
+ parent,
73
+ discard,
74
+ // stdout would conflict with a macro on Windows.
75
+ stdout_,
76
+ // Unfortunately, class members and nested enum members can't have the same
77
+ // name.
78
+ handle_,
79
+ file_,
80
+ path_,
81
+ };
82
+
83
+ enum type type;
84
+ reproc::handle handle;
85
+ FILE *file;
86
+ const char *path;
87
+ };
88
+
89
+ struct options {
90
+ struct {
91
+ env::type behavior;
92
+ /*! Implicitly converts from any STL container of string pairs to the
93
+ environment format expected by `reproc_start`. */
94
+ class env extra;
95
+ } env = {};
96
+
97
+ const char *working_directory = nullptr;
98
+
99
+ struct {
100
+ redirect in;
101
+ redirect out;
102
+ redirect err;
103
+ bool parent;
104
+ bool discard;
105
+ FILE *file;
106
+ const char *path;
107
+ } redirect = {};
108
+
109
+ struct stop_actions stop = {};
110
+ reproc::milliseconds timeout = reproc::milliseconds(0);
111
+ reproc::milliseconds deadline = reproc::milliseconds(0);
112
+ /*! Implicitly converts from string literals to the pointer size pair expected
113
+ by `reproc_start`. */
114
+ class input input;
115
+ bool nonblocking = false;
116
+
117
+ /*! Make a shallow copy of `options`. */
118
+ static options clone(const options &other)
119
+ {
120
+ struct options clone;
121
+ clone.env.behavior = other.env.behavior;
122
+ // Make sure we make a shallow copy of `environment`.
123
+ clone.env.extra = other.env.extra.data();
124
+ clone.working_directory = other.working_directory;
125
+ clone.redirect = other.redirect;
126
+ clone.stop = other.stop;
127
+ clone.timeout = other.timeout;
128
+ clone.deadline = other.deadline;
129
+ clone.input = other.input;
130
+
131
+ return clone;
132
+ }
133
+ };
134
+
135
+ enum class stream {
136
+ in,
137
+ out,
138
+ err,
139
+ };
140
+
141
+ class process;
142
+
143
+ namespace event {
144
+
145
+ enum {
146
+ in = 1 << 0,
147
+ out = 1 << 1,
148
+ err = 1 << 2,
149
+ exit = 1 << 3,
150
+ deadline = 1 << 4,
151
+ };
152
+
153
+ struct source {
154
+ class process &process;
155
+ int interests;
156
+ int events;
157
+ };
158
+
159
+ }
160
+
161
+ REPROCXX_EXPORT std::error_code poll(event::source *sources,
162
+ size_t num_sources,
163
+ milliseconds timeout = infinite);
164
+
165
+ /*! Improves on reproc's API by adding RAII and changing the API of some
166
+ functions to be more idiomatic C++. */
167
+ class process {
168
+
169
+ public:
170
+ REPROCXX_EXPORT process();
171
+ REPROCXX_EXPORT ~process() noexcept;
172
+
173
+ // Enforce unique ownership of child processes.
174
+ REPROCXX_EXPORT process(process &&other) noexcept;
175
+ REPROCXX_EXPORT process &operator=(process &&other) noexcept;
176
+
177
+ /*! `reproc_start` but implicitly converts from STL containers to the
178
+ arguments format expected by `reproc_start`. */
179
+ REPROCXX_EXPORT std::error_code start(const arguments &arguments,
180
+ const options &options = {}) noexcept;
181
+
182
+ REPROCXX_EXPORT std::pair<int, std::error_code> pid() noexcept;
183
+
184
+ /*! Sets the `fork` option in `reproc_options` and calls `start`. Returns
185
+ `true` in the child process and `false` in the parent process. */
186
+ REPROCXX_EXPORT std::pair<bool, std::error_code>
187
+ fork(const options &options = {}) noexcept;
188
+
189
+ /*! Shorthand for `reproc::poll` that only polls this process. Returns a pair
190
+ of (events, error). */
191
+ REPROCXX_EXPORT std::pair<int, std::error_code>
192
+ poll(int interests, milliseconds timeout = infinite);
193
+
194
+ /*! `reproc_read` but returns a pair of (bytes read, error). */
195
+ REPROCXX_EXPORT std::pair<size_t, std::error_code>
196
+ read(stream stream, uint8_t *buffer, size_t size) noexcept;
197
+
198
+ /*! reproc_write` but returns a pair of (bytes_written, error). */
199
+ REPROCXX_EXPORT std::pair<size_t, std::error_code>
200
+ write(const uint8_t *buffer, size_t size) noexcept;
201
+
202
+ REPROCXX_EXPORT std::error_code close(stream stream) noexcept;
203
+
204
+ /*! `reproc_wait` but returns a pair of (status, error). */
205
+ REPROCXX_EXPORT std::pair<int, std::error_code>
206
+ wait(milliseconds timeout) noexcept;
207
+
208
+ REPROCXX_EXPORT std::error_code terminate() noexcept;
209
+
210
+ REPROCXX_EXPORT std::error_code kill() noexcept;
211
+
212
+ /*! `reproc_stop` but returns a pair of (status, error). */
213
+ REPROCXX_EXPORT std::pair<int, std::error_code>
214
+ stop(stop_actions stop) noexcept;
215
+
216
+ private:
217
+ REPROCXX_EXPORT friend std::error_code
218
+ poll(event::source *sources, size_t num_sources, milliseconds timeout);
219
+
220
+ std::unique_ptr<reproc_t, reproc_t *(*) (reproc_t *)> impl_;
221
+ };
222
+
223
+ }