<commit_before>#!/bin/sh
#
# Copyright (c) 2014 <NAME>
# MIT Licensed; see the LICENSE file in this repository.
#

test_description="Test ipfs repo pinning"

. lib/test-lib.sh



function test_pin_flag() {
	object=$1
	ptype=$2
	expect=$3

	echo "test_pin_flag" $@

	ipfs-pin-stat "$object" | grep "$ptype"
	actual=$?

	if [ "$expect" = "true" ]; then
		if [ "$actual" != "0" ]; then
			echo "$object should be pinned $ptype ($actual)"
			return 1
		fi
	else
		if [ "$actual" != "1" ]; then
			echo "$object should NOT be pinned $ptype ($actual)"
			return 1
		fi
	fi
	return 0
}

function test_pin() {
	object=$1
	shift

	test_str_contains "recursive" $@
	[ "$?" = "0" ] && r="true" || r="false"

	test_str_contains "indirect" $@
	[ "$?" = "0" ] && i="true" || i="false"

	test_str_contains "direct" $@
	[ "$?" = "0" ] && d="true" || d="false"

	test_pin_flag "$object" "recursive" $r || return 1
	test_pin_flag "$object" "indirect"  $i || return 1
	test_pin_flag "$object" "direct"    $d || return 1
	return 0
}


test_init_ipfs

# test runs much faster without daemon.
# TODO: turn this back on after:
# https://github.com/ipfs/go-ipfs/issues/1075
# test_launch_ipfs_daemon

HASH_FILE6="QmRsBC3Y2G6VRPYGAVpZczx1W7Xw54MtM1NcLKTkn6rx3U"<commit_msg>functions dont need to be called functions<commit_after>#!/bin/sh
#
# Copyright (c) 2014 <NAME>
# MIT Licensed; see the LICENSE file in this repository.
#

test_description="Test ipfs repo pinning"

. lib/test-lib.sh



test_pin_flag() {
	object=$1
	ptype=$2
	expect=$3

	echo "test_pin_flag" $@

	ipfs-pin-stat "$object" | grep "$ptype"
	actual=$?

	if [ "$expect" = "true" ]; then
		if [ "$actual" != "0" ]; then
			echo "$object should be pinned $ptype ($actual)"
			return 1
		fi
	else
		if [ "$actual" != "1" ]; then
			echo "$object should NOT be pinned $ptype ($actual)"
			return 1
		fi
	fi
	return 0
}

test_pin() {
	object=$1
	shift

	test_str_contains "recursive" $@
	[ "$?" = "0" ] && r="true" || r="false"

	test_str_contains "indirect" $@
	[ "$?" = "0" ] && i="true" || i="false"

	test_str_contains "direct" $@
	[ "$?" = "0" ] && d="true" || d="false"

	test_pin_flag "$object" "recursive" $r || return 1
	test_pin_flag "$object" "indirect"  $i || return 1
	test_pin_flag "$object" "direct"    $d || return 1
	return 0
}


test_init_ipfs

# test runs much faster without daemon.
# TODO: turn this back on after:
# https://github.com/ipfs/go-ipfs/issues/1075
# test_launch_ipfs_daemon

HASH_FILE6="QmRsBC3Y2G6VRPYGAVpZczx1W7Xw54MtM1NcLKTkn6rx3U"
{'fraction_non_alphanumeric': 0.1683286796968488, 'fraction_numerical': 0.02792181890706023, 'mean_word_length': 3.9467455621301775, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '348255', 'n_tokens_mistral': 1095, 'n_tokens_neox': 996, 'n_words': 249}