| 
3 | 3 | % Sanity checking rules  | 
4 | 4 | % ============================================================================================  | 
5 | 5 | 
 
  | 
 | 6 | +:- table haveGround/0 as opaque.  | 
 | 7 | +haveGround :- groundTruth(_, _, _, _, _, _, _, _, _), !.  | 
 | 8 | + | 
 | 9 | +% If we have ground truth, did we merge two different classes together?  | 
 | 10 | +:- table insanityGroundBadMerge/1 as incremental.  | 
 | 11 | +insanityGroundBadMerge(Out) :-  | 
 | 12 | + | 
 | 13 | +    find(M1, C),  | 
 | 14 | +    groundTruth(M1, C1, Mname1, _, _, _, _, _, _),  | 
 | 15 | +    find(M2, C),  | 
 | 16 | +    iso_dif(M1, M2),  | 
 | 17 | +    groundTruth(M2, C2, Mname2, _, _, _, _, _, _),  | 
 | 18 | +    iso_dif(C1, C2),  | 
 | 19 | + | 
 | 20 | +    % Make sure that this method is not on multiple classes  | 
 | 21 | +    not(groundTruth(M2, C1, _, _, _, _, _, _, _)),  | 
 | 22 | + | 
 | 23 | +    Out = (  | 
 | 24 | +        logwarnln('Consistency checks failed.~n~Q (~Q::~Q) and ~Q (~Q::~Q) are on the same class, but ground truth says they are on ~Q and ~Q.', [M1, C1, Mname1, M2, C2, Mname2, C1, C2])  | 
 | 25 | +    ).  | 
 | 26 | + | 
 | 27 | + | 
6 | 28 | % If we say we have no base classes, we have no base classes :-)  | 
7 | 29 | :- table insanityNoBaseConsistency/1 as incremental.  | 
8 | 30 | insanityNoBaseConsistency(Out) :-  | 
 | 
330 | 352 | 
 
  | 
331 | 353 | :- table sanityChecks/1 as incremental.  | 
332 | 354 | sanityChecks(Out) :-  | 
 | 355 | +    groundSanityChecks(Out);  | 
333 | 356 |     insanityNoBaseConsistency(Out);  | 
334 | 357 |     insanityEmbeddedAndNot(Out);  | 
335 | 358 |     insanityConstructorAndNotConstructor(Out);  | 
 | 
348 | 371 |     insanityContradictoryNOTConstructor(Out);  | 
349 | 372 |     insanityTwoRealDestructorsOnClass(Out).  | 
350 | 373 | 
 
  | 
 | 374 | +groundSanityChecks(Out) :-  | 
 | 375 | +    haveGround,  | 
 | 376 | + | 
 | 377 | +    insanityGroundBadMerge(Out).  | 
 | 378 | + | 
351 | 379 | sanityChecks :-  | 
352 | 380 |     sanityChecks(Out)  | 
353 | 381 |     ->  | 
 | 
0 commit comments