Skip to content

Instantly share code, notes, and snippets.

View virtix's full-sized avatar
💭
I may be slow to respond.

bill shelton virtix

💭
I may be slow to respond.
View GitHub Profile
package edu.gmu.mut;
public class Loyalty {
/**
* Given a a number representing the total dollar amount
* of purchases, this returns some discount
* */
@virtix
virtix / LoyaltyDiscountTest.java
Created April 14, 2011 08:41
Original mutation-based test generation
package edu.gmu.mut.test;
import static org.junit.Assert.*;
import org.junit.Test;
import edu.gmu.mut.Account;
import edu.gmu.mut.Discount;
import edu.gmu.mut.GenreDiscount;
import edu.gmu.mut.LoyaltyDiscount;
import edu.gmu.mut.Purchase;
@virtix
virtix / selenium_with_python.rst
Created August 5, 2011 04:27 — forked from baijum/selenium_with_python.rst
Selenium with Python

Selenium with Python

Author: Baiju Muthukadan
Email:baiju.m.mail AT gmail.com
Version: 0.5.0
package edu.gmu.mut;
import java.util.ArrayList;
import java.util.Calendar;
/**
* Class Account represents an immutable customer account.
*/
public class Account {
package edu.gmu.mut;
import java.util.ArrayList;
import java.util.Calendar;
/**
* Class Account represents an immutable customer account.
*/
public class Account {
@virtix
virtix / search.html
Created October 2, 2011 17:37
random name data in jas
<html>
<head>
<title>JS search algorithm</title>
<script>
peeps =[
{'Abraham G. Kerr'=[]},
{'Abraham T. Leon'=[]},
{'Adena A. Fox'=[]},
{'Adrian B. Stafford'=[]},
//mutation-driven
//cause an error; the program should deal with the negative number
@Test
public void testPurchasesWithNegativeNumbers(){
DiscountCalculator calc = new DiscountCalculator();
dayZero.set(2011, Calendar.JANUARY, 15, 0, 8, 45);
Account winner = a(d(-19), d(-4), p("reggae", 8, d(-12)), p("rock-a-billy", -10, d(-7)));
Discount d = calc.getSpecialDiscount(winner, d(-1));
//System.out.println( d.getDiscount() );
assertEquals("Probably should throw exception on purchases with negative amounts.", d.getDiscount().multiply(new BigDecimal(100)).intValue());
@virtix
virtix / CoverageTest.java
Created October 25, 2011 11:13
Shows how statement coverage can be higher than branch coverage. This is an inverse subsumption relation.
package test;
import static org.junit.Assert.*;
import org.junit.Test;
import junit.framework.TestCase;
public class CoverageTest {
@virtix
virtix / TestSimpleHttpNTLMConnection.java
Created November 4, 2011 20:46
Simple HttpClient 4.1 that performs an HTTP GET request through NTLM v2
package test;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.List;
import java.util.ArrayList;
@virtix
virtix / jquery-dynamic-form.js
Created November 21, 2011 11:48
Trying to do a many-to-may model in django
/**
* @copyright
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the