org.aisb.bio.tests
Class TestB3

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.aisb.bio.tests.TestB3
All Implemented Interfaces:
junit.framework.Test

public class TestB3
extends junit.framework.TestCase

This is a set of unit tests for assignment B3. It can be used as a JUnit TestCase, or run from the command line. When it's run from the command line, every test in it will be executed exactly once. See the documentation for the individual test methods to see all the tests.

Author:
Doug DeJulio

Constructor Summary
TestB3()
           
 
Method Summary
static void main(java.lang.String[] args)
          Run the tests from the command line.
 void testCreateASequence()
           Test the creation of a simple nucleotide sequence from a string.
 void testLoadingAnOrganism()
           Test loading an AsexualOrganism from a simple text file.
 void testMaxScore()
           Test that our PSSM object can really calculate the maximum score of a PSSM.
 void testMutationFunction()
           Test that our mutation function is actually mutating.
 void testSomeKnownSequences()
           Calculate the fitness of a couple of fixed sequences for which the fitness is already known.
 
Methods inherited from class junit.framework.TestCase
countTestCases, getName, run, run, runBare, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TestB3

public TestB3()
Method Detail

testCreateASequence

public void testCreateASequence()

Test the creation of a simple nucleotide sequence from a string.

We create a sequence from the string "GATTACA". Then we fetch the first three nucleotides and test to make sure they're really "G", "A", and "T". This tests the sequence-building code.


testSomeKnownSequences

public void testSomeKnownSequences()

Calculate the fitness of a couple of fixed sequences for which the fitness is already known.

We've calculated the fitness of a sequence of all "A" and of all "G" ahead of time. We construct these sequences and calculate their fitness. This tests the PSSM fitness function code.


testLoadingAnOrganism

public void testLoadingAnOrganism()
                           throws java.io.IOException

Test loading an AsexualOrganism from a simple text file.

We've got a sample organism file in "data/test_organism.txt". We know its nucleotide sequence starts with "GAT". We load the organism from the file, fetch the sequence from the organism, and fetch the first three nucleotides from the sequence. This tests the organism data model, the file I/O, and the sequence and nucleotide fetching functionalities.

Throws:
java.io.IOException

testMutationFunction

public void testMutationFunction()

Test that our mutation function is actually mutating.

We start with the nucleotide 'A'. Then we configure our Mutator so that it has a probability of 1 of causting mutation. Then we run it on 'A' 100 times, making sure we never get an 'A' out. This is a crude test of our mutator function. By single-stepping through the process with a debugger, we can do a fine-grained test of it. We can't code up a complete test of it with certain results, since it has a random element and we will want to stop using a fixed random seed at some point.


testMaxScore

public void testMaxScore()

Test that our PSSM object can really calculate the maximum score of a PSSM.

We've calcualted the maximum score from our test PSSM file elsewhere. We have our code run this calculation here and compare it to the known result. This tests our PSSM data object and its ability to calculate the maximum score.


main

public static void main(java.lang.String[] args)
Run the tests from the command line.

Parameters:
args -