Bod has asked for the wisdom of the Perl Monks concerning the following question:
My experience of tests is very limited so the experience of The Monestry is greatly appreciated
I am using Test::More and I have two issues.
Firstly...
This fails at plan tests => 1; despite this being added by Module::Starter and it appearing correct according to the documentation. Instead, I have to write use Test::More tests => 1;. What am I doing wrong?#!perl use 5.006; use strict; use warnings; use Test::More; plan tests => 1; BEGIN { use_ok( 'AI::Embedding' ) || print "Bail out!\n"; } diag( "Testing AI::Embedding $AI::Embedding::VERSION, Perl $], $^X" );
Second issue...
This code is failing despite $comp_pass1 and $comp_pass2 being 1. Again, what am I doing wrong?my $comp_pass1 = $embed_pass->compare('-0.6,-0.5,-0.4,-0.3,-0.2,0.0,0. +2,0.3,0.4,0.5', '-0.6,-0.5,-0.4,-0.3,-0.2,0.0,0.2,0.3,0.4,0.5'); ok( $comp_pass1 == 1, "Compare got $comp_pass1"); $embed_pass->comparator('-0.6,-0.5,-0.4,-0.3,-0.2,0.0,0.2,0.3,0.4,0.5' +); my $comp_pass2 = $embed_pass->compare('-0.6,-0.5,-0.4,-0.3,-0.2,0.0,0. +2,0.3,0.4,0.5'); ok( $comp_pass2 == 1, "Compare to comparator got $comp_pass2");
This is the output from gmake test
"C:\Strawberry\perl\bin\perl.exe" "-MExtUtils::Command::MM" "-MTest::H +arness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib\l +ib', 'blib\arch')" t/*.t t/00-load.t ....... 1/1 # Testing AI::Embedding 0.1_1, Perl 5.032001, +C:\Strawberry\perl\bin\perl.exe t/00-load.t ....... ok t/01-openai.t ..... 1/11 # Failed test 'Compare to comparator got 1' # at t/01-openai.t line 44. # Looks like you failed 1 test of 11. t/01-openai.t ..... Dubious, test returned 1 (wstat 256, 0x100) Failed 1/11 subtests t/manifest.t ...... skipped: Author tests not required for installatio +n t/pod-coverage.t .. skipped: Author tests not required for installatio +n t/pod.t ........... skipped: Author tests not required for installatio +n Test Summary Report ------------------- t/01-openai.t (Wstat: 256 Tests: 11 Failed: 1) Failed test: 11 Non-zero exit status: 1 Files=5, Tests=12, 0 wallclock secs ( 0.05 usr + 0.02 sys = 0.06 CP +U) Result: FAIL Failed 1/5 test programs. 1/12 subtests failed. gmake: *** [Makefile:859: test_dynamic] Error 255
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Test::More fails...
by hv (Prior) on May 29, 2023 at 23:46 UTC | |
by Bod (Parson) on May 30, 2023 at 09:20 UTC | |
by haukex (Archbishop) on May 30, 2023 at 12:19 UTC | |
by Bod (Parson) on May 30, 2023 at 13:13 UTC | |
by haukex (Archbishop) on May 30, 2023 at 13:40 UTC | |
| |
Re: Test::More fails...
by choroba (Cardinal) on May 30, 2023 at 08:20 UTC | |
by Bod (Parson) on May 30, 2023 at 09:22 UTC | |
Re: Test::More fails...
by kcott (Archbishop) on May 30, 2023 at 09:57 UTC |