Cody

Solution 1935027

Submitted on 13 Sep 2019
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Fail
d1 = '2010/12/14 12:00:00'; d2 = '2010/12/17 17:06:00'; elapsed = 77.1; assert(abs(elapsed_time(d1,d2) - elapsed) < 1e-6)

Undefined function 'tabs' for input arguments of type 'double'. Error in elapsed_time (line 4) e=tabs(t1-t2); Error in Test1 (line 4) assert(abs(elapsed_time(d1,d2) - elapsed) < 1e-6)

2   Fail
d1 = '2010/12/14 12:00:00'; d2 = '2010/12/14 12:00:01'; elapsed = 1/3600; assert(abs(elapsed_time(d1,d2) - elapsed) < 1e-6)

Undefined function 'tabs' for input arguments of type 'double'. Error in elapsed_time (line 4) e=tabs(t1-t2); Error in Test2 (line 4) assert(abs(elapsed_time(d1,d2) - elapsed) < 1e-6)

3   Fail
d1 = '1924/1/7 12:45:00'; d2 = '2010/12/14 17:06:00'; elapsed = 762076.35; assert(abs(elapsed_time(d1,d2) - elapsed) < 1e-6)

Index exceeds the number of array elements (17). Error in elapsed_time (line 2) t1=str2num(d1(1:4))*8760+str2num(d1(6:7))*720+str2num(d1(9:10))*24+str2num(d1(12:13))+str2num(d1(15:16))/60+str2num(d1(18:19))/3600; Error in Test3 (line 4) assert(abs(elapsed_time(d1,d2) - elapsed) < 1e-6)

4   Fail
d1 = '2010/12/14 12:00:00' d2 = '2010/12/14 13:06:36' elapsed = 1.11; assert(abs(elapsed_time(d1,d2) - elapsed) < 1e-6)

d1 = '2010/12/14 12:00:00' d2 = '2010/12/14 13:06:36'

Undefined function 'tabs' for input arguments of type 'double'. Error in elapsed_time (line 4) e=tabs(t1-t2); Error in Test4 (line 4) assert(abs(elapsed_time(d1,d2) - elapsed) < 1e-6)

Suggested Problems

More from this Author95