Cody

Problem 44270. Assert yourself! Hack the assert function to pass this test.

Solution 1282927

Submitted on 8 Oct 2017 by David Verrelli
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   Pass
x = 'Try this one'; y_correct = rand(1); assert(isequal(assertYourself(x),y_correct))

assert = function_handle with value: @(varargin)true Number of provided inputs: 1 Number of requested outputs: 1

2   Pass
clear all; x = rand(10); y_correct = rand(1); assertYourself(); assert(isequal(true,false))

assert = function_handle with value: @(varargin)true Number of provided inputs: 0 Number of requested outputs: 0 ans = logical 1

3   Pass
clear all; x = rand(10); y = assertYourself(x,'blah') y_correct = rand(1); assert(isequal(y,y_correct))

assert = function_handle with value: @(varargin)true Number of provided inputs: 2 Number of requested outputs: 1 y = 0 ans = logical 1

4   Pass
clear all; x = randi(26,10); y_correct = rand(1); [v,z]= assertYourself(x,x,x); z; msg = ['That is not even fair! ',char(randi(26,1,10)+'A')] assert(isequal(x,y_correct));

assert = function_handle with value: @(varargin)true Number of provided inputs: 3 Number of requested outputs: 2 msg = 'That is not even fair! ESHGLRSHKJ'

5   Pass
clear all; [v,z]= assertYourself(); v; assert(false);

assert = function_handle with value: @(varargin)true Number of provided inputs: 0 Number of requested outputs: 2

Suggested Problems

More from this Author2