MCPcopy Create free account
hub / github.com/Singular/Singular / ContractFailure

Function ContractFailure

ppcc/adlib/contract.cc:3–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1#include "lib.h"
2
3void ContractFailure(ContractType type, const char *message) {
4 Str *error = NULL;
5 switch (type) {
6 case Precondition:
7 error = S("precondition failed: ");
8 break;
9 case Postcondition:
10 error = S("postcondition failed: ");
11 break;
12 case Invariant:
13 error = S("invariant failed: ");
14 break;
15 case Assertion:
16 error = S("assrtion failed: ");
17 break;
18 }
19 error->add(S(message));
20 ContractException *e = new ContractException();
21 e->type = type;
22 e->error = error;
23 throw e;
24}

Callers 4

requireFunction · 0.85
ensureFunction · 0.85
invariantFunction · 0.85
assertFunction · 0.85

Calls 2

SFunction · 0.70
addMethod · 0.45

Tested by

no test coverage detected