File: test.ps1

package info (click to toggle)
python-argon2 18.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 4,468 kB
  • sloc: ansic: 3,715; python: 1,328; makefile: 307; sh: 55
file content (50 lines) | stat: -rw-r--r-- 1,273 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
$ErrorActionPreference = "Stop"

Set-Variable tempfile -option Constant -value "tempfile"

function CompareFiles($f1, $f2, $i) {
    $f1_content = $(Get-Content $f1)
    $f2_content = $(Get-Content $f2)

    if (Compare-Object $f1_content $f2_content) {
        Write-Host -NoNewline "ERROR"
        exit $i
    } else {
        Write-Host -NoNewline "OK"
    }
}

function main() {
    $i = 0
    foreach ($opt in @("Ref", "Opt")) {
        Write-Output "$opt"

        foreach ($version in @(16, 19)) {
            foreach ($type in @("i", "d", "id")) {
                $i++

                if ("Ref" -eq $opt) {
                    vs2015\build\Argon2RefGenKAT.exe $type $version > $tempfile
                } else {
                    vs2015\build\Argon2OptGenKAT.exe $type $version > $tempfile
                }

                if (19 -eq $version) {
                    $kats = "kats\argon2" + $type
                } else {
                    $kats = "kats\argon2" + $type + "_v" + $version
                }

                Write-Host -NoNewline "Argon2$type v=$version : "
                CompareFiles $tempfile $kats $i
                Write-Output ""
            }
        }
    }

    if (Test-Path $tempfile) {
        Remove-Item $tempfile
    }
}

main