### ----------------------------------------------------
### -- Arithmetic::PaperAndPencil
### -- Licenses: Artistic-2.0
### -- Authors: Jean Forget
### -- File: xt/11-mult-prepared.rakutest
### ----------------------------------------------------
# -*- encoding: utf-8; indent-tabs-mode: nil -*-
#
# Checking the generation of HTML on two examples of prepared multiplications
#
# Copyright 2023, 2024 Jean Forget
#
# This programme is free software; you can redistribute it and modify it under the Artistic License 2.0.

use Test;
use Arithmetic::PaperAndPencil;

plan 4;

my Str $refcsv  = 'xt/data/11-mult-prepared.csv' .IO.slurp;
my Str $refhtml = 'xt/data/11-mult-prepared.html'.IO.slurp;
my Arithmetic::PaperAndPencil $operation .= new;
my Arithmetic::PaperAndPencil::Number $x .= new(value => '141421356');
my Arithmetic::PaperAndPencil::Number $y .= new(value => '42426408712');
my Arithmetic::PaperAndPencil::Number $pdt;

$pdt = $operation.multiplication(multiplicand => $x, multiplier => $x, type => 'prepared');
is($pdt.value, '19999999932878736', "Square of 141421356 is 19999999932878736");

$pdt = $operation.multiplication(multiplicand => $y, multiplier => $y, type => 'prepared');
is($pdt.value, '1800000156197669498944', "Square of 42426408712 is 1800000156197669498944");

is($operation.csv, $refcsv, "Checking CSV file");
my $html = $operation.html(lang => 'fr', silent => False, level => 3);
is($html, $refhtml, "Checking HTML file");

done-testing;


