Attitude: schema validator reads signed integers; catalog counts include the three attitude tools
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
174ecfef20
commit
6116158534
2 changed files with 23 additions and 13 deletions
|
|
@ -493,7 +493,7 @@ fn the_derived_opinion_and_its_causes_reach_the_tables_view() {
|
|||
.expect("the table has a regard section");
|
||||
assert!(line.contains("The Yard Reeve"), "{line}");
|
||||
assert!(line.contains("regards The Yard Farmer"), "{line}");
|
||||
assert!(line.contains("with hostility (-70)"), "{line}");
|
||||
assert!(line.contains("with hatred (-70)"), "{line}");
|
||||
assert!(line.contains("(-70)"), "{line}");
|
||||
assert!(line.contains("a grievance (-30)"), "{line}");
|
||||
assert!(line.contains("prejudice toward the outlander (-40)"), "{line}");
|
||||
|
|
|
|||
|
|
@ -7796,7 +7796,7 @@ mod catalog_tests {
|
|||
.iter()
|
||||
.filter(|entry| matches!(entry.shape, PatchToolShape::Operate { .. }))
|
||||
.count();
|
||||
assert_eq!((declarations, operations, PATCH_TOOLS.len()), (7, 34, 43));
|
||||
assert_eq!((declarations, operations, PATCH_TOOLS.len()), (7, 37, 46));
|
||||
|
||||
// Every declaration variant the vocabulary owns is reachable, and the
|
||||
// two payload-carrying entity kinds are not exposed as an `Entity`
|
||||
|
|
@ -7954,7 +7954,7 @@ mod catalog_tests {
|
|||
.count();
|
||||
assert_eq!(
|
||||
(declare_tools, operate_tools, PATCH_TOOLS.len()),
|
||||
(7, 34, 43)
|
||||
(7, 37, 46)
|
||||
);
|
||||
|
||||
let declarations = every_declaration();
|
||||
|
|
@ -8154,16 +8154,26 @@ mod catalog_tests {
|
|||
let inner = schema.get("items").unwrap_or(&Value::Null);
|
||||
items.iter().all(|item| admits(inner, item))
|
||||
}),
|
||||
Some("integer") => value.as_u64().is_some_and(|number| {
|
||||
schema
|
||||
.get("minimum")
|
||||
.and_then(Value::as_u64)
|
||||
.is_none_or(|minimum| number >= minimum)
|
||||
&& schema
|
||||
.get("maximum")
|
||||
.and_then(Value::as_u64)
|
||||
.is_none_or(|maximum| number <= maximum)
|
||||
}),
|
||||
Some("integer") => {
|
||||
// Signed as well as unsigned: a regard may be negative, and
|
||||
// `u64::MAX` ceilings still need to fit.
|
||||
let wide = |number: &Value| {
|
||||
number
|
||||
.as_i64()
|
||||
.map(i128::from)
|
||||
.or_else(|| number.as_u64().map(i128::from))
|
||||
};
|
||||
wide(value).is_some_and(|number| {
|
||||
schema
|
||||
.get("minimum")
|
||||
.and_then(wide)
|
||||
.is_none_or(|minimum| number >= minimum)
|
||||
&& schema
|
||||
.get("maximum")
|
||||
.and_then(wide)
|
||||
.is_none_or(|maximum| number <= maximum)
|
||||
})
|
||||
}
|
||||
Some("boolean") => value.is_boolean(),
|
||||
Some("string") => value.is_string(),
|
||||
Some("null") => value.is_null(),
|
||||
|
|
|
|||
Loading…
Reference in a new issue