1
use bonsaidb::core::schema::Qualified;
2
use bonsaidb::files::{BonsaiFiles, FileConfig};
3

            
4
1
#[test]
5
1
fn defaults() {
6
2
    #[derive(FileConfig)]
7
1
    struct Test;
8
1

            
9
1
    assert_eq!(
10
1
        <Test as FileConfig>::Metadata::default(),
11
1
        <BonsaiFiles as FileConfig>::Metadata::default()
12
1
    );
13
1
    assert_eq!(Test::BLOCK_SIZE, BonsaiFiles::BLOCK_SIZE);
14
1
    assert_eq!(Test::files_name(), BonsaiFiles::files_name());
15
1
    assert_eq!(Test::blocks_name(), BonsaiFiles::blocks_name());
16
1
}
17

            
18
1
#[test]
19
1
fn names_only() {
20
2
    #[derive(FileConfig)]
21
1
    #[file_config(blocks_name = "blocks_test", files_name = "files_test")]
22
1
    struct Test;
23
1

            
24
1
    assert_eq!(Test::files_name(), Qualified::private("files_test"));
25
1
    assert_eq!(Test::blocks_name(), Qualified::private("blocks_test"));
26
1
}
27

            
28
1
#[test]
29
1
fn names_and_authority() {
30
2
    #[derive(FileConfig)]
31
1
    #[file_config(
32
1
        authority = "test",
33
1
        blocks_name = "blocks_test",
34
1
        files_name = "files_test"
35
1
    )]
36
1
    struct Test;
37
1

            
38
1
    assert_eq!(Test::files_name(), Qualified::new("test", "files_test"));
39
1
    assert_eq!(Test::blocks_name(), Qualified::new("test", "blocks_test"));
40
1
}
41

            
42
1
#[test]
43
1
fn block_size() {
44
1
    #[derive(FileConfig)]
45
1
    #[file_config(block_size = 10)]
46
1
    struct Test;
47
1

            
48
1
    assert_eq!(Test::BLOCK_SIZE, 10);
49
1
}
50

            
51
1
#[test]
52
1
fn response() {
53
1
    #[derive(FileConfig)]
54
1
    #[file_config(metadata = String)]
55
1
    struct Test;
56
1

            
57
1
    assert_eq!(<Test as FileConfig>::Metadata::default(), String::default());
58
1
}