Skip to content

Instantly share code, notes, and snippets.

@AlfiyaZi
Created October 10, 2022 10:37
Show Gist options
  • Save AlfiyaZi/27b844f1b0f665db7d901acd12d7d524 to your computer and use it in GitHub Desktop.
Save AlfiyaZi/27b844f1b0f665db7d901acd12d7d524 to your computer and use it in GitHub Desktop.
leap ( None is not False)
note
description: "leap_year application root class"
date: "$Date$"
revision: "$Revision$"
class
APPLICATION
inherit
ARGUMENTS
create
make
feature {NONE}
y: LEAP
res: BOOLEAN
make
do
create y
print(y.is_leap_year (2004))
end
end
note
description : "this class implements is leap yeat check."
date : "$Date$"
revision : "$Revision$"
class
LEAP_INITIAL
inherit
ARGUMENTS
feature
is_leap_year (y: INTEGER): BOOLEAN
do
-- Implement your solution here.
end
end
note
description: ""
author: "EiffelStudio test wizard"
date: "$Date$"
revision: "$Revision$"
testing: "type/manual"
class
LEAP_TEST
inherit
EQA_TEST_SET
redefine
on_prepare
end
feature {NONE} -- Events
test: LEAP
on_prepare
-- <Precursor>
do
create test
end
feature -- Test routines
leap_year_2004
do
assert ("Leap year: 2004", test.is_leap_year(2004) = True)
end
leap_year_1900
do
assert ("Leap year: 1900", test.is_leap_year(1900) = False)
end
leap_year_2018
do
assert ("Leap year: 2018", test.is_leap_year(2018) = False)
end
leap_year_1999
-- New test routine
do
assert ("Leap year: 1999", test.is_leap_year(1999) = False)
end
leap_year_2012
do
assert ("Leap year: 2012", test.is_leap_year(2012) = True)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment