// Path: src/main/java/com/github/s3curitybug/similarityuniformfuzzyhash/UniformFuzzyHash.java
// public enum SimilarityTypes {
// 
//     /**
//      * Similarity of a hash to other hashes.
//      */
//     SIMILARITY("Similarity"),
// 
//     /**
//      * Similarity of other hashes to a hash.
//      */
//     REVERSE_SIMILARITY("Reverse"),
// 
//     /**
//      * Maximum similarity between Similarity and Reverse.
//      */
//     MAXIMUM("Maximum"),
// 
//     /**
//      * Minimum similarity between Similarity and Reverse.
//      */
//     MINIMUM("Minimum"),
// 
//     /**
//      * Arithmetic mean between Similarity and Reverse, (Similarity * Reverse) / 2.
//      */
//     ARITHMETIC_MEAN("ArithMean"),
// 
//     /**
//      * Geometric mean between Similarity and Reverse, sqrt(Similarity * Reverse).
//      */
//     GEOMETRIC_MEAN("GeomMean");
// 
//     /**
//      * Similarity type name.
//      */
//     private String name;
// 
//     /**
//      * Constructor.
//      * 
//      * @param name Similarity type name.
//      */
//     SimilarityTypes(
//             String name) {
// 
//         this.name = name;
// 
//     }
// 
//     /**
//      * @return The similarity type name.
//      */
//     public String getName() {
// 
//         return name;
// 
//     }
// 
//     /**
//      * @return A list with all the similarity types names.
//      */
//     public static List<String> names() {
// 
//         SimilarityTypes[] similarityTypes = SimilarityTypes.values();
//         List<String> similarityTypesNames = new ArrayList<>(similarityTypes.length);
// 
//         for (SimilarityTypes similarityType : similarityTypes) {
//             similarityTypesNames.add(similarityType.name);
//         }
// 
//         return similarityTypesNames;
// 
//     }
// 
// }


import org.junit.Assert;
import org.junit.Test;
import com.github.s3curitybug.similarityuniformfuzzyhash.UniformFuzzyHash.SimilarityTypes;
import java.io.File;
import java.io.IOException;

package com.github.s3curitybug.similarityuniformfuzzyhash;




/**
 * Class to test the Uniform Fuzzy Hash.
 * 
 * @author s3curitybug@gmail.com
 *
 */
public class UniformFuzzyHashTest {

    /**
     * Algorithm computation test.
     * Tests the algorithm computation over a test resource file and the hash toString method.
     * 
     * @throws IOException In case an exception occurs reading a test resource file.
     */
    @Test
    public void algorithmComputationTest()
            throws IOException {

        final int factor = 11;
        final File file = TestResourcesUtils.getTestResourceFile("RandomText/RandomText1/B.txt");

        UniformFuzzyHash hash = new UniformFuzzyHash(file, factor);
        String hashString = hash.toString();

        System.out.println(hashString);

    }

    /**
     * Hash rebuild test.
     * Tests the hash rebuild from a string representation of a hash computed over a test resource
     * file, and the hash equals method.
     * 
     * @throws IOException In case an exception occurs reading a test resource file.
     */
    @Test
    public void hashRebuildTest()
            throws IOException {

        final int factor = 11;
        final File file = TestResourcesUtils.getTestResourceFile("RandomText/RandomText1/B.txt");

        UniformFuzzyHash hash = new UniformFuzzyHash(file, factor);
        String hashString = hash.toString();

        UniformFuzzyHash rebuiltHash = UniformFuzzyHash.rebuildFromString(hashString);
        String rebuiltHashString = rebuiltHash.toString();

        Assert.assertTrue(hash.equals(rebuiltHash));
        Assert.assertTrue(hashString.equals(rebuiltHashString));

    }

