LightVoting
 All Classes Namespaces Files Functions Variables Pages
org.lightvoting.simulation.rule.CMinimaxApprovalTest Class Reference

Created by sophie on 09.02.17. More...

Inherits TestCase.

+ Collaboration diagram for org.lightvoting.simulation.rule.CMinimaxApprovalTest:

Public Member Functions

 CMinimaxApprovalTest (final String p_testName)
 Create the test case. More...
 
void testApplyRule ()
 test application of voting rule More...
 

Static Public Member Functions

static Test suite ()
 Testsuite. More...
 

Detailed Description

Definition at line 38 of file CMinimaxApprovalTest.java.

Constructor & Destructor Documentation

org.lightvoting.simulation.rule.CMinimaxApprovalTest.CMinimaxApprovalTest ( final String  p_testName)
Parameters
p_testNamename of the test case

Definition at line 46 of file CMinimaxApprovalTest.java.

47  {
48  super( p_testName );
49  }

Member Function Documentation

static Test org.lightvoting.simulation.rule.CMinimaxApprovalTest.suite ( )
static
Returns
the suite of tests being tested

Definition at line 56 of file CMinimaxApprovalTest.java.

57  {
58  return new TestSuite( CMinimaxApprovalTest.class );
59  }
CMinimaxApprovalTest(final String p_testName)
Create the test case.
void org.lightvoting.simulation.rule.CMinimaxApprovalTest.testApplyRule ( )

Definition at line 64 of file CMinimaxApprovalTest.java.

65  {
66  final CMinimaxApproval l_minimaxApproval = new CMinimaxApproval();
67 
68  final List<String> l_alternatives = new ArrayList<String>();
69 
70  l_alternatives.add( "POI1" );
71  l_alternatives.add( "POI2" );
72  l_alternatives.add( "POI3" );
73  l_alternatives.add( "POI4" );
74  l_alternatives.add( "POI5" );
75  l_alternatives.add( "POI6" );
76 
77  final List<BitVector> l_votes = new ArrayList<>();
78 
79  final BitVector l_vote1 = new BitVector( 6 );
80  l_vote1.put( 0, true );
81  l_vote1.put( 1, true );
82  l_vote1.put( 2, true );
83  l_vote1.put( 3, true );
84  l_vote1.put( 4, true );
85 
86  final BitVector l_vote2 = l_vote1.copy();
87  final BitVector l_vote3 = l_vote1.copy();
88  final BitVector l_vote4 = l_vote1.copy();
89  final BitVector l_vote5 = l_vote1.copy();
90 
91  final BitVector l_vote6 = new BitVector( 6 );
92  l_vote6.put( 3, true );
93  l_vote6.put( 4, true );
94  l_vote6.put( 5, true );
95 
96  l_votes.add( l_vote1 );
97  l_votes.add( l_vote2 );
98  l_votes.add( l_vote3 );
99  l_votes.add( l_vote4 );
100  l_votes.add( l_vote5 );
101  l_votes.add( l_vote6 );
102 
103  final int l_comSize = 3;
104 
105  final BitVector l_bitVector = l_minimaxApproval.applyRuleBV( l_alternatives, l_votes, l_comSize );
106  System.out.println( l_bitVector );
107  }