#Cannot pass test case:

121 messages ยท Page 1 of 1 (latest)

nocturne juniperBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

thick lava
#

do you have any other tests?

#

this test tests a lot of things working together and it would be good to narrow down what specifically is going wrong

#

If you don't then I would advise writing more tests that are smaller parts of the code e.g. this method currently tests that you're inserting and printing correctly but would be nice if it was one or the other

sharp haven
#

the assignment came with a template of tests

#

i cant seem to figure out where im going wrong with these 2 functions

thick lava
#

honestly they look okay to me at first glance

#

try debugging

sharp haven
# thick lava try debugging

for the print i get this output: [7, 7, -3, 40, 500, -60, 7099] however im meant to get [1, 2, -3, 40, 500, -60, 7099], i am unsure where the 2 7;s are coming from?

#

do you have any ideas why this could be?

#

is the issue with my constructor?

thick lava
#

okay well I think it helps to look at the failed output vs expected
expect = [1, 2, -3, 40, 500, -60, 7099]
actual = [7, 7, -3, 40, 500, -60, 7099]
seems like its just the first 2 elements that get messed up

sharp haven
#

yeah i think so

#

i j dk why tho

graceful terrace
#

have you tried stepping through it with a debugger?

sharp haven
#

my lecturer hasnt covered the debugger yet ๐Ÿ˜ญ

#

its upcomming in lectures lmfao

graceful terrace
#

sounds like it's time for self study ๐Ÿ˜‰

sharp haven
#

i think ur right ๐Ÿ˜ญ

#

ahaha

graceful terrace
#

debuggers are easy to learn, tbh

#

and probably the most powerful tool in a programmer's toolbox

sharp haven
#

ill watch a video now on debugging with vscode

#

ty

thick lava
#

I threw it into compiler explorer and it works fine

#

you sure you saved the file

#

and rebuilt the code

graceful terrace
#

@thick lava link?

thick lava
sharp haven
#

?

#

passes the test?

sharp haven
thick lava
#

well id on't have the tests

sharp haven
#

using makefile

thick lava
#

but I artificially recreated it

sharp haven
graceful terrace
#

Memory Sanitizer doesn't like it

sharp haven
#

does this mean my program has memory leaks?

graceful terrace
#

It means you're using an uninitialized value

sharp haven
#

oh wtf

graceful terrace
#

finding where it is real quick

sharp haven
#

ok thank you ๐Ÿ™

graceful terrace
#

oh, it may be the standard library KEKW

sharp haven
#

ive been stressed out abt this lmfao i have been tryna edit the print func for days ๐Ÿ˜ญ

#

appreciate the help btw <33

sharp haven
#

๐Ÿ˜‚

thick lava
graceful terrace
#

nvm, wasn't it. trying to hunt it down now

#

i'm using clang

sharp haven
thick lava
#

oh wait I meant clang lol

sharp haven
#

i use g++ in my makefile

#

if thats of any relevence

#

its given with the assignment

#

the makefile

graceful terrace
#

looks like string stream has a sanitizer issue

sharp haven
#

is that because of me or just the import itself

graceful terrace
#

so not your code, dw about it

sharp haven
#

ah okay

#

ty

thick lava
#

madness

sharp haven
#

๐Ÿ˜ญ

#

i feel like the mistake is in the constructor but i honestly have no clue

#

im j guessing

thick lava
#

well as far as we can tell there is no mistake

sharp haven
#

bc the logic for the print makes sense to me??

#

๐Ÿ˜ญ

thick lava
#

you 100% sure you rebuilt it

sharp haven
#

yeah i ran make in terminal

thick lava
#

try deleting the build and rebuilding from scratch

sharp haven
#

before i ran it

sharp haven
#

and restarign?

thick lava
#

yeah delete any temporary build files

sharp haven
#

ok 1 sec

#

ill try it now

thick lava
#

you can get bugs where you edited something like halfway through a build and it gets corrupted and messes with you

sharp haven
#

bro what the fuck

#

omds

#

it worked

#

holy shit

#

ur actually a life saver

#

like u dont understand

#

๐Ÿ™

thick lava
#

honestly dw I had this the other day lol

sharp haven
#

brooo ive had this bug

#

since last night

#

i stayed up

#

cuz its due tmr

#

i was so stressed

#

๐Ÿ˜ญ

thick lava
#

only noticed because I tried to debug and the debugger wouldn't attach to the new code because it didn't exist

#

(for mine)

#

but yeah

#

its an annoying bug to run into

sharp haven
#

i cannot thank u enough bro

#

actually the goat

#

๐Ÿซถ

thick lava
#

you're welcome

sharp haven
#

do u mind if i leave this tab open and paste questions if i hav more later

#

u guys seem rly knowledable

thick lava
#

sure but you can just ask another question if it comes up

sharp haven
#

okay

#

tysm !!

graceful terrace
#

Lmao. I was going through this line by line trying to find the differences ๐Ÿ˜ญ

#

glad it was something easy KEKW

sharp haven
#

๐Ÿ˜ญ

#

๐Ÿซถ ๐Ÿซถ

thick lava
#

anyway yeah this is one of those things where you have to use the "there is a bug therefore something is wrong" principle

YOu check all the things within reason about your code and then you have to think "hmm if I assume the code is right for one second what else could cause this"

#

Not neccessarily something a beginner would be able to spot because you have to just know this can happen sometimes (and that usually comes from it having happened to you) but now you know

sharp haven
#

yeah ill look out for this moving forwards

#

tysm!!

nocturne juniperBOT
#

@sharp haven Has your question been resolved? If so, type !solved :)

sharp haven
#

!solved

nocturne juniperBOT
#

Thank you and let us know if you have any more questions!

This thread is now set to auto-hide after an hour of inactivity