2 # Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
4 # Licensed under the OpenSSL license (the "License"). You may not use
5 # this file except in compliance with the License. You can obtain a copy
6 # in the file LICENSE in the source distribution or at
7 # https://www.openssl.org/source/license.html
15 use OpenSSL::Test qw/:DEFAULT srctop_file/;
21 require_ok(srctop_file("test","recipes","bc.pl"));
23 my $testresults = "tmp.bntest";
24 my $init = ok(run(test(["bntest"], stdout => $testresults)), 'initialize');
27 skip "Initializing failed, skipping", 1 if !$init;
29 subtest 'Checking the bn results' => sub {
31 if (open DATA, $testresults) {
35 map { s/\R//; } @lines; # chomp(@lines);
37 plan tests => scalar grep(/^print /, @lines);
41 while (scalar @lines) {
44 last if $l =~ /^print /;
54 while (scalar @lines) {
57 last if $l =~ /^print /;
62 ok(check_operations(@operations), "verify $t");
71 sub check_operations {
74 foreach my $line (@_) {
75 my $result = calc(split /\s+/, $line);
77 if ($result ne "0" && $result ne "0x0") {
79 print STDERR "Failed! $line => $result\n";
83 return $failcount == 0;