stclib / STC

A modern, user friendly, generic, type-safe and fast C99 container library: String, Vector, Sorted and Unordered Map and Set, Deque, Forward List, Smart Pointers, Bitset and Random numbers.
MIT License
1.34k stars 73 forks source link

cspan_cube:slice3 fails: assertion failed, 131072 == 34359869440 #61

Closed barracuda156 closed 1 year ago

barracuda156 commented 1 year ago

Everything else passes, one test fails:

TEST 15/18 cspan_cube:slice3 [FAIL]
  ERR: /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_STC/STC/work/STC-4.2/misc/tests/cspan_test.c:124  assertion failed, 131072 == 34359869440

This is on PowerPC 32-bit.

barracuda156 commented 1 year ago
--->  Testing STC
Executing:  cd "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_STC/STC/work/build" && ctest test 
Test project /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_STC/STC/work/build
      Start  1: arc_containers
 1/69 Test  #1: arc_containers ...................   Passed    0.00 sec
      Start  2: arc_demo
 2/69 Test  #2: arc_demo .........................   Passed    0.00 sec
      Start  3: arcvec_erase
 3/69 Test  #3: arcvec_erase .....................   Passed    0.00 sec
      Start  4: astar
 4/69 Test  #4: astar ............................   Passed    0.01 sec
      Start  5: birthday
 5/69 Test  #5: birthday .........................   Passed   22.71 sec
      Start  6: bits
 6/69 Test  #6: bits .............................   Passed    0.03 sec
      Start  7: bits2
 7/69 Test  #7: bits2 ............................   Passed    0.01 sec
      Start  8: books
 8/69 Test  #8: books ............................   Passed    0.01 sec
      Start  9: box
 9/69 Test  #9: box ..............................   Passed    0.01 sec
      Start 10: box2
10/69 Test #10: box2 .............................   Passed    0.01 sec
      Start 11: complex
11/69 Test #11: complex ..........................   Passed    0.01 sec
      Start 12: convert
12/69 Test #12: convert ..........................   Passed    0.00 sec
      Start 13: coread
13/69 Test #13: coread ...........................   Passed    0.01 sec
      Start 14: coroutines
14/69 Test #14: coroutines .......................   Passed    0.00 sec
      Start 15: csmap_erase
15/69 Test #15: csmap_erase ......................   Passed    0.00 sec
      Start 16: csmap_find
16/69 Test #16: csmap_find .......................   Passed    0.00 sec
      Start 17: csmap_insert
17/69 Test #17: csmap_insert .....................   Passed    0.01 sec
      Start 18: csset_erase
18/69 Test #18: csset_erase ......................   Passed    0.01 sec
      Start 19: cstr_match
19/69 Test #19: cstr_match .......................   Passed    0.01 sec
      Start 20: demos
20/69 Test #20: demos ............................   Passed    0.01 sec
      Start 21: forfilter
21/69 Test #21: forfilter ........................   Passed    0.01 sec
      Start 22: forloops
22/69 Test #22: forloops .........................   Passed    0.01 sec
      Start 23: functor
23/69 Test #23: functor ..........................   Passed    0.01 sec
      Start 24: gauss2
24/69 Test #24: gauss2 ...........................   Passed    1.05 sec
      Start 25: generator
25/69 Test #25: generator ........................   Passed    0.01 sec
      Start 26: hashmap
26/69 Test #26: hashmap ..........................   Passed    0.01 sec
      Start 27: inits
27/69 Test #27: inits ............................   Passed    0.01 sec
      Start 28: list
28/69 Test #28: list .............................   Passed    2.19 sec
      Start 29: list_erase
29/69 Test #29: list_erase .......................   Passed    0.00 sec
      Start 30: list_splice
30/69 Test #30: list_splice ......................   Passed    0.00 sec
      Start 31: lower_bound
31/69 Test #31: lower_bound ......................   Passed    0.00 sec
      Start 32: mapmap
32/69 Test #32: mapmap ...........................   Passed    0.00 sec
      Start 33: mmap
33/69 Test #33: mmap .............................   Passed    0.00 sec
      Start 34: multidim
34/69 Test #34: multidim .........................   Passed    0.00 sec
      Start 35: multimap
35/69 Test #35: multimap .........................   Passed    0.00 sec
      Start 36: music_arc
36/69 Test #36: music_arc ........................   Passed    0.00 sec
      Start 37: new_list
37/69 Test #37: new_list .........................   Passed    0.00 sec
      Start 38: new_map
38/69 Test #38: new_map ..........................   Passed    0.00 sec
      Start 39: new_pque
