Using junit framework to write test cases in java

Using junit is pretty easy in Netbeans. I am still searching for the ways to do it without any IDE ( use only javac over console)

When I came across junit framework, which is written to reduce the headache of programmer, I was excited to see, how it works. But surprising no nice tutorial is available for this. So here I trying to describe, how to use it for writing test-cases.

AFAIK there are two ways to do this.
1) using testSuite
2) using TestCase

Here is your sample program which extends TestCase

import junit.framework.TestCase;

public class ManualTest1 extends TestCase {
public ManualTest1(String testName) {
super(testName);
}
public void testCase1() {
System.out.println("testCase1");
}

    public void testFoo() {
System.out.println("testCase1");
}

}

You just have to extend TestCase, which is in the junit package.
and every function you write, use test** as the name of the function, such as testCase1, testFoo. Each function name must start with test.

How to do it without using IDE ( though will require ant ), follow this link:
tutorial-HelloWorldWithAnt

 

EDIT:

javac *.java
java org.junit.runner.JUnitCore filename

above commands can be used (i guess JUnitCore has main method). Can be elaborated on request/till-will-be-good.

Sequential Consistency : lets see what can be done

Recently as one of my course, We got an opportunity to read `BULK: Sequential consistency at the level of chunk`, so instead of communicating with memory model for each instruction (which is done in Sequential Consistency) communication is done for a chunk of instruction.

Yes yes, the question is how do we buffer the interaction of instruction in one chunk, So for this they use bloom-filter based signature approach.

Rest I am including in our presentation and report.
Papers we refer are :

Luis Ceze, James Tuck, Pablo Montesinos, Josep Torrellas: BulkSC: bulk enforcement of sequential consistency. ISCA 2007: 278-289

and

Luis Ceze, James Tuck, Josep Torrellas, Calin Cascaval: Bulk Disambiguation of Speculative Threads in Multiprocessors. ISCA 2006: 227-238.
ppt can be accessed BULK_ppt
and report is bulk_report

Analysing STM frameworks implemented in JAVA

Software Transactional Memory, sounds cool isn’t it ?
So why don’t we compare it against the Lock-free and optimistic list algorithms.
We have done experiments of 3 STM frameworks implemented in JAVA, namely Deuce, Jvstm and Multiverse. Sounds crazy with Deuce works better than any solution.

Experiments done : Insertion and deletion operation on a LinkedList or say concurrent LinkedList, which was implemented using above three STMs and Lock-free, coarse grain locking, fine grain locking.

Rest is described in report and implementation.

Report : STM_Implementation_Survey
Implementation : STM_Framework.tar.gz

Don’t forget to read README.txt, they are meant to be read.

Happy STMing. 🙂

Using template for c/c++/java with vim

Hi guys,
I have modified my .bashrc file to redefine vim, so that if you are creating a new file that has extension c, c++ or java, say Test.java or Test.c or Test.cpp, it will copy the template.ext file and put in your `pwd`.

vim in .bashrc is :

vim ()
{
    VIM=/usr/bin/vim;
    ext1=$(echo "$1" | awk -F. '{print $NF}');
    base=;
    filepath=`pwd`/$1;
    javatmp=~/template/template.java;
    if test -e "$1"; then
        $VIM "$@";
    else
        if [ "$ext1" == "c" ]; then
            cp ~/template/template.c $filepath;
            $VIM "$@" +9;
        else
            if [ "$ext1" == "cpp" ]; then
                cp ~/template/template.cpp $filepath;
                $VIM "$@" +14;
            else
                if [ "$ext1" == "java" ]; then
                    base=$(basename $1 .java);
                    sed s/classname/$base/ < $javatmp > $filepath;
                    $VIM "$@" +13;
                else
                    $VIM "$@";
                fi;
            fi;
        fi;
    fi
}

 

 

 

~/template/template.c : 

#include <stdio.h>

int main() {
   
    // printf("hello world\n");
    return 0;

}

~/template/template.cpp :

#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <iostream>

using namespace std;

int main(int argc, char **argv){

    return 0;
}

~/template/template.java :

import java.io.*;
import java.util.*;

public class classname {
    public static void main(String args[]){

    }
}