Giter Site home page Giter Site logo

voting's Introduction

voting

An exploration (for now) of voting systems for Java8 and the Groovy language.

The build system is Gradle.

Install JDK8, set the JAVA_HOME global environment variable to point to it, and put the bin folder on your PATH.

2017-05-13

NOTE: This project has been converted to a multi-module Gradle build, with currently 1 sub-project, voting-core.

You can run the build/tests/codeQuality and generate API documentation from your shell with:

  • Unix: ./gradlew build
  • Windows: gradlew build

This will:

  • Download and install the correct version of Gradle if it's not already installed
  • Download and cache project dependencies that are not already available
  • Clean and Compile the source code
  • Gather code quality metrics, using Codenarc
  • Run all the tests, implemented with Spock Framework
  • Gather test code coverage metrics, using Jacoco
  • Generate HTML code quality and test reports
  • Generate HTML API documentation
  • Build a voting-core.jar file

NOTE: The build will stop if there were failures at any step

The build output can be found in the voting-core/build folder:

  • voting-core.jar library file in libs folder
  • HTML code quality reports in reports/codenarc folder
  • HTML test reports in reports/tests folder
  • HTML test reports in docs folder

Voting Systems

The highly readlble test cases demonstrate some voting systems. Individual test specs can be run in any Java IDE or from command line.

2017-05-16

Currently 5 voting systems can be found and shown to work in the Test classes:

  • WinPlaceShowVotingSpec - voters can vote Win, Place, or Show to express preference for the top 3 VotingItems (candidate, or budget). Win counts for 4 votes, Place counts for 2 votes, and Show counts 1 vote. The tests assert the Tally is correct for each item.
  • AverageNumberVotingSpec - voters can vote on a number and the result is the average value of all the votes
  • SingleVoteCandidateVotingSpec - voters can cast 1 vote for a candidate from a list of candidates
  • TwoVoteCandidateVotingSpec - voters can cast 2 votes for a candidate(s) from a list of candidates
  • CappedTotalAverageNumberVotingSpec - voters can vote on a number of items that are numbers and the result is the possibly adjusted (so the total of ll items <= the cap) average value of all the votes capped balanced by the number of Voters; essentially a simple budgeting system
  • Introduced Tally to replace use of Map for holding tally results
  • Added support for JaCoCo code coverage

TODO

  • Rework Vote and Selection similar to Tally ?????
  • Clarify and possibly rework the Selection concept
  • Support more data-driven testing via spreadsheets
  • Build a demo webapp to allow users to test voting systems by downloading a partially initialized spreadsheet, filling in the votes, and uploading the filled out spreadsheet and get back a report of the Tally

voting's People

Contributors

kktec avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.