39/69 Test #39: new_pque .........................   Passed    0.01 sec
      Start 40: new_queue
40/69 Test #40: new_queue ........................   Passed   12.45 sec
      Start 41: new_smap
41/69 Test #41: new_smap .........................   Passed    0.00 sec
      Start 42: new_sptr
42/69 Test #42: new_sptr .........................   Passed    0.01 sec
      Start 43: new_vec
43/69 Test #43: new_vec ..........................   Passed    0.00 sec
      Start 44: person_arc
44/69 Test #44: person_arc .......................   Passed    0.00 sec
      Start 45: phonebook
45/69 Test #45: phonebook ........................   Passed    0.00 sec
      Start 46: prime
46/69 Test #46: prime ............................   Passed   29.01 sec
      Start 47: printspan
47/69 Test #47: printspan ........................   Passed    0.03 sec
      Start 48: priority
48/69 Test #48: priority .........................   Passed    3.03 sec
      Start 49: queue
49/69 Test #49: queue ............................   Passed   24.24 sec
      Start 50: random
50/69 Test #50: random ...........................   Passed  207.54 sec
      Start 51: rawptr_elements
51/69 Test #51: rawptr_elements ..................   Passed    0.01 sec
      Start 52: read
52/69 Test #52: read .............................   Passed    0.01 sec
      Start 53: regex1
53/69 Test #53: regex1 ...........................   Passed    0.00 sec
      Start 54: regex2
54/69 Test #54: regex2 ...........................   Passed    0.01 sec
      Start 55: regex_match
55/69 Test #55: regex_match ......................   Passed    0.01 sec
      Start 56: regex_replace
56/69 Test #56: regex_replace ....................   Passed    0.01 sec
      Start 57: replace
57/69 Test #57: replace ..........................   Passed    0.01 sec
      Start 58: shape
58/69 Test #58: shape ............................   Passed    0.02 sec
      Start 59: sorted_map
59/69 Test #59: sorted_map .......................   Passed    0.00 sec
      Start 60: splitstr
60/69 Test #60: splitstr .........................   Passed    0.01 sec
      Start 61: sso_map
61/69 Test #61: sso_map ..........................   Passed    0.01 sec
      Start 62: sso_substr
62/69 Test #62: sso_substr .......................   Passed    0.00 sec
      Start 63: stack
63/69 Test #63: stack ............................   Passed    0.01 sec
      Start 64: sview_split
64/69 Test #64: sview_split ......................   Passed    0.00 sec
      Start 65: triples
65/69 Test #65: triples ..........................   Passed    0.01 sec
      Start 66: unordered_set
66/69 Test #66: unordered_set ....................   Passed    0.00 sec
      Start 67: utf8replace_c
67/69 Test #67: utf8replace_c ....................   Passed    0.00 sec
      Start 68: vikings
68/69 Test #68: vikings ..........................   Passed    0.01 sec
      Start 69: stctest
69/69 Test #69: stctest ..........................***Failed    0.02 sec

99% tests passed, 1 tests failed out of 69

Total Test time (real) = 302.79 sec

The following tests FAILED:
     69 - stctest (Failed)
Errors while running CTest
tylov commented 1 year ago

I had the exact issue with this test early on, and think I found out why, but I don't remember what I did to fix it. The odd thing is that the (check)sum is correct, whereas the size of the stack is wrong, which doesn't make sense... I'll figure it out.

tylov commented 1 year ago

I think it is related to 32-bit arch. I will do a more thorough testing on my Raspberry Pi 3 with 32-bit OS.

barracuda156 commented 1 year ago

I think it is related to 32-bit arch. I will do a more thorough testing on my Raspberry Pi 3 with 32-bit OS.

Great, thank you!

tylov commented 1 year ago

For some reason, in ASSERT_EQ(n(n + 1)/2, sum), the first expression appears to evaluate to n/2 instead of n(n + 1)/2. Maybe this was what I fixed, and you have an older version with n/2 in this test?

barracuda156 commented 1 year ago

For some reason, in ASSERT_EQ(n(n + 1)/2, sum), the first expression appears to evaluate to n/2 instead of n(n + 1)/2. Maybe this was what I fixed, and you have an older version with n/2 in this test?

I used v. 4.2 to build and test. https://github.com/macports/macports-ports/blob/2ef4edf66e1a20727cc213d740790be6bc92c766/devel/STC/Portfile#L8

barracuda156 commented 1 year ago

@tylov This one not yet fixed, right?

tylov commented 1 year ago

Closed as FIXED

barracuda156 commented 1 year ago

@tylov I can confirm 100% tests pass now. Thank you!