Commit e0b4af07 authored by Kumquat Orange's avatar Kumquat Orange Committed by calocedre TAC
Browse files

amelioration test

parent 722571f0
......@@ -53,7 +53,8 @@ testjs:
- ci
script:
- cd CLEA-lib/js
- java -cp ../java/target/*-jar-with-dependencies.jar fr.inria.clea.lsp.LspEncoderDecoder decode || true
- pwd || true
- cp ../java/target/clea-crypto-0.0.1-SNAPSHOT-jar-with-dependencies.jar ./clea-crypto.jar
- export CHROME_BIN=chromium
- export FIREFOX_BIN=firefox-esr
- npm install
......
......@@ -6,6 +6,7 @@
"dev": "parcel src/index.html",
"prebuild": "rimraf dist",
"build": "parcel build src/index.html -t node --bundle-node-modules",
"pretest": "rimraf crypto.csv",
"test": "karma start karma.conf.js",
"testcrypto": "mocha test/cryptotest.js --timeout=10000 --delay"
},
......
......@@ -93,10 +93,7 @@ var runs = [
}
];
before(function(done){
console.log(JSON.stringify({filter_key: 'crypto-filter', message: 'sk_l,pk_mcta,pk_sa,result,staff,CRIexp,venueType,venueCategory1,venueCategory2,countryCode,periodDuration'}));
done();
});
describe('concatBuffer()', function () {
it('should concat correctly', function () {
......@@ -147,7 +144,7 @@ describe('cleaRenewLSP()', function () {
let result = await clea.cleaRenewLSP(runs[0]);
console.log(JSON.stringify({filter_key: 'crypto-filter',
message: runs[0].SK_L_HEX+","+runs[0].PK_SA_HEX+","+runs[0].PK_MCTA_HEX+","+result+","+runs[0].staff+","+runs[0].CRIexp+","+runs[0].venueType
+","+runs[0].venueCategory1+","+runs[0].venueCategory2+","+runs[0].countryCode+","+runs[0].periodDuration}));
+","+runs[0].venueCategory1+","+runs[0].venueCategory2+","+runs[0].countryCode+","+runs[0].periodDuration+",\""+navigator.userAgent+"\""}));
expect(result).to.length(148)
expect(result.startsWith('AAAAAAAAAAAAAAAAAAAAAA')).to.be.true;
})
......@@ -162,7 +159,7 @@ describe('cleaStartNewPeriod()', function () {
console.log(result);
console.log(JSON.stringify({filter_key: 'crypto-filter',
message: run.SK_L_HEX+","+run.PK_SA_HEX+","+run.PK_MCTA_HEX+","+result+","+run.staff+","+run.CRIexp+","+run.venueType
+","+run.venueCategory1+","+run.venueCategory2+","+run.countryCode+","+run.periodDuration}));
+","+run.venueCategory1+","+run.venueCategory2+","+run.countryCode+","+run.periodDuration+",\""+navigator.userAgent+"\""}));
expect(result).to.length(148);
});
});
......
......@@ -3,11 +3,11 @@ const csv=require('csvtojson')
const { spawn } = require('child_process');
// setup : load cvs file
let cryptoList;
csv()
csv({noheader: true,
headers:['sk_l','pk_mcta','pk_sa','result','staff','CRIexp','venueType','venueCategory1','venueCategory2','countryCode','periodDuration','browser']})
.fromFile('./crypto.csv')
.then((jsonObj)=> {
cryptoList = jsonObj;
console.log(cryptoList);
})
setTimeout(function() {
......@@ -15,16 +15,18 @@ setTimeout(function() {
describe('test suite for crypto', function () {
cryptoList.forEach(function (cryptoItem) {
it('test ' + cryptoItem.result + 'key ' + cryptoItem.sk_l +'/' + cryptoItem.pk_sa, async () => {
it('test on [' + cryptoItem.browser + '] with ' + cryptoItem.staff + ' ' + cryptoItem.CRIexp + ' ' + cryptoItem.venueType + ' ' + cryptoItem.venueCategory1
+ ' ' + cryptoItem.venueCategory2 + ' ' + cryptoItem.countryCode + ' ' + cryptoItem.periodDuration , async () => {
await new Promise((resolve) => {
let result;
console.log(process.cwd());
const javaproc = spawn('java', ['-cp',
'../java/target/clea-crypto-0.0.1-SNAPSHOT-jar-with-dependencies.jar ',
'./clea-crypto.jar ',
'fr.inria.clea.lsp.LspEncoderDecoder', 'decode',
cryptoItem.result,
cryptoItem.sk_l,
cryptoItem.pk_sa]);
cryptoItem.pk_sa],
{cwd: process.cwd()});
javaproc.stdout.on('data', (data) => {
console.log(data.toString());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment