66 lines
2.6 KiB
Plaintext
66 lines
2.6 KiB
Plaintext
|
|
||
|
''Previous page: [[!-ArrayFixture-!][<UserGuide.FixtureGallery.FitLibraryFixtures.ArrayFixture]] Next page: [[!-ConstraintFixture-!][<UserGuide.FixtureGallery.FitLibraryFixtures.ConstraintFixture]] Parent page: [[!-FitLibrary Fixtures-!][<UserGuide.FixtureGallery.FitLibraryFixtures]]''
|
||
|
!2 !-CombinationFixture-!
|
||
|
'''!- CombinationFixture -!'''!- is used to perform an operation on pairs on values. The values are specified in a row and a column and the operation is performed on all combinations of values. -!
|
||
|
|
||
|
# section Table Format
|
||
|
!3 !-Table Format-!
|
||
|
!- The first row of the table is the fixture class name. The second row contains an empty cell followed by cells containing the values to be used as the second parameter for the operation. All subsequent rows contain a value in the first cell to be used as the first parameter for the operation, followed by cells containing the expected value of the operation. -!
|
||
|
|
||
|
{{{
|
||
|
!-!-!|CombinationFixtureTest|
|
||
|
| |1 |2|3|
|
||
|
|6 |6 |3|2|
|
||
|
|12|12|6|4|
|
||
|
}}}
|
||
|
# section Fixture class
|
||
|
!3 !-Fixture class-!
|
||
|
!- The fixture class should extend -!'''!- fitlibrary.CombinationFixture -!'''!-. It should declare a method -!'''!- combine -!'''!- which takes two values (row and column) and returns a value. -!
|
||
|
|
||
|
# section Java Source Code
|
||
|
!3 !-Java Source Code-!
|
||
|
{{{
|
||
|
package info.fitnesse.fixturegallery;
|
||
|
|
||
|
import fitlibrary.CombinationFixture;
|
||
|
|
||
|
public class CombinationFixtureTest extends CombinationFixture{
|
||
|
public int combine(int theFirst, int theSecond) {
|
||
|
return theFirst / theSecond;
|
||
|
}
|
||
|
}
|
||
|
}}}
|
||
|
# section .NET Source Code
|
||
|
!3 !-.NET Source Code-!
|
||
|
{{{
|
||
|
using fitlibrary;
|
||
|
|
||
|
namespace info.fitnesse.fixturegallery {
|
||
|
public class CombinationFixtureTest: CombinationFixture {
|
||
|
public int combine(int theFirst, int theSecond) {
|
||
|
return theFirst / theSecond;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}}}
|
||
|
# section Python Source Code
|
||
|
!3 !-Python Source Code-!
|
||
|
{{{
|
||
|
# PYTHON: info.fitnesse.fixturegallery.CombinationFixtureTest
|
||
|
from fitLib.CombinationFixture import CombinationFixture
|
||
|
|
||
|
class CombinationFixtureTest(CombinationFixture):
|
||
|
_typeDict = {}
|
||
|
|
||
|
# PY3K: combine(theFirst : int, theSecond : int) : int
|
||
|
_typeDict["combine.types"] = [ "Int", "Int", "Int" ]
|
||
|
def combine(self, theFirst, theSecond):
|
||
|
return theFirst / theSecond
|
||
|
}}}
|
||
|
# section Usage
|
||
|
!3 !-Usage-!
|
||
|
'''!- CombinationFixture -!'''!- can be used to describe calculation rules that depend on exactly two arguments. -!
|
||
|
|
||
|
|
||
|
''Previous page: [[!-ArrayFixture-!][<UserGuide.FixtureGallery.FitLibraryFixtures.ArrayFixture]] Next page: [[!-ConstraintFixture-!][<UserGuide.FixtureGallery.FitLibraryFixtures.ConstraintFixture]] Parent page: [[!-FitLibrary Fixtures-!][<UserGuide.FixtureGallery.FitLibraryFixtures]]''
|