1#![doc = include_str!("../README.md")]
2
3use use_friend::{FigureKind, Friend, IdentityKind, TechnologyKind};
6
7pub struct FriendFixtures;
9
10impl FriendFixtures {
11 #[must_use]
13 pub fn tiny() -> &'static [Friend] {
14 &ALL_FRIENDS[..3]
15 }
16
17 #[must_use]
19 pub fn small() -> &'static [Friend] {
20 &ALL_FRIENDS[..6]
21 }
22
23 #[must_use]
25 pub fn all() -> &'static [Friend] {
26 &ALL_FRIENDS
27 }
28}
29
30const ALL_FRIENDS: [Friend; 34] = [
31 Friend {
32 id: "rust-ferris",
33 name: "Ferris",
34 ecosystem: "Rust",
35 technology_kind: TechnologyKind::ProgrammingLanguage,
36 identity_kind: IdentityKind::UnofficialMascot,
37 figure_kind: FigureKind::Animal,
38 form: Some("crab"),
39 tags: &["rust", "crab", "community", "mascot"],
40 notes: "Friendly crab associated with the Rust community.",
41 },
42 Friend {
43 id: "go-gopher",
44 name: "Go Gopher",
45 ecosystem: "Go",
46 technology_kind: TechnologyKind::ProgrammingLanguage,
47 identity_kind: IdentityKind::Mascot,
48 figure_kind: FigureKind::Animal,
49 form: Some("gopher"),
50 tags: &["go", "gopher", "community", "mascot"],
51 notes: "Gopher character commonly associated with the Go ecosystem.",
52 },
53 Friend {
54 id: "linux-tux",
55 name: "Tux",
56 ecosystem: "Linux",
57 technology_kind: TechnologyKind::OperatingSystem,
58 identity_kind: IdentityKind::Mascot,
59 figure_kind: FigureKind::Animal,
60 form: Some("penguin"),
61 tags: &["linux", "penguin", "operating-system", "mascot"],
62 notes: "Penguin mascot associated with Linux examples and communities.",
63 },
64 Friend {
65 id: "postgresql-slonik",
66 name: "Slonik",
67 ecosystem: "PostgreSQL",
68 technology_kind: TechnologyKind::Database,
69 identity_kind: IdentityKind::LogoCharacter,
70 figure_kind: FigureKind::Animal,
71 form: Some("elephant"),
72 tags: &["postgresql", "database", "elephant", "logo-character"],
73 notes: "Elephant character associated with PostgreSQL sample data.",
74 },
75 Friend {
76 id: "docker-moby-dock",
77 name: "Moby Dock",
78 ecosystem: "Docker",
79 technology_kind: TechnologyKind::Platform,
80 identity_kind: IdentityKind::LogoCharacter,
81 figure_kind: FigureKind::Animal,
82 form: Some("whale"),
83 tags: &["docker", "container", "whale", "logo-character"],
84 notes: "Whale character associated with Docker container examples.",
85 },
86 Friend {
87 id: "github-octocat",
88 name: "Octocat",
89 ecosystem: "GitHub",
90 technology_kind: TechnologyKind::Platform,
91 identity_kind: IdentityKind::LogoCharacter,
92 figure_kind: FigureKind::Creature,
93 form: Some("cat/octopus hybrid"),
94 tags: &["github", "platform", "hybrid", "logo-character"],
95 notes: "Hybrid character associated with GitHub-themed fixture examples.",
96 },
97 Friend {
98 id: "firefox-fox",
99 name: "Firefox Fox",
100 ecosystem: "Firefox",
101 technology_kind: TechnologyKind::Browser,
102 identity_kind: IdentityKind::LogoSymbol,
103 figure_kind: FigureKind::Animal,
104 form: Some("fox"),
105 tags: &["firefox", "browser", "fox", "logo-symbol"],
106 notes: "Fox-like symbol associated with Firefox browser examples.",
107 },
108 Friend {
109 id: "python-snakes",
110 name: "Python snakes",
111 ecosystem: "Python",
112 technology_kind: TechnologyKind::ProgrammingLanguage,
113 identity_kind: IdentityKind::LogoSymbol,
114 figure_kind: FigureKind::Animal,
115 form: Some("snakes"),
116 tags: &["python", "snakes", "programming-language", "logo-symbol"],
117 notes: "Snake symbols associated with Python ecosystem examples.",
118 },
119 Friend {
120 id: "openbsd-puffy",
121 name: "Puffy",
122 ecosystem: "OpenBSD",
123 technology_kind: TechnologyKind::OperatingSystem,
124 identity_kind: IdentityKind::Mascot,
125 figure_kind: FigureKind::Animal,
126 form: Some("pufferfish"),
127 tags: &["openbsd", "pufferfish", "operating-system", "mascot"],
128 notes: "Pufferfish mascot associated with OpenBSD examples.",
129 },
130 Friend {
131 id: "bsd-beastie",
132 name: "Beastie",
133 ecosystem: "BSD",
134 technology_kind: TechnologyKind::OperatingSystem,
135 identity_kind: IdentityKind::Mascot,
136 figure_kind: FigureKind::Creature,
137 form: Some("daemon"),
138 tags: &["bsd", "daemon", "operating-system", "mascot"],
139 notes: "Daemon character associated with BSD-themed fixture data.",
140 },
141 Friend {
142 id: "gimp-wilber",
143 name: "Wilber",
144 ecosystem: "GIMP",
145 technology_kind: TechnologyKind::DevTool,
146 identity_kind: IdentityKind::Mascot,
147 figure_kind: FigureKind::Creature,
148 form: Some("animal-like mascot"),
149 tags: &["gimp", "graphics", "dev-tool", "mascot"],
150 notes: "Animal-like mascot associated with GIMP examples.",
151 },
152 Friend {
153 id: "kde-konqi",
154 name: "Konqi",
155 ecosystem: "KDE",
156 technology_kind: TechnologyKind::Platform,
157 identity_kind: IdentityKind::Mascot,
158 figure_kind: FigureKind::Creature,
159 form: Some("dragon"),
160 tags: &["kde", "desktop", "dragon", "mascot"],
161 notes: "Dragon mascot associated with KDE community examples.",
162 },
163 Friend {
164 id: "java-duke",
165 name: "Duke",
166 ecosystem: "Java",
167 technology_kind: TechnologyKind::ProgrammingLanguage,
168 identity_kind: IdentityKind::Mascot,
169 figure_kind: FigureKind::Creature,
170 form: Some("creature"),
171 tags: &["java", "jvm", "language", "mascot"],
172 notes: "Mascot associated with Java.",
173 },
174 Friend {
175 id: "php-elephpant",
176 name: "elePHPant",
177 ecosystem: "PHP",
178 technology_kind: TechnologyKind::ProgrammingLanguage,
179 identity_kind: IdentityKind::Mascot,
180 figure_kind: FigureKind::Animal,
181 form: Some("elephant"),
182 tags: &["php", "web", "language", "elephant", "mascot"],
183 notes: "Elephant mascot associated with PHP.",
184 },
185 Friend {
186 id: "mysql-sakila",
187 name: "Sakila",
188 ecosystem: "MySQL",
189 technology_kind: TechnologyKind::Database,
190 identity_kind: IdentityKind::LogoCharacter,
191 figure_kind: FigureKind::Animal,
192 form: Some("dolphin"),
193 tags: &["mysql", "database", "sql", "dolphin", "logo-character"],
194 notes: "Dolphin logo character associated with MySQL.",
195 },
196 Friend {
197 id: "mariadb-sea-lion",
198 name: "MariaDB Sea Lion",
199 ecosystem: "MariaDB",
200 technology_kind: TechnologyKind::Database,
201 identity_kind: IdentityKind::LogoCharacter,
202 figure_kind: FigureKind::Animal,
203 form: Some("sea lion"),
204 tags: &["mariadb", "database", "sql", "sea-lion", "logo-character"],
205 notes: "Sea lion logo character associated with MariaDB.",
206 },
207 Friend {
208 id: "zig-zero-ziguana",
209 name: "Zero the Ziguana",
210 ecosystem: "Zig",
211 technology_kind: TechnologyKind::ProgrammingLanguage,
212 identity_kind: IdentityKind::Mascot,
213 figure_kind: FigureKind::Animal,
214 form: Some("iguana"),
215 tags: &["zig", "systems", "language", "iguana", "mascot"],
216 notes: "Iguana mascot associated with Zig.",
217 },
218 Friend {
219 id: "zig-ziggy-ziguana",
220 name: "Ziggy the Ziguana",
221 ecosystem: "Zig",
222 technology_kind: TechnologyKind::ProgrammingLanguage,
223 identity_kind: IdentityKind::Mascot,
224 figure_kind: FigureKind::Animal,
225 form: Some("iguana"),
226 tags: &["zig", "systems", "language", "iguana", "mascot"],
227 notes: "Iguana mascot associated with Zig.",
228 },
229 Friend {
230 id: "zig-carmen-allocgator",
231 name: "Carmen the Allocgator",
232 ecosystem: "Zig",
233 technology_kind: TechnologyKind::ProgrammingLanguage,
234 identity_kind: IdentityKind::Mascot,
235 figure_kind: FigureKind::Animal,
236 form: Some("alligator"),
237 tags: &[
238 "zig",
239 "systems",
240 "language",
241 "allocator",
242 "alligator",
243 "mascot",
244 ],
245 notes: "Alligator mascot associated with Zig allocation examples.",
246 },
247 Friend {
248 id: "dart-flutter-dash",
249 name: "Dash",
250 ecosystem: "Dart / Flutter",
251 technology_kind: TechnologyKind::Framework,
252 identity_kind: IdentityKind::Mascot,
253 figure_kind: FigureKind::Animal,
254 form: Some("hummingbird"),
255 tags: &["dart", "flutter", "ui", "mobile", "hummingbird", "mascot"],
256 notes: "Mascot associated with Dart and Flutter.",
257 },
258 Friend {
259 id: "dotnet-bot",
260 name: "dotnet bot",
261 ecosystem: ".NET",
262 technology_kind: TechnologyKind::Framework,
263 identity_kind: IdentityKind::Mascot,
264 figure_kind: FigureKind::Creature,
265 form: Some("robot"),
266 tags: &["dotnet", "framework", "runtime", "robot", "mascot"],
267 notes: "Robot mascot associated with .NET.",
268 },
269 Friend {
270 id: "plan-9-glenda",
271 name: "Glenda",
272 ecosystem: "Plan 9",
273 technology_kind: TechnologyKind::OperatingSystem,
274 identity_kind: IdentityKind::Mascot,
275 figure_kind: FigureKind::Animal,
276 form: Some("bunny"),
277 tags: &["plan-9", "operating-system", "bell-labs", "bunny", "mascot"],
278 notes: "Bunny mascot associated with Plan 9.",
279 },
280 Friend {
281 id: "gnu-head",
282 name: "GNU Head",
283 ecosystem: "GNU",
284 technology_kind: TechnologyKind::OperatingSystem,
285 identity_kind: IdentityKind::LogoSymbol,
286 figure_kind: FigureKind::Animal,
287 form: Some("gnu"),
288 tags: &["gnu", "free-software", "operating-system", "symbol"],
289 notes: "GNU head symbol associated with the GNU project.",
290 },
291 Friend {
292 id: "android-bot",
293 name: "Android Bot",
294 ecosystem: "Android",
295 technology_kind: TechnologyKind::Platform,
296 identity_kind: IdentityKind::LogoCharacter,
297 figure_kind: FigureKind::Creature,
298 form: Some("robot"),
299 tags: &["android", "mobile", "platform", "robot", "logo-character"],
300 notes: "Robot logo character associated with Android.",
301 },
302 Friend {
303 id: "raku-camelia",
304 name: "Camelia",
305 ecosystem: "Raku",
306 technology_kind: TechnologyKind::ProgrammingLanguage,
307 identity_kind: IdentityKind::Mascot,
308 figure_kind: FigureKind::Animal,
309 form: Some("butterfly"),
310 tags: &["raku", "language", "butterfly", "mascot"],
311 notes: "Butterfly mascot associated with Raku.",
312 },
313 Friend {
314 id: "perl-camel",
315 name: "Perl Camel",
316 ecosystem: "Perl",
317 technology_kind: TechnologyKind::ProgrammingLanguage,
318 identity_kind: IdentityKind::Symbol,
319 figure_kind: FigureKind::Animal,
320 form: Some("camel"),
321 tags: &["perl", "language", "camel", "symbol", "historical"],
322 notes: "Camel symbol commonly associated with Perl.",
323 },
324 Friend {
325 id: "deno-dinosaur",
326 name: "Deno Dinosaur",
327 ecosystem: "Deno",
328 technology_kind: TechnologyKind::Runtime,
329 identity_kind: IdentityKind::Mascot,
330 figure_kind: FigureKind::Animal,
331 form: Some("dinosaur"),
332 tags: &[
333 "deno",
334 "runtime",
335 "typescript",
336 "javascript",
337 "dinosaur",
338 "mascot",
339 ],
340 notes: "Dinosaur mascot associated with Deno.",
341 },
342 Friend {
343 id: "crystal-crow",
344 name: "Crystal Crow",
345 ecosystem: "Crystal",
346 technology_kind: TechnologyKind::ProgrammingLanguage,
347 identity_kind: IdentityKind::Mascot,
348 figure_kind: FigureKind::Animal,
349 form: Some("crow"),
350 tags: &["crystal", "language", "compiled", "crow", "mascot"],
351 notes: "Crow mascot associated with Crystal.",
352 },
353 Friend {
354 id: "opensuse-geeko",
355 name: "Geeko",
356 ecosystem: "openSUSE",
357 technology_kind: TechnologyKind::OperatingSystem,
358 identity_kind: IdentityKind::Mascot,
359 figure_kind: FigureKind::Animal,
360 form: Some("gecko"),
361 tags: &["opensuse", "suse", "linux", "gecko", "mascot"],
362 notes: "Gecko mascot associated with openSUSE.",
363 },
364 Friend {
365 id: "linux-libre-freedo",
366 name: "Freedo",
367 ecosystem: "Linux-libre",
368 technology_kind: TechnologyKind::OperatingSystem,
369 identity_kind: IdentityKind::Mascot,
370 figure_kind: FigureKind::Animal,
371 form: Some("penguin"),
372 tags: &[
373 "linux-libre",
374 "free-software",
375 "kernel",
376 "penguin",
377 "mascot",
378 ],
379 notes: "Penguin mascot associated with Linux-libre.",
380 },
381 Friend {
382 id: "d-d-man",
383 name: "D-Man",
384 ecosystem: "D",
385 technology_kind: TechnologyKind::ProgrammingLanguage,
386 identity_kind: IdentityKind::Mascot,
387 figure_kind: FigureKind::HumanLike,
388 form: Some("character"),
389 tags: &["d", "language", "systems", "mascot"],
390 notes: "Mascot character associated with the D programming language.",
391 },
392 Friend {
393 id: "nix-nixos-snowflake",
394 name: "Nix Snowflake",
395 ecosystem: "Nix / NixOS",
396 technology_kind: TechnologyKind::PackageManager,
397 identity_kind: IdentityKind::LogoSymbol,
398 figure_kind: FigureKind::Symbol,
399 form: Some("snowflake"),
400 tags: &[
401 "nix",
402 "nixos",
403 "package-manager",
404 "builds",
405 "snowflake",
406 "symbol",
407 ],
408 notes: "Snowflake symbol associated with Nix and NixOS.",
409 },
410 Friend {
411 id: "jenkins-butler",
412 name: "Jenkins Butler",
413 ecosystem: "Jenkins",
414 technology_kind: TechnologyKind::DevTool,
415 identity_kind: IdentityKind::LogoCharacter,
416 figure_kind: FigureKind::HumanLike,
417 form: Some("butler"),
418 tags: &[
419 "jenkins",
420 "ci",
421 "cd",
422 "automation",
423 "butler",
424 "logo-character",
425 ],
426 notes: "Butler logo character associated with Jenkins.",
427 },
428 Friend {
429 id: "apache-hadoop-elephant",
430 name: "Hadoop Elephant",
431 ecosystem: "Apache Hadoop",
432 technology_kind: TechnologyKind::Platform,
433 identity_kind: IdentityKind::LogoCharacter,
434 figure_kind: FigureKind::Animal,
435 form: Some("elephant"),
436 tags: &["hadoop", "apache", "big-data", "elephant", "logo-character"],
437 notes: "Elephant logo character associated with Apache Hadoop.",
438 },
439];
440
441#[cfg(test)]
442mod tests {
443 use super::FriendFixtures;
444 use use_friend::{FigureKind, IdentityKind, TechnologyKind};
445
446 #[test]
447 fn exposes_expected_fixture_lengths() {
448 assert_eq!(FriendFixtures::tiny().len(), 3);
449 assert_eq!(FriendFixtures::small().len(), 6);
450 assert_eq!(FriendFixtures::all().len(), 34);
451 }
452
453 #[test]
454 fn preserves_deterministic_order() {
455 let friends = FriendFixtures::all();
456
457 assert_eq!(friends[0].id, "rust-ferris");
458 assert_eq!(friends[1].id, "go-gopher");
459 assert_eq!(friends[2].id, "linux-tux");
460 assert_eq!(friends[11].id, "kde-konqi");
461 assert_eq!(friends[33].id, "apache-hadoop-elephant");
462 }
463
464 #[test]
465 fn includes_conservative_expected_metadata() {
466 let ferris = &FriendFixtures::all()[0];
467 let octocat = &FriendFixtures::all()[5];
468
469 assert_eq!(ferris.ecosystem, "Rust");
470 assert_eq!(ferris.form, Some("crab"));
471 assert_eq!(ferris.identity_kind, IdentityKind::UnofficialMascot);
472 assert_eq!(ferris.technology_kind, TechnologyKind::ProgrammingLanguage);
473 assert_eq!(octocat.figure_kind, FigureKind::Creature);
474 assert!(FriendFixtures::all()
475 .iter()
476 .all(|friend| !friend.notes.contains("http")));
477 }
478
479 #[test]
480 fn includes_new_fixture_batch() {
481 let ids: Vec<_> = FriendFixtures::all()
482 .iter()
483 .map(|friend| friend.id)
484 .collect();
485 let expected_ids = [
486 "java-duke",
487 "php-elephpant",
488 "mysql-sakila",
489 "mariadb-sea-lion",
490 "zig-zero-ziguana",
491 "zig-ziggy-ziguana",
492 "zig-carmen-allocgator",
493 "dart-flutter-dash",
494 "dotnet-bot",
495 "plan-9-glenda",
496 "gnu-head",
497 "android-bot",
498 "raku-camelia",
499 "perl-camel",
500 "deno-dinosaur",
501 "crystal-crow",
502 "opensuse-geeko",
503 "linux-libre-freedo",
504 "d-d-man",
505 "nix-nixos-snowflake",
506 "jenkins-butler",
507 "apache-hadoop-elephant",
508 ];
509
510 for expected_id in expected_ids {
511 assert!(ids.contains(&expected_id));
512 }
513 }
514
515 #[test]
516 fn keeps_zig_records_in_request_order() {
517 let zig_names: Vec<_> = FriendFixtures::all()
518 .iter()
519 .filter(|friend| friend.matches_ecosystem("Zig"))
520 .map(|friend| friend.name)
521 .collect();
522
523 assert_eq!(
524 zig_names,
525 [
526 "Zero the Ziguana",
527 "Ziggy the Ziguana",
528 "Carmen the Allocgator",
529 ]
530 );
531 }
532}