Skip to content

Commit

Permalink
patch: shortening primitive logical value prefixes; updating test acc…
Browse files Browse the repository at this point in the history
…ordingly; format (#393)
  • Loading branch information
larry-gonzalez authored Oct 27, 2023
1 parent 3181377 commit 2e3868a
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 35 deletions.
62 changes: 34 additions & 28 deletions nemo/src/builder_proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -653,38 +653,44 @@ mod test {
unreachable!()
};

assert_eq!(any_result, [
"STRING:my string",
"INTEGER:42",
"DOUBLE:3.41",
"CONSTANT:my constant",
"STRING:string literal",
"INTEGER:45",
"DECIMAL:4.2",
"DOUBLE:2.99",
"LANGUAGE_STRING:language string@en",
"DATATYPE_VALUE:some random datavalue^^a datatype that I totally did not just make up",
"STRING:string datavalue",
"INTEGER:73",
"DECIMAL:1.23",
"DECIMAL:1.23",
"DECIMAL:-1.23",
"DECIMAL:23.0",
"DECIMAL:23.0",
"DECIMAL:-23.0",
"DOUBLE:3.33",
"DATATYPE_VALUE:9950000000000000000^^http://www.w3.org/2001/XMLSchema#integer",
"DATATYPE_VALUE:9950000000000000001^^http://www.w3.org/2001/XMLSchema#decimal",
].into_iter().map(String::from).collect::<Vec<_>>());
assert_eq!(
any_result,
[
"ST:my string",
"IN:42",
"DO:3.41",
"CO:my constant",
"ST:string literal",
"IN:45",
"DE:4.2",
"DO:2.99",
"LS:language string@en",
"DV:some random datavalue^^a datatype that I totally did not just make up",
"ST:string datavalue",
"IN:73",
"DE:1.23",
"DE:1.23",
"DE:-1.23",
"DE:23.0",
"DE:23.0",
"DE:-23.0",
"DO:3.33",
"DV:9950000000000000000^^http://www.w3.org/2001/XMLSchema#integer",
"DV:9950000000000000001^^http://www.w3.org/2001/XMLSchema#decimal",
]
.into_iter()
.map(String::from)
.collect::<Vec<_>>()
);

assert_eq!(
string_result,
[
"STRING:my string",
"STRING:42",
"STRING:3.41",
"STRING:string literal",
"STRING:string datavalue",
"ST:my string",
"ST:42",
"ST:3.41",
"ST:string literal",
"ST:string datavalue",
]
.into_iter()
.map(String::from)
Expand Down
14 changes: 7 additions & 7 deletions nemo/src/model/types/primitive_logical_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ use crate::model::{

use super::{error::InvalidRuleTermConversion, primitive_types::PrimitiveType};

const LANGUAGE_STRING_PREFIX: &str = "LANGUAGE_STRING:";
const STRING_PREFIX: &str = "STRING:";
const INTEGER_PREFIX: &str = "INTEGER:";
const DECIMAL_PREFIX: &str = "DECIMAL:";
const DOUBLE_PREFIX: &str = "DOUBLE:";
const CONSTANT_PREFIX: &str = "CONSTANT:";
const DATATYPE_VALUE_PREFIX: &str = "DATATYPE_VALUE:";
const LANGUAGE_STRING_PREFIX: &str = "LS:";
const STRING_PREFIX: &str = "ST:";
const INTEGER_PREFIX: &str = "IN:";
const DECIMAL_PREFIX: &str = "DE:";
const DOUBLE_PREFIX: &str = "DO:";
const CONSTANT_PREFIX: &str = "CO:";
const DATATYPE_VALUE_PREFIX: &str = "DV:";

/// The prefix used to indicate constants that are Nulls
pub const LOGICAL_NULL_PREFIX: &str = "__Null#";
Expand Down

0 comments on commit 2e3868a

Please sign in to comment.