<commit_before>module Foreign.Marshal.Alloc.CompatSpec (main, spec) where

import           Test.Hspec

import           Foreign.Marshal.Alloc.Compat
import           Foreign.Marshal.Utils
import           Foreign.Ptr
import           Foreign.Storable.Compat

main :: IO ()
main = hspec spec

spec :: Spec
spec = do
  describe "calloc" $
    it "allocates memory with bytes of value zero" $ do
        intPtr1 <- calloc :: IO (Ptr Int)
        intPtr2 <- new 0
        val1 <- peek intPtr1
        val2 <- peek intPtr2
        val1 `shouldBe` val2
        free intPtr1
        free intPtr2<commit_msg>Simplify test for Foreign.Alloc.Compat.calloc<commit_after>module Foreign.Marshal.Alloc.CompatSpec (main, spec) where

import           Test.Hspec

import           Control.Exception.Compat
import           Foreign.Marshal.Alloc.Compat
import           Foreign.Marshal.Utils
import           Foreign.Ptr
import           Foreign.Storable.Compat

main :: IO ()
main = hspec spec

spec :: Spec
spec = do
  describe "calloc" $
    it "allocates memory with bytes of value zero" $ do
      bracket calloc free $ \ptr -> do
        peek ptr `shouldReturn` (0 :: Int)
{'fraction_non_alphanumeric': 0.08003442340791739, 'fraction_numerical': 0.010327022375215147, 'mean_word_length': 2.212707182320442, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 4, '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': '1070725', 'n_tokens_mistral': 334, 'n_tokens_neox': 323, 'n_words': 105}