<commit_before>#!/bin/sh

test_description="test the ipget command"

. ./lib/sharness/sharness.sh

test_expect_success "retrieve a cat gif" "
    ipget QmQ2r6iMNpky5f1m4cnm3Yqw8VSvjuKpTcK1X7dBR1LkJF/cat.gif &&
    echo 'c5ea0d6cacf1e54635685803ec4edbe0d4fe8465' > expected &&
    sha1sum cat.gif | cut -d ' ' -f 1 > actual &&
    diff expected actual
"

test_done
<commit_msg>Add test for -o switch.<commit_after>#!/bin/sh

test_description="test the ipget command"

. ./lib/sharness/sharness.sh

test_expect_success "retrieve a known popular single file" "
    ipget QmQ2r6iMNpky5f1m4cnm3Yqw8VSvjuKpTcK1X7dBR1LkJF/cat.gif &&
    echo 'c5ea0d6cacf1e54635685803ec4edbe0d4fe8465' > expected &&
    sha1sum cat.gif | cut -d ' ' -f 1 > actual &&
    diff expected actual
"

test_expect_success "retrieve a known popular file with -o" "
    ipget -o meow.gif QmQ2r6iMNpky5f1m4cnm3Yqw8VSvjuKpTcK1X7dBR1LkJF/cat.gif &&
    echo 'c5ea0d6cacf1e54635685803ec4edbe0d4fe8465' > expected &&
    sha1sum meow.gif | cut -d ' ' -f 1 > actual &&
    diff expected actual
"

# TODO(noffle): recursive retrieval (directory)

# TODO(noffle): start a daemon, add + fetch a unique hash from it

test_done

{'fraction_non_alphanumeric': 0.09721048182586645, 'fraction_numerical': 0.08622147083685545, 'mean_word_length': 4.125541125541125, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '2730447', 'n_tokens_mistral': 553, 'n_tokens_neox': 516, 'n_words': 100}