This is the code i have written and output is exactly matching with expected but still my testcase is failing.
Could you share your code using a codeblock and not an image?
Could you also share the output of the failed test? You may need to click on the test failure to expand it and get all the details.
namespace eval resistorColor {
proc colorCode {args} {
set colours [dict create black "0" brown "1" red "2" orange "3" yellow "4" green "5" blue "6" violet "7" grey "8" white "9"]
set value [dict get $colours $args]
puts $value
}
proc colors {args} {
set colours [dict create black "0" brown "1" red "2" orange "3" yellow "4" green "5" blue "6" violet "7" grey "8" white "9"]
set keys [dict keys $colours]
puts $keys
}
}
Could you please share the test outputs as text in a codeblock? Please do not use images to share text!
Code Run:
# code:
resistorColor::colorCode black
# using exact matching
# expected value: 0
Test Failure
==== resistor-color-ok-1 Color black FAILED
==== Contents of test case:
resistorColor::colorCode black
---- Result was:
---- Result should have been (exact matching):
0
==== resistor-color-ok-1 FAILED
Your Output
0
Your function isn’t returning 0
. It is printing output, 0
. Printing and returning are very different.
2 Likes
Thanks! 11 testcases are passed after replacing “puts” with “return”.