Skip to content

Commit

Permalink
Add check for arg length
Browse files Browse the repository at this point in the history
  • Loading branch information
HalfdanJ committed Oct 19, 2024
1 parent b28c861 commit d4f46b5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/api/js/src/high-level/high-level.ts
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,9 @@ export function createApi(Z3: Z3Core): Z3HighLevel {

function PbEq(args: [Bool<Name>, ...Bool<Name>[]], coeffs: [number, ...number[]], k: number): Bool<Name> {
_assertContext(...args);
if (args.length !== coeffs.length) {
throw new Error('Number of arguments and coefficients must match');
}
return new BoolImpl(
check(
Z3.mk_pbeq(
Expand All @@ -973,6 +976,9 @@ export function createApi(Z3: Z3Core): Z3HighLevel {

function PbGe(args: [Bool<Name>, ...Bool<Name>[]], coeffs: [number, ...number[]], k: number): Bool<Name> {
_assertContext(...args);
if (args.length !== coeffs.length) {
throw new Error('Number of arguments and coefficients must match');
}
return new BoolImpl(
check(
Z3.mk_pbge(
Expand All @@ -987,6 +993,9 @@ export function createApi(Z3: Z3Core): Z3HighLevel {

function PbLe(args: [Bool<Name>, ...Bool<Name>[]], coeffs: [number, ...number[]], k: number): Bool<Name> {
_assertContext(...args);
if (args.length !== coeffs.length) {
throw new Error('Number of arguments and coefficients must match');
}
return new BoolImpl(
check(
Z3.mk_pble(
Expand Down

0 comments on commit d4f46b5

Please sign in to comment.