use-friend-fixture 0.1.0

Deterministic Fellow Friends fixture records for RustUse
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
#![doc = include_str!("../README.md")]

//! Deterministic static Fellow Friends fixture records.

use use_friend::{FigureKind, Friend, IdentityKind, TechnologyKind};

/// Accessor type for deterministic Fellow Friends fixture slices.
pub struct FriendFixtures;

impl FriendFixtures {
    /// Returns the smallest useful fixture slice.
    #[must_use]
    pub fn tiny() -> &'static [Friend] {
        &ALL_FRIENDS[..3]
    }

    /// Returns a small fixture slice suitable for docs and examples.
    #[must_use]
    pub fn small() -> &'static [Friend] {
        &ALL_FRIENDS[..6]
    }

    /// Returns all bundled Fellow Friends fixture records.
    #[must_use]
    pub fn all() -> &'static [Friend] {
        &ALL_FRIENDS
    }
}

const ALL_FRIENDS: [Friend; 34] = [
    Friend {
        id: "rust-ferris",
        name: "Ferris",
        ecosystem: "Rust",
        technology_kind: TechnologyKind::ProgrammingLanguage,
        identity_kind: IdentityKind::UnofficialMascot,
        figure_kind: FigureKind::Animal,
        form: Some("crab"),
        tags: &["rust", "crab", "community", "mascot"],
        notes: "Friendly crab associated with the Rust community.",
    },
    Friend {
        id: "go-gopher",
        name: "Go Gopher",
        ecosystem: "Go",
        technology_kind: TechnologyKind::ProgrammingLanguage,
        identity_kind: IdentityKind::Mascot,
        figure_kind: FigureKind::Animal,
        form: Some("gopher"),
        tags: &["go", "gopher", "community", "mascot"],
        notes: "Gopher character commonly associated with the Go ecosystem.",
    },
    Friend {
        id: "linux-tux",
        name: "Tux",
        ecosystem: "Linux",
        technology_kind: TechnologyKind::OperatingSystem,
        identity_kind: IdentityKind::Mascot,
        figure_kind: FigureKind::Animal,
        form: Some("penguin"),
        tags: &["linux", "penguin", "operating-system", "mascot"],
        notes: "Penguin mascot associated with Linux examples and communities.",
    },
    Friend {
        id: "postgresql-slonik",
        name: "Slonik",
        ecosystem: "PostgreSQL",
        technology_kind: TechnologyKind::Database,
        identity_kind: IdentityKind::LogoCharacter,
        figure_kind: FigureKind::Animal,
        form: Some("elephant"),
        tags: &["postgresql", "database", "elephant", "logo-character"],
        notes: "Elephant character associated with PostgreSQL sample data.",
    },
    Friend {
        id: "docker-moby-dock",
        name: "Moby Dock",
        ecosystem: "Docker",
        technology_kind: TechnologyKind::Platform,
        identity_kind: IdentityKind::LogoCharacter,
        figure_kind: FigureKind::Animal,
        form: Some("whale"),
        tags: &["docker", "container", "whale", "logo-character"],
        notes: "Whale character associated with Docker container examples.",
    },
    Friend {
        id: "github-octocat",
        name: "Octocat",
        ecosystem: "GitHub",
        technology_kind: TechnologyKind::Platform,
        identity_kind: IdentityKind::LogoCharacter,
        figure_kind: FigureKind::Creature,
        form: Some("cat/octopus hybrid"),
        tags: &["github", "platform", "hybrid", "logo-character"],
        notes: "Hybrid character associated with GitHub-themed fixture examples.",
    },
    Friend {
        id: "firefox-fox",
        name: "Firefox Fox",
        ecosystem: "Firefox",
        technology_kind: TechnologyKind::Browser,
        identity_kind: IdentityKind::LogoSymbol,
        figure_kind: FigureKind::Animal,
        form: Some("fox"),
        tags: &["firefox", "browser", "fox", "logo-symbol"],
        notes: "Fox-like symbol associated with Firefox browser examples.",
    },
    Friend {
        id: "python-snakes",
        name: "Python snakes",
        ecosystem: "Python",
        technology_kind: TechnologyKind::ProgrammingLanguage,
        identity_kind: IdentityKind::LogoSymbol,
        figure_kind: FigureKind::Animal,
        form: Some("snakes"),
        tags: &["python", "snakes", "programming-language", "logo-symbol"],
        notes: "Snake symbols associated with Python ecosystem examples.",
    },
    Friend {
        id: "openbsd-puffy",
        name: "Puffy",
        ecosystem: "OpenBSD",
        technology_kind: TechnologyKind::OperatingSystem,
        identity_kind: IdentityKind::Mascot,
        figure_kind: FigureKind::Animal,
        form: Some("pufferfish"),
        tags: &["openbsd", "pufferfish", "operating-system", "mascot"],
        notes: "Pufferfish mascot associated with OpenBSD examples.",
    },
    Friend {
        id: "bsd-beastie",
        name: "Beastie",
        ecosystem: "BSD",
        technology_kind: TechnologyKind::OperatingSystem,
        identity_kind: IdentityKind::Mascot,
        figure_kind: FigureKind::Creature,
        form: Some("daemon"),
        tags: &["bsd", "daemon", "operating-system", "mascot"],
        notes: "Daemon character associated with BSD-themed fixture data.",
    },
    Friend {
        id: "gimp-wilber",
        name: "Wilber",
        ecosystem: "GIMP",
        technology_kind: TechnologyKind::DevTool,
        identity_kind: IdentityKind::Mascot,
        figure_kind: FigureKind::Creature,
        form: Some("animal-like mascot"),
        tags: &["gimp", "graphics", "dev-tool", "mascot"],
        notes: "Animal-like mascot associated with GIMP examples.",
    },
    Friend {
        id: "kde-konqi",
        name: "Konqi",
        ecosystem: "KDE",
        technology_kind: TechnologyKind::Platform,
        identity_kind: IdentityKind::Mascot,
        figure_kind: FigureKind::Creature,
        form: Some("dragon"),
        tags: &["kde", "desktop", "dragon", "mascot"],
        notes: "Dragon mascot associated with KDE community examples.",
    },
    Friend {
        id: "java-duke",
        name: "Duke",
        ecosystem: "Java",
        technology_kind: TechnologyKind::ProgrammingLanguage,
        identity_kind: IdentityKind::Mascot,
        figure_kind: FigureKind::Creature,
        form: Some("creature"),
        tags: &["java", "jvm", "language", "mascot"],
        notes: "Mascot associated with Java.",
    },
    Friend {
        id: "php-elephpant",
        name: "elePHPant",
        ecosystem: "PHP",
        technology_kind: TechnologyKind::ProgrammingLanguage,
        identity_kind: IdentityKind::Mascot,
        figure_kind: FigureKind::Animal,
        form: Some("elephant"),
        tags: &["php", "web", "language", "elephant", "mascot"],
        notes: "Elephant mascot associated with PHP.",
    },
    Friend {
        id: "mysql-sakila",
        name: "Sakila",
        ecosystem: "MySQL",
        technology_kind: TechnologyKind::Database,
        identity_kind: IdentityKind::LogoCharacter,
        figure_kind: FigureKind::Animal,
        form: Some("dolphin"),
        tags: &["mysql", "database", "sql", "dolphin", "logo-character"],
        notes: "Dolphin logo character associated with MySQL.",
    },
    Friend {
        id: "mariadb-sea-lion",
        name: "MariaDB Sea Lion",
        ecosystem: "MariaDB",
        technology_kind: TechnologyKind::Database,
        identity_kind: IdentityKind::LogoCharacter,
        figure_kind: FigureKind::Animal,
        form: Some("sea lion"),
        tags: &["mariadb", "database", "sql", "sea-lion", "logo-character"],
        notes: "Sea lion logo character associated with MariaDB.",
    },
    Friend {
        id: "zig-zero-ziguana",
        name: "Zero the Ziguana",
        ecosystem: "Zig",
        technology_kind: TechnologyKind::ProgrammingLanguage,
        identity_kind: IdentityKind::Mascot,
        figure_kind: FigureKind::Animal,
        form: Some("iguana"),
        tags: &["zig", "systems", "language", "iguana", "mascot"],
        notes: "Iguana mascot associated with Zig.",
    },
    Friend {
        id: "zig-ziggy-ziguana",
        name: "Ziggy the Ziguana",
        ecosystem: "Zig",
        technology_kind: TechnologyKind::ProgrammingLanguage,
        identity_kind: IdentityKind::Mascot,
        figure_kind: FigureKind::Animal,
        form: Some("iguana"),
        tags: &["zig", "systems", "language", "iguana", "mascot"],
        notes: "Iguana mascot associated with Zig.",
    },
    Friend {
        id: "zig-carmen-allocgator",
        name: "Carmen the Allocgator",
        ecosystem: "Zig",
        technology_kind: TechnologyKind::ProgrammingLanguage,
        identity_kind: IdentityKind::Mascot,
        figure_kind: FigureKind::Animal,
        form: Some("alligator"),
        tags: &[
            "zig",
            "systems",
            "language",
            "allocator",
            "alligator",
            "mascot",
        ],
        notes: "Alligator mascot associated with Zig allocation examples.",
    },
    Friend {
        id: "dart-flutter-dash",
        name: "Dash",
        ecosystem: "Dart / Flutter",
        technology_kind: TechnologyKind::Framework,
        identity_kind: IdentityKind::Mascot,
        figure_kind: FigureKind::Animal,
        form: Some("hummingbird"),
        tags: &["dart", "flutter", "ui", "mobile", "hummingbird", "mascot"],
        notes: "Mascot associated with Dart and Flutter.",
    },
    Friend {
        id: "dotnet-bot",
        name: "dotnet bot",
        ecosystem: ".NET",
        technology_kind: TechnologyKind::Framework,
        identity_kind: IdentityKind::Mascot,
        figure_kind: FigureKind::Creature,
        form: Some("robot"),
        tags: &["dotnet", "framework", "runtime", "robot", "mascot"],
        notes: "Robot mascot associated with .NET.",
    },
    Friend {
        id: "plan-9-glenda",
        name: "Glenda",
        ecosystem: "Plan 9",
        technology_kind: TechnologyKind::OperatingSystem,
        identity_kind: IdentityKind::Mascot,
        figure_kind: FigureKind::Animal,
        form: Some("bunny"),
        tags: &["plan-9", "operating-system", "bell-labs", "bunny", "mascot"],
        notes: "Bunny mascot associated with Plan 9.",
    },
    Friend {
        id: "gnu-head",
        name: "GNU Head",
        ecosystem: "GNU",
        technology_kind: TechnologyKind::OperatingSystem,
        identity_kind: IdentityKind::LogoSymbol,
        figure_kind: FigureKind::Animal,
        form: Some("gnu"),
        tags: &["gnu", "free-software", "operating-system", "symbol"],
        notes: "GNU head symbol associated with the GNU project.",
    },
    Friend {
        id: "android-bot",
        name: "Android Bot",
        ecosystem: "Android",
        technology_kind: TechnologyKind::Platform,
        identity_kind: IdentityKind::LogoCharacter,
        figure_kind: FigureKind::Creature,
        form: Some("robot"),
        tags: &["android", "mobile", "platform", "robot", "logo-character"],
        notes: "Robot logo character associated with Android.",
    },
    Friend {
        id: "raku-camelia",
        name: "Camelia",
        ecosystem: "Raku",
        technology_kind: TechnologyKind::ProgrammingLanguage,
        identity_kind: IdentityKind::Mascot,
        figure_kind: FigureKind::Animal,
        form: Some("butterfly"),
        tags: &["raku", "language", "butterfly", "mascot"],
        notes: "Butterfly mascot associated with Raku.",
    },
    Friend {
        id: "perl-camel",
        name: "Perl Camel",
        ecosystem: "Perl",
        technology_kind: TechnologyKind::ProgrammingLanguage,
        identity_kind: IdentityKind::Symbol,
        figure_kind: FigureKind::Animal,
        form: Some("camel"),
        tags: &["perl", "language", "camel", "symbol", "historical"],
        notes: "Camel symbol commonly associated with Perl.",
    },
    Friend {
        id: "deno-dinosaur",
        name: "Deno Dinosaur",
        ecosystem: "Deno",
        technology_kind: TechnologyKind::Runtime,
        identity_kind: IdentityKind::Mascot,
        figure_kind: FigureKind::Animal,
        form: Some("dinosaur"),
        tags: &[
            "deno",
            "runtime",
            "typescript",
            "javascript",
            "dinosaur",
            "mascot",
        ],
        notes: "Dinosaur mascot associated with Deno.",
    },
    Friend {
        id: "crystal-crow",
        name: "Crystal Crow",
        ecosystem: "Crystal",
        technology_kind: TechnologyKind::ProgrammingLanguage,
        identity_kind: IdentityKind::Mascot,
        figure_kind: FigureKind::Animal,
        form: Some("crow"),
        tags: &["crystal", "language", "compiled", "crow", "mascot"],
        notes: "Crow mascot associated with Crystal.",
    },
    Friend {
        id: "opensuse-geeko",
        name: "Geeko",
        ecosystem: "openSUSE",
        technology_kind: TechnologyKind::OperatingSystem,
        identity_kind: IdentityKind::Mascot,
        figure_kind: FigureKind::Animal,
        form: Some("gecko"),
        tags: &["opensuse", "suse", "linux", "gecko", "mascot"],
        notes: "Gecko mascot associated with openSUSE.",
    },
    Friend {
        id: "linux-libre-freedo",
        name: "Freedo",
        ecosystem: "Linux-libre",
        technology_kind: TechnologyKind::OperatingSystem,
        identity_kind: IdentityKind::Mascot,
        figure_kind: FigureKind::Animal,
        form: Some("penguin"),
        tags: &[
            "linux-libre",
            "free-software",
            "kernel",
            "penguin",
            "mascot",
        ],
        notes: "Penguin mascot associated with Linux-libre.",
    },
    Friend {
        id: "d-d-man",
        name: "D-Man",
        ecosystem: "D",
        technology_kind: TechnologyKind::ProgrammingLanguage,
        identity_kind: IdentityKind::Mascot,
        figure_kind: FigureKind::HumanLike,
        form: Some("character"),
        tags: &["d", "language", "systems", "mascot"],
        notes: "Mascot character associated with the D programming language.",
    },
    Friend {
        id: "nix-nixos-snowflake",
        name: "Nix Snowflake",
        ecosystem: "Nix / NixOS",
        technology_kind: TechnologyKind::PackageManager,
        identity_kind: IdentityKind::LogoSymbol,
        figure_kind: FigureKind::Symbol,
        form: Some("snowflake"),
        tags: &[
            "nix",
            "nixos",
            "package-manager",
            "builds",
            "snowflake",
            "symbol",
        ],
        notes: "Snowflake symbol associated with Nix and NixOS.",
    },
    Friend {
        id: "jenkins-butler",
        name: "Jenkins Butler",
        ecosystem: "Jenkins",
        technology_kind: TechnologyKind::DevTool,
        identity_kind: IdentityKind::LogoCharacter,
        figure_kind: FigureKind::HumanLike,
        form: Some("butler"),
        tags: &[
            "jenkins",
            "ci",
            "cd",
            "automation",
            "butler",
            "logo-character",
        ],
        notes: "Butler logo character associated with Jenkins.",
    },
    Friend {
        id: "apache-hadoop-elephant",
        name: "Hadoop Elephant",
        ecosystem: "Apache Hadoop",
        technology_kind: TechnologyKind::Platform,
        identity_kind: IdentityKind::LogoCharacter,
        figure_kind: FigureKind::Animal,
        form: Some("elephant"),
        tags: &["hadoop", "apache", "big-data", "elephant", "logo-character"],
        notes: "Elephant logo character associated with Apache Hadoop.",
    },
];

