Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
assessFunctionAbsence({'regexp','regexpi','regexprep','str2num'},'FileName','counter.m')
|
2 | Pass |
f = counter(0,1);
assert(isequal(f(),0))
assert(isequal(f(),1))
assert(isequal(2,f()))
assert(isequal(3,f()))
[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.]
[> In unix (line 32)
In counter (line 2)
In ScoringEngineTestPoint2 (line 1)
In solutionTest (line 5)]
|
3 | Pass |
f = counter(1,0);
assert(isequal(f(),1))
assert(isequal(f(),1))
assert(isequal(1,f()))
assert(isequal(1,f()))
[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.]
[> In unix (line 32)
In counter (line 2)
In ScoringEngineTestPoint3 (line 1)
In solutionTest (line 7)]
|
4 | Pass |
f = counter(10,2);
assert(isequal(f(),10))
assert(isequal(f(),12))
assert(isequal(14,f()))
assert(isequal(16,f()))
[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.]
[> In unix (line 32)
In counter (line 2)
In ScoringEngineTestPoint4 (line 1)
In solutionTest (line 9)]
|
5 | Pass |
f = counter(0,5);
y_correct = [0, 5, 10, 15, 20, 55];
assert(isequal([f() f() f() f() f() f()+f()],y_correct))
[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.]
[> In unix (line 32)
In counter (line 2)
In ScoringEngineTestPoint5 (line 1)
In solutionTest (line 11)]
|
6 | Pass |
x0 = randi(10);
b = randi(10);
f = counter(x0,b);
y_correct = x0 + (0:1000)*b;
assert(isequal(arrayfun(@(n)f(),0:1000),y_correct))
[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.]
[> In unix (line 32)
In counter (line 2)
In ScoringEngineTestPoint6 (line 3)
In solutionTest (line 13)]
|
Extract leading non-zero digit
967 Solvers
1515 Solvers
2937 Solvers
263 Solvers
812 Solvers