question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failing length/2 test

See original GitHub issue

Running the Logtalk bundled tests for the de facto standard length/2 predicate, a single test fails:

?- length([1, 2, 3, 4, 5| _], 2).
limit exceeded ;

In the this related thread, I provide a Prolog implementation of the predicate. But the actual fix for Tau Prolog may be simpler.

P.S. Running all the Logtalk standards compliance tests with 153145aa0862d5643826e2bdd223d825be0cfe41 gives:

% 182 test sets: 165 completed, 12 skipped, 1 broken, 0 timedout, 4 crashed
% 2651 tests: 93 skipped, 2200 passed, 358 failed (0 flaky)

The four crashes are fixed by #287. The reported broken test is for the length/2 predicate due to the bug above. Of the 358 failed tests, 285 are for the format/2-3 predicates (a far from trivial predicate to implement). Several of the remaining 73 failed tests should be easily fixed.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
jariazavalverdecommented, Mar 26, 2022

Fixed.

@UWN Thanks for the link. I think I fixed all cases (except number 26).

0reactions
pmouracommented, Mar 26, 2022

Before there was a single failing test. Now:

% tests started at 2022-03-26, 20:37:16
% 
% running tests from object tests
% file: logtalk3/tests/prolog/predicates/length_2/tests.lgt
% 
% commons_length_2_01: success (in 0.0 seconds)
% commons_length_2_02: success (in 0.0 seconds)
% commons_length_2_03: success (in 0.0 seconds)
% commons_length_2_04: success (in 0.0 seconds)
% commons_length_2_05: success (in 0.0 seconds)
% commons_length_2_06: success (in 0.0 seconds)
% commons_length_2_07: success (in 0.0 seconds)
% commons_length_2_08: success (in 0.0 seconds)
% commons_length_2_09: success (in 0.0 seconds)
!     commons_length_2_10: failure (in 0.0 seconds)
!       test assertion failed: variant([[]-0,[A]-1,[A,B]-2,[A,B,C]-3],[[]-0,[D]-1,[E,F]-2,[G,H,I]-3])
!       in file logtalk3/tests/prolog/predicates/length_2/tests.lgt between lines 66-69
!     commons_length_2_11: failure (in 0.0 seconds)
!       test assertion failed: variant([[]-3,[A]-4,[A,B]-5,[A,B,C]-6],[[]-3,[D]-4,[E,F]-5,[G,H,I]-6])
!       in file logtalk3/tests/prolog/predicates/length_2/tests.lgt between lines 69-72
% commons_length_2_12: success (in 0.0 seconds)
% commons_length_2_13: success (in 0.0 seconds)
!     commons_length_2_14: failure (in 0.0 seconds)
!       test goal failed but should have thrown an error:
!         expected error(type_error(list,a),A)
!       in file logtalk3/tests/prolog/predicates/length_2/tests.lgt between lines 78-81
!     commons_length_2_15: failure (in 0.0 seconds)
!       test goal failed but should have thrown an error:
!         expected error(type_error(list,a),A)
!       in file logtalk3/tests/prolog/predicates/length_2/tests.lgt between lines 81-84
!     commons_length_2_16: failure (in 0.0 seconds)
!       test goal failed but should have thrown an error:
!         expected error(type_error(list,1),A)
!       in file logtalk3/tests/prolog/predicates/length_2/tests.lgt between lines 84-87
!     commons_length_2_17: failure (in 0.0 seconds)
!       test goal failed but should have thrown an error:
!         expected error(type_error(list,[A,B|a]),C)
!       in file logtalk3/tests/prolog/predicates/length_2/tests.lgt between lines 87-90
!     commons_length_2_18: failure (in 0.0 seconds)
!       test goal failed but should have thrown an error:
!         expected error(type_error(list,[A,B|a]),C)
!       in file logtalk3/tests/prolog/predicates/length_2/tests.lgt between lines 90-93
!     commons_length_2_19: failure (in 0.0 seconds)
!       test goal failed but should have thrown an error:
!         expected error(type_error(list,[A,B|a]),C)
!       in file logtalk3/tests/prolog/predicates/length_2/tests.lgt between lines 93-96
% commons_length_2_20: success (in 0.0 seconds)
% commons_length_2_21: success (in 0.0 seconds)
% commons_length_2_22: success (in 0.0 seconds)
% commons_length_2_23: success (in 0.0 seconds)
% commons_length_2_24: success (in 0.0 seconds)
% commons_length_2_25: skipped
% commons_length_2_26: skipped
% commons_length_2_27: skipped
% 
% 27 tests: 3 skipped, 16 passed, 8 failed (0 flaky)
% completed tests from object tests
% 
% no code coverage information collected
% tests ended at 2022-03-26, 20:37:22
Read more comments on GitHub >

github_iconTop Results From Across the Web

Error:index 2 out of bounds for length 2 at test.main
Pretty clear from error that there seems to be only 2 values in an array object (corresponding to index 0 & 1), thus...
Read more >
Support failing a test if no assertions are ran #2209 - GitHub
Offer a config variable that fails your test if no assertions are used during the test run. IMO default to on too.
Read more >
Cypress Test Statuses - Gleb Bahmutov
After the Cypress spec completes every test has one of the 4 statuses: passing, failing, pending, or skipped. Let's look into each status....
Read more >
Exact Binomial Test - R
Performs an exact test of a simple null hypothesis about the probability of ... or a vector of length 2 giving the numbers...
Read more >
Google Foobar challenge failing 2 out of 5 test cases
... length is odd and greater than 1 and where the negative list length is even but greater than length 2. ... I...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found