<commit_before>#!/usr/bin/perl -w

use Modern::Perl '2012';

use Test::More;
use Log::Any::Adapter 'TAP';

use ProductOpener::SiteQuality qw/:all/;
use ProductOpener::Tags qw/:all/;

# illogically-high-energy-value - does not add tag, if there is no nutriments.
my $product_ref_without_nutriments = {
	lc => "de"
};

ProductOpener::SiteQuality::check_quality($product_ref_without_nutriments);

ok( !has_tag($product_ref_without_nutriments, 'quality', 'illogically-high-energy-value'), 'product does not have illogically-high-energy-value tag as it has no nutrients' );

# illogically-high-energy-value - does not add tag, if there is no energy.
my $product_ref_without_energy_value = {
	lc => "de",
	nutriments => {}
};

ProductOpener::SiteQuality::check_quality($product_ref_without_energy_value);

ok( !has_tag($product_ref_without_energy_value, 'quality', 'illogically-high-energy-value'), 'product does not have illogically-high-energy-value tag as it has no energy_value' );

# illogically-high-energy-value - does not add tag, if energy_value is below 3800
my $product_ref_with_low_energy_value = {
	lc => "de",
	nutriments => {
		energy => 3799
	}
};

ProductOpener::SiteQuality::check_quality($product_ref_with_low_energy_value);

ok( !has_tag($product_ref_with_low_energy_value, 'quality', 'illogically-high-energy-value'), 'product does not have illogically-high-energy-value tag as it has an energy_value below 3800' );

# illogically-high-energy-value - does not add tag, if energy_value is equal 3800
my $product_ref_with_lowish_energy_value = {
	lc => "de",
	nutriments => {
		energy => 3800
	}
};

ProductOpener::SiteQuality::check_quality($product_ref_with_lowish_energy_value);

ok( !has_tag($product_ref_with_lowish_energy_value, 'quality', 'illogically-high-energy-value'), 'product does not have illogically-high-energy-value tag as it has an energy_value of 3800' );

# illogically-high-energy-value - does add tag, if energy_value is above 3800
my $product_ref_with_high_energy_value = {
	lc => "de",
	nutriments => {
		energy => 3801
	}<commit_msg>Address review comments<commit_after>#!/usr/bin/perl -w

use Modern::Perl '2012';

use Test::More;
use Log::Any::Adapter 'TAP';

use ProductOpener::SiteQuality qw/:all/;
use ProductOpener::Tags qw/:all/;

# illogically-high-energy-value - does not add tag, if there is no nutriments.
my $product_ref_without_nutriments = {
	lc => "de"
};

ProductOpener::SiteQuality::check_quality($product_ref_without_nutriments);

ok( !has_tag($product_ref_without_nutriments, 'quality', 'illogically-high-energy-value'), 'product does not have illogically-high-energy-value tag as it has no nutrients' );

# illogically-high-energy-value - does not add tag, if there is no energy.
my $product_ref_without_energy_value = {
	lc => "de",
	nutriments => {}
};

ProductOpener::SiteQuality::check_quality($product_ref_without_energy_value);

ok( !has_tag($product_ref_without_energy_value, 'quality', 'illogically-high-energy-value'), 'product does not have illogically-high-energy-value tag as it has no energy_value' );

# illogically-high-energy-value - does not add tag, if energy_value is below 3800 - 3799
my $product_ref_with_low_energy_value = {
	lc => "de",
	nutriments => {
		energy => 3799
	}
};

ProductOpener::SiteQuality::check_quality($product_ref_with_low_energy_value);

ok( !has_tag($product_ref_with_low_energy_value, 'quality', 'illogically-high-energy-value'), 'product does not have illogically-high-energy-value tag as it has an energy_value below 3800: 3799' );

# illogically-high-energy-value - does not add tag, if energy_value is below 3800 - 40
my $product_ref_with_lower_energy_value = {
	lc => "de",
	nutriments => {
		energy => 40
	}
};

ProductOpener::SiteQuality::check_quality($product_ref_with_lower_energy_value);

ok( !has_tag($product_ref_with_lower_energy_value, 'quality', 'illogically-high-energy-value'), 'product does not have illogically-high-energy-value tag as it has an energy_value below 3800: 40' );

# illogically-high-energy-value - does not add tag, if energy_value is equal 3800
my $product_ref_with_lowish_energy_value = {
	lc => "de",
	nutriments => {
		energy => 3800
	}
};

ProductOpener::SiteQuality::check_quality($product_ref_with_lowish_energy_value);

ok( !has_tag($product_ref_with_lowish_energy_value, 'quality', 'illogically-high-energy-value'), 'product does not have illogically-high-energy-value tag as it has an energy_value of 3800' );

# illogically-high-energy-value - does add tag, if energy_value is above 3800
my $product_ref_with_high_energy_value = {
	lc => "de",
	nutriments => {
		energy => 3801
	}
{'fraction_non_alphanumeric': 0.12313674659753726, 'fraction_numerical': 0.020306761719593863, 'mean_word_length': 5.920777279521674, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 30, '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': '3255522', 'n_tokens_mistral': 1682, 'n_tokens_neox': 1586, 'n_words': 367}