Skip to content
Merged
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
23 changes: 2 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@ jobs:
unit-tests:
name: ${{ matrix.basename }} - ${{ matrix.os }} - ${{ matrix.llvm[0] }} - ${{ matrix.features }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
continue-on-error: ${{ matrix.experimental || matrix.llvm[0] != '17.0' }}
strategy:
matrix:
llvm:
- ["15.0", "15-0", "150"]
- ["16.0", "16-0", "160"]
- ["17.0", "17-0", "170"]
- ["18.1", "18-1", "181"]
- ["19.1", "19-1", "191", "19"]
- ["20.1", "20-1", "201", "20"]
- ["21.1", "21-1", "211", "21"]
Expand All @@ -62,26 +63,6 @@ jobs:
- Tests

include:
- toolchain: stable
os: ubuntu-latest
llvm: ["18.1", "18-1", "181"]
features: "rayon cranelift external_f64"
tests: true
clippy: false
rustdoc: false
experimental: true
basename: Tests

- toolchain: stable
os: macos-latest
llvm: ["18.1", "18-1", "181"]
features: "rayon cranelift external_f64"
tests: true
clippy: false
rustdoc: false
experimental: true
basename: Tests

- toolchain: stable
os: windows-latest
llvm: ""
Expand Down
32 changes: 32 additions & 0 deletions diffsl/src/discretise/discrete_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,12 @@ impl<'s> DiscreteModel<'s> {
Self::check_match(reset, &ret.state, span, &mut env);
}
}
if ret.reset.is_some() && ret.stop.is_none() {
env.errs_mut().push(ValidationError::new(
"reset requires stop to also be defined".to_string(),
span_reset.flatten(),
));
}

let map_dep = |deps: &Vec<NonZero>| -> Vec<(usize, usize)> {
deps.iter()
Expand Down Expand Up @@ -1722,6 +1728,32 @@ mod tests {
);
}

#[test]
fn test_reset_requires_stop() {
let text = "
u_i {
y = 1,
}
F_i {
y,
}
reset_i {
2 * y,
}
";
let model_ds = parse_ds_string(text).unwrap();
let model = DiscreteModel::build("$name", &model_ds);
assert!(
model.is_err(),
"reset_i should require stop_i to also be defined"
);
let errs = model.unwrap_err();
assert!(
errs.has_error_contains("reset requires stop to also be defined"),
"expected missing stop validation error"
);
}

#[test]
fn test_no_out() {
let text = "
Expand Down
Loading
Loading