10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-07-23 11:17:42 +02:00

Add assertions

This commit is contained in:
Mickaël Véril 2020-03-14 17:29:47 +01:00
parent 91781b1c1d
commit df21468622

View File

@ -235,6 +235,7 @@ class dataFileBase {
return (JSON.stringify(e.initial)===JSON.stringify(ex.initial)) && (JSON.stringify(e.final)===JSON.stringify(ex.final)) return (JSON.stringify(e.initial)===JSON.stringify(ex.initial)) && (JSON.stringify(e.final)===JSON.stringify(ex.final))
}) })
if(ex2!==undefined){ if(ex2!==undefined){
console.assert(ex.type==0 || (ex2.type^(excitationTypes.RYDBERG | excitationTypes.VALENCE)==ex.type^(excitationTypes.RYDBERG | excitationTypes.VALENCE)),"Excitation type error",[ex,ex2,data.sourceFile])
ex.type=ex2.type ex.type=ex2.type
} }
} }
@ -326,6 +327,18 @@ class dataFileBase {
} }
} }
} }
var stfy=dat.excitations.map(e=>JSON.stringify([e.initial,e.final]))
var double=[]
stfy.forEach(function(element, i) {
// Find if there is a duplicate or not
if (stfy.indexOf(element, i + 1) >= 0) {
// Find if the element is already in the result array or not
if (result.indexOf(element) === -1) {
double.push(dat.excitations[i])
}
}
});
console.assert(double.length===0,"Double found",double,dat.sourceFile)
return dat return dat
} }
} }