    /**
     * Similarity test.
     * Tests all the similarity types between two hashes computed over two test resource files.
     * 
     * @throws IOException In case an exception occurs reading a test resource file.
     */
    @Test
    public void similarityTest()
            throws IOException {

        final int factor = 50001;

// Path: src/main/java/com/github/s3curitybug/similarityuniformfuzzyhash/UniformFuzzyHash.java
// public enum SimilarityTypes {
// 
//     /**
//      * Similarity of a hash to other hashes.
//      */
//     SIMILARITY("Similarity"),
// 
//     /**
//      * Similarity of other hashes to a hash.
//      */
//     REVERSE_SIMILARITY("Reverse"),
// 
//     /**
//      * Maximum similarity between Similarity and Reverse.
//      */
//     MAXIMUM("Maximum"),
// 
//     /**
//      * Minimum similarity between Similarity and Reverse.
//      */
//     MINIMUM("Minimum"),
// 
//     /**
//      * Arithmetic mean between Similarity and Reverse, (Similarity * Reverse) / 2.
//      */
//     ARITHMETIC_MEAN("ArithMean"),
// 
//     /**
//      * Geometric mean between Similarity and Reverse, sqrt(Similarity * Reverse).
//      */
//     GEOMETRIC_MEAN("GeomMean");
// 
//     /**
//      * Similarity type name.
//      */
//     private String name;
// 
//     /**
//      * Constructor.
//      * 
//      * @param name Similarity type name.
//      */
//     SimilarityTypes(
//             String name) {
// 
//         this.name = name;
// 
//     }
// 
//     /**
//      * @return The similarity type name.
//      */
//     public String getName() {
// 
//         return name;
// 
//     }
// 
//     /**
//      * @return A list with all the similarity types names.
//      */
//     public static List<String> names() {
// 
//         SimilarityTypes[] similarityTypes = SimilarityTypes.values();
//         List<String> similarityTypesNames = new ArrayList<>(similarityTypes.length);
// 
//         for (SimilarityTypes similarityType : similarityTypes) {
//             similarityTypesNames.add(similarityType.name);
//         }
// 
//         return similarityTypesNames;
// 
//     }
// 
// }


// Path: src/test/java/com/github/s3curitybug/similarityuniformfuzzyhash/UniformFuzzyHashTest.java
import org.junit.Assert;
import org.junit.Test;
import com.github.s3curitybug.similarityuniformfuzzyhash.UniformFuzzyHash.SimilarityTypes;
import java.io.File;
import java.io.IOException;

package com.github.s3curitybug.similarityuniformfuzzyhash;




/**
 * Class to test the Uniform Fuzzy Hash.
 * 
 * @author s3curitybug@gmail.com
 *
 */
public class UniformFuzzyHashTest {

    /**
     * Algorithm computation test.
     * Tests the algorithm computation over a test resource file and the hash toString method.
     * 
     * @throws IOException In case an exception occurs reading a test resource file.
     */
    @Test
    public void algorithmComputationTest()
            throws IOException {

        final int factor = 11;
        final File file = TestResourcesUtils.getTestResourceFile("RandomText/RandomText1/B.txt");

        UniformFuzzyHash hash = new UniformFuzzyHash(file, factor);
        String hashString = hash.toString();

        System.out.println(hashString);

    }

    /**
     * Hash rebuild test.
     * Tests the hash rebuild from a string representation of a hash computed over a test resource
     * file, and the hash equals method.
     * 
     * @throws IOException In case an exception occurs reading a test resource file.
     */
    @Test
    public void hashRebuildTest()
            throws IOException {

        final int factor = 11;
        final File file = TestResourcesUtils.getTestResourceFile("RandomText/RandomText1/B.txt");

        UniformFuzzyHash hash = new UniformFuzzyHash(file, factor);
        String hashString = hash.toString();

        UniformFuzzyHash rebuiltHash = UniformFuzzyHash.rebuildFromString(hashString);
        String rebuiltHashString = rebuiltHash.toString();

        Assert.assertTrue(hash.equals(rebuiltHash));
        Assert.assertTrue(hashString.equals(rebuiltHashString));

    }

    /**
     * Similarity test.
     * Tests all the similarity types between two hashes computed over two test resource files.
     * 
     * @throws IOException In case an exception occurs reading a test resource file.
     */
    @Test
    public void similarityTest()
            throws IOException {

        final int factor = 50001;

        final File file1 = TestResourcesUtils.getTestResourceFile("InsideDoc/Lenna.png");
