### ----------------------------------------------------
### -- Arithmetic::PaperAndPencil
### -- Licenses: Artistic-2.0
### -- Authors: Jean Forget
### -- File: xt/08-mult.rakutest
### ----------------------------------------------------
# -*- encoding: utf-8; indent-tabs-mode: nil -*-
#
# Checking the generation of HTML on two examples of multiplication with embedded zeroes.
#
# 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/08-mult.csv' .IO.slurp;
my Str $refhtml = 'xt/data/08-mult.html'.IO.slurp;
my Arithmetic::PaperAndPencil $operation .= new;
my Arithmetic::PaperAndPencil::Number $x .= new(value => '10200300040000', radix => 10);
my Arithmetic::PaperAndPencil::Number $y .= new(value => '2'  , radix => 10);
my Arithmetic::PaperAndPencil::Number $z .= new(value => '101', radix => 10);
my Arithmetic::PaperAndPencil::Number $pdt;

$pdt = $operation.multiplication(multiplicand => $x, multiplier => $x, type => 'std');
is($pdt.value, '104046120906024001600000000', "product is 104046120906024001600000000");
$pdt = $operation.multiplication(multiplicand => $y, multiplier => $z, type => 'std');
is($pdt.value, '202', "product is 202");

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

done-testing;


