aboutsummaryrefslogtreecommitdiff
path: root/database/src/test_shared.rs
blob: 82e9ba4fe98bb0d9ef46eefc7f983f0c4c4f4581 (plain)
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
/*
    This file is part of jellything (https://codeberg.org/metamuffin/jellything)
    which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
    Copyright (C) 2026 metamuffin <metamuffin.org>
*/

use jellyobject::{ObjectBuffer, Registry, fields};
use std::sync::LazyLock;

pub static TAGREG: LazyLock<Registry> = LazyLock::new(|| {
    let mut reg = Registry::default();
    register_fields(&mut reg);
    reg
});
fields! {
    NAME: &str = 15 "name";
    AGE: u32 = 13 "age";
    FRIEND: &str = 54321 "friend";
}

pub(crate) fn new_bob() -> ObjectBuffer {
    ObjectBuffer::new(&mut [
        (NAME.0, &"Bob"),
        (AGE.0, &35_u32),
        (FRIEND.0, &"Alice"),
        (FRIEND.0, &"Charlie"),
    ])
}
pub(crate) fn new_alice() -> ObjectBuffer {
    ObjectBuffer::new(&mut [(NAME.0, &"Alice"), (AGE.0, &31_u32), (FRIEND.0, &"Bob")])
}
pub(crate) fn new_charlie() -> ObjectBuffer {
    ObjectBuffer::new(&mut [(NAME.0, &"Charlie"), (AGE.0, &31_u32), (FRIEND.0, &"Bob")])
}