mirror of
https://github.com/affaan-m/ECC.git
synced 2026-09-08 07:37:48 +02:00
test: strengthen GAN harness assertions
This commit is contained in:
@@ -51,23 +51,39 @@ console.log('\n=== GAN harness helpers ===\n');
|
|||||||
|
|
||||||
const results = Object.freeze([
|
const results = Object.freeze([
|
||||||
test('extract_score reads the documented TOTAL table format', () => {
|
test('extract_score reads the documented TOTAL table format', () => {
|
||||||
assert.strictEqual(extractScore('| **TOTAL** | | | **7.5** |\n'), '7.5');
|
const feedback = '| **TOTAL** | | | **7.5** |\n';
|
||||||
|
const result = extractScore(feedback);
|
||||||
|
|
||||||
|
assert.strictEqual(result, '7.5');
|
||||||
}),
|
}),
|
||||||
|
|
||||||
test('extract_score reads the compact TOTAL format', () => {
|
test('extract_score reads the compact TOTAL format', () => {
|
||||||
assert.strictEqual(extractScore('**TOTAL** | **8.3**\n'), '8.3');
|
const feedback = '**TOTAL** | **8.3**\n';
|
||||||
|
const result = extractScore(feedback);
|
||||||
|
|
||||||
|
assert.strictEqual(result, '8.3');
|
||||||
}),
|
}),
|
||||||
|
|
||||||
test('extract_score reads a Verdict score', () => {
|
test('extract_score reads a Verdict score', () => {
|
||||||
assert.strictEqual(extractScore('Verdict: PASS with score 9.1\n'), '9.1');
|
const feedback = 'Verdict: PASS with score 9.1\n';
|
||||||
|
const result = extractScore(feedback);
|
||||||
|
|
||||||
|
assert.strictEqual(result, '9.1');
|
||||||
}),
|
}),
|
||||||
|
|
||||||
test('extract_score returns the fallback when no supported score exists', () => {
|
test('extract_score returns the fallback when no supported score exists', () => {
|
||||||
assert.strictEqual(extractScore('Other score: 9.9\n'), '0.0');
|
const feedback = 'Other score: 9.9\n';
|
||||||
|
const result = extractScore(feedback);
|
||||||
|
|
||||||
|
assert.strictEqual(result, '0.0');
|
||||||
}),
|
}),
|
||||||
|
|
||||||
test('final score lookup is compatible with the macOS Bash 3.2 runtime', () => {
|
test('final score lookup is compatible with the macOS Bash 3.2 runtime', () => {
|
||||||
assert.ok(!harnessSource.includes('SCORES[-1]'), 'negative array subscripts require Bash 4.3+');
|
assert.doesNotMatch(
|
||||||
|
harnessSource,
|
||||||
|
/\bSCORES\[\s*-\s*\d+\s*\]/,
|
||||||
|
'negative array subscripts require Bash 4.3+'
|
||||||
|
);
|
||||||
}),
|
}),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user