Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions components/segmenter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ icu_locale = { workspace = true, optional = true }
icu = { path = "../../components/icu", default-features = false }
icu_properties = { path = "../properties", features = ["compiled_data"] }
itertools = { workspace = true }
ndarray = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }

Expand All @@ -64,3 +65,7 @@ harness = false
[[test]]
name = "complex_word"
required-features = ["auto"]

[[test]]
name = "cnn"
required-features = []
10 changes: 10 additions & 0 deletions components/segmenter/tests/cnn/helper.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// This file is part of ICU4X. For terms of use, please see the file
// called LICENSE at the top level of the ICU4X source tree
// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).

use ndarray::array;

pub fn get_shape() -> Vec<usize> {
let a1 = array![1, 2, 3, 4];
a1.shape().to_vec()
}
26 changes: 26 additions & 0 deletions components/segmenter/tests/cnn/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// This file is part of ICU4X. For terms of use, please see the file
// called LICENSE at the top level of the ICU4X source tree
// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).

use serde::Deserialize;

mod helper;

static JSON_STR: &str = include_str!("sample.json");

#[test]
fn hello_world() {
println!("hello world");
assert_eq!(helper::get_shape(), vec![4]);
}

#[derive(Deserialize)]
struct JsonStruct {
key: String,
}

#[test]
fn test_json() {
let json_obj: JsonStruct = serde_json::from_str(JSON_STR).unwrap();
assert_eq!(json_obj.key, "value");
}
3 changes: 3 additions & 0 deletions components/segmenter/tests/cnn/sample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"key": "value"
}
Loading