CSC/ECE 517 Spring 2018 E1814 Write unit tests for collusion cycle.rb
Introduction
Expertiza Background
Expertiza is an opensource web application maintained by students and faculty members of North Carolina State University. Through it students can submit and peer-review learning objects (articles, code, web sites, etc). More information on http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation.
Project Description
Collusion_cycle.rb is a part of the Expertiza project used to calculate potential collusion cycles between peer reviews. Our purpose is to write corresponding unit tests (collusion_cycle_spec.rb) for it.
Project Details
Model introduction
Model purpose
The file collusion_cycle.rb in app/models is used to calculate potential collusion cycles between peer reviews which means two assignment participants are accidentally assigned to review each other's assignments directly or through a so-called collusion cycle. For example, if participant A was reviewed by participant B, participant B was reviewed by participant C, participant C was reviewed by participant A and all the reviews were indeed finished, then a three nodes cycle exists. Cases including two nodes, three nodes and four nodes have been covered in collusion_cycle.rb.
Functions introduction
4. cycle_similarity_score(cycle)
def cycle_similarity_score(cycle) similarity_score = 0.0 count = 0.0 for pivot in 0...cycle.size - 1 do pivot_score = cycle[pivot][1] for other in pivot + 1...cycle.size do similarity_score += (pivot_score - cycle[other][1]).abs count += 1.0 end end similarity_score /= count unless count == 0.0 similarity_score end
Test Description
Cycle Detection
1. two-node
2. three node
3. four node
Scores
1. similarity
2. deviation
Coverage Result
Future Work
Reference
1. rspec *2
2. expertiza *3