version_history_data/
lib.rs

1// Copyright 2024 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5use version_history::*;
6
7const VERSIONS: &[Version] = &version_history_macro::declare_version_history!();
8
9/// Global [VersionHistory] instance generated at build-time from the contents
10/// of `//sdk/version_history.json`.
11pub const HISTORY: VersionHistory = VersionHistory::new(VERSIONS);
12
13#[cfg(test)]
14mod tests {
15    use super::*;
16
17    #[test]
18    fn test_version_history_works() {
19        assert_eq!(
20            VERSIONS[0],
21            Version {
22                api_level: 4.into(),
23                abi_revision: 0x601665C5B1A89C7F.into(),
24                status: Status::Unsupported,
25            }
26        )
27    }
28
29    #[test]
30    fn test_example_supported_abi_revision_is_supported() {
31        let example_version = HISTORY.get_example_supported_version_for_tests();
32
33        assert_eq!(
34            HISTORY.check_api_level_for_build(example_version.api_level),
35            Ok(example_version.abi_revision)
36        );
37
38        HISTORY
39            .check_abi_revision_for_runtime(example_version.abi_revision)
40            .expect("you said it was supported!");
41    }
42}