bytewiser icon indicating copy to clipboard operation
bytewiser copied to clipboard

official solution to exercise 2 does not pass

Open ghost opened this issue 10 years ago • 2 comments

Hello,

When I use the official solution which looks like this :


var bytes = [0, 15, 24, 3, 250, 83]
var buff = new Buffer(bytes)
console.log(buff.toString('hex'))

I see this output:


Your submission results compared to the expected:                                                        

                 ACTUAL                                  EXPECTED                                        
────────────────────────────────────────────────────────────────────────────────                         

   "000f1803fa53"                      !=    "7c11bcb6d2"                                                
   ""                                  ==    ""                                                          

────────────────────────────────────────────────────────────────────────────────                         

✗ Submission results match expected                                                                      

# FAIL                                                                                                   

Your solution to Hexadecimal Encoding didn't pass. Try again!  

nodejs version : v0.10.32 workshop version : [email protected]

Roelof

ghost avatar Jan 22 '15 07:01 ghost

Hey @roelof1967,

There seems to be some misconception here.

The code you pasted in is not the official solution. The official solution takes numbers from process.argv[2], as described in the problem text. Here is the official solution (well, it used to rely on parseInt instead of Number, but the overall logic is the same):

var bytes = process.argv.slice(2).map(Number)
console.log(new Buffer(bytes).toString('hex'))

The code you pasted definitely displays the value you listed as "actual." But because the solution runner uses random bytes on each run, there's no way static values in the code will match!

Hope this helps.

@maxogden this is closable.

tdd avatar Apr 25 '15 09:04 tdd

@tdd , @maxogden did not finish his task!

keevvinc avatar Nov 03 '17 21:11 keevvinc