#[cfg(test)]
mod tests {
    use super::FriendFixtures;
    use use_friend::{FigureKind, IdentityKind, TechnologyKind};

    #[test]
    fn exposes_expected_fixture_lengths() {
        assert_eq!(FriendFixtures::tiny().len(), 3);
        assert_eq!(FriendFixtures::small().len(), 6);
        assert_eq!(FriendFixtures::all().len(), 34);
    }

    #[test]
    fn preserves_deterministic_order() {
        let friends = FriendFixtures::all();

        assert_eq!(friends[0].id, "rust-ferris");
        assert_eq!(friends[1].id, "go-gopher");
        assert_eq!(friends[2].id, "linux-tux");
        assert_eq!(friends[11].id, "kde-konqi");
        assert_eq!(friends[33].id, "apache-hadoop-elephant");
    }

    #[test]
    fn includes_conservative_expected_metadata() {
        let ferris = &FriendFixtures::all()[0];
        let octocat = &FriendFixtures::all()[5];

        assert_eq!(ferris.ecosystem, "Rust");
        assert_eq!(ferris.form, Some("crab"));
        assert_eq!(ferris.identity_kind, IdentityKind::UnofficialMascot);
        assert_eq!(ferris.technology_kind, TechnologyKind::ProgrammingLanguage);
        assert_eq!(octocat.figure_kind, FigureKind::Creature);
        assert!(FriendFixtures::all()
            .iter()
            .all(|friend| !friend.notes.contains("http")));
    }

