Skip to content

Commit

Permalink
Test para ningun y un parametro en la entrada OK
Browse files Browse the repository at this point in the history
  • Loading branch information
Amedio committed Oct 15, 2011
1 parent 6f940c1 commit b2bfc0c
Show file tree
Hide file tree
Showing 12 changed files with 72 additions and 0 deletions.
17 changes: 17 additions & 0 deletions amedio/.project
@@ -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>
11 changes: 11 additions & 0 deletions amedio/.pydevproject
@@ -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 added amedio/src/__init__.py
Empty file.
Binary file added amedio/src/__init__.pyc
Binary file not shown.
13 changes: 13 additions & 0 deletions amedio/src/main/Calculator.py
@@ -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 added amedio/src/main/Calculator.pyc
Binary file not shown.
Empty file added amedio/src/main/__init__.py
Empty file.
Binary file added amedio/src/main/__init__.pyc
Binary file not shown.
31 changes: 31 additions & 0 deletions amedio/src/test/CalculatorTest.py
@@ -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 added amedio/src/test/CalculatorTest.pyc
Binary file not shown.
Empty file added amedio/src/test/__init__.py
Empty file.
Binary file added amedio/src/test/__init__.pyc
Binary file not shown.

0 comments on commit b2bfc0c

Please sign in to comment.