<commit_before>{-# LANGUAGE OverloadedStrings #-}
module Tests.Dalvik.NameDecoding ( tests ) where

import Data.ByteString ( ByteString )
import Test.Framework as T
import Test.Framework.Providers.HUnit as T
import qualified Test.HUnit as T

import Dalvik.ClassHierarchy
import Dalvik.SSA.Internal.Names
import Dalvik.SSA.Types

tests :: Test
tests = T.testGroup "Java name decoding tests" $ map makeTest
   [ ("V", VoidType)
   , ("Z", BooleanType)
   , ("B", ByteType)
   , ("S", ShortType)
   , ("I", IntType)
   , ("J", LongType)
   , ("F", FloatType)
   , ("D", DoubleType)
   , ("[I", ArrayType IntType)
   , ("[[D", ArrayType (ArrayType DoubleType))
   , ("Ljava/lang/Object;", ReferenceType (qualifiedClassName ["java", "lang"] "Object"))
   ]

makeTest :: (ByteString, Type) -> Test
makeTest (s, oracle) = testCase ("Decode " ++ show s) $<commit_msg>The Show instance for SSA Type moved<commit_after>{-# LANGUAGE OverloadedStrings #-}
module Tests.Dalvik.NameDecoding ( tests ) where

import Data.ByteString ( ByteString )
import Test.Framework as T
import Test.Framework.Providers.HUnit as T
import qualified Test.HUnit as T

import Dalvik.ClassHierarchy
import Dalvik.SSA.Internal.Names
import Dalvik.SSA

tests :: Test
tests = T.testGroup "Java name decoding tests" $ map makeTest
   [ ("V", VoidType)
   , ("Z", BooleanType)
   , ("B", ByteType)
   , ("S", ShortType)
   , ("I", IntType)
   , ("J", LongType)
   , ("F", FloatType)
   , ("D", DoubleType)
   , ("[I", ArrayType IntType)
   , ("[[D", ArrayType (ArrayType DoubleType))
   , ("Ljava/lang/Object;", ReferenceType (qualifiedClassName ["java", "lang"] "Object"))
   ]

makeTest :: (ByteString, Type) -> Test
makeTest (s, oracle) = testCase ("Decode " ++ show s) $
{'fraction_non_alphanumeric': 0.1585014409221902, 'fraction_numerical': 0.0, 'mean_word_length': 4.197604790419161, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1995960', 'n_tokens_mistral': 588, 'n_tokens_neox': 576, 'n_words': 164}