forked from 12meses12katas/Enero-String-Calculator
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test para ningun y un parametro en la entrada OK
- Loading branch information
Showing
12 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>StringCalculator</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.python.pydev.PyDevBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.python.pydev.pythonNature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<?eclipse-pydev version="1.0"?> | ||
|
||
<pydev_project> | ||
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property> | ||
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property> | ||
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH"> | ||
<path>/StringCalculator</path> | ||
<path>/StringCalculator/src</path> | ||
</pydev_pathproperty> | ||
</pydev_project> |
Empty file.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class Calculator(object): | ||
|
||
def __init__(self): | ||
pass | ||
|
||
def add(self, addParams): | ||
|
||
result = 0 | ||
|
||
if addParams != "": | ||
result = int(addParams) | ||
|
||
return result |
Binary file not shown.
Empty file.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import unittest | ||
from src.main import Calculator | ||
|
||
|
||
class CalculatorTest(unittest.TestCase): | ||
|
||
def testAddNoParams(self): | ||
|
||
calc = Calculator.Calculator() | ||
|
||
expected = 0 | ||
resulted = calc.add("") | ||
|
||
self.assertEquals(expected, resulted, "Adding no params Error") | ||
|
||
pass | ||
|
||
def testAddOneParam(self): | ||
|
||
calc = Calculator.Calculator() | ||
|
||
expected = 1 | ||
resulted = calc.add("1") | ||
|
||
self.assertEquals(expected, resulted, "Adding one param Error") | ||
|
||
pass | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
Binary file not shown.
Empty file.
Binary file not shown.