    #[test]
    fn includes_new_fixture_batch() {
        let ids: Vec<_> = FriendFixtures::all()
            .iter()
            .map(|friend| friend.id)
            .collect();
        let expected_ids = [
            "java-duke",
            "php-elephpant",
            "mysql-sakila",
            "mariadb-sea-lion",
            "zig-zero-ziguana",
            "zig-ziggy-ziguana",
            "zig-carmen-allocgator",
            "dart-flutter-dash",
            "dotnet-bot",
            "plan-9-glenda",
            "gnu-head",
            "android-bot",
            "raku-camelia",
            "perl-camel",
            "deno-dinosaur",
            "crystal-crow",
            "opensuse-geeko",
            "linux-libre-freedo",
            "d-d-man",
            "nix-nixos-snowflake",
            "jenkins-butler",
            "apache-hadoop-elephant",
        ];

        for expected_id in expected_ids {
            assert!(ids.contains(&expected_id));
        }
    }

    #[test]
    fn keeps_zig_records_in_request_order() {
        let zig_names: Vec<_> = FriendFixtures::all()
            .iter()
            .filter(|friend| friend.matches_ecosystem("Zig"))
            .map(|friend| friend.name)
            .collect();

        assert_eq!(
            zig_names,
            [
                "Zero the Ziguana",
                "Ziggy the Ziguana",
                "Carmen the Allocgator",
            ]
        );
    }
}