### ----------------------------------------------------
### -- Chemistry::Stoichiometry
### -- Licenses: Artistic-2.0
### -- Authors: Anton Antonov
### -- File: t/04-Molecular-mass.rakutest
### ----------------------------------------------------
use Test;

use lib './lib';
use lib '.';

use Chemistry::Stoichiometry;

my @eqs = [
    "2S + 3O2 → 2SO3",
    "6S + 6NaOH → Na2S2O3 + 3H2O",
    "1*C2H5OH + 3*O2 -> 2*CO2 + 3*H2O",
    "2S + O2 → 2SO2",
];

my @molecules = ['Cl', 'O', '2SO3', 'Na2S2O3'];

plan *;

## 1
is molecular-mass("O2"), 2 * molecular-mass('O');

## 2
is molecular-mass("2SO2"), 2 * (molecular-mass('S') + molecular-mass('O2'));

## 3
# The equation is balanced
my $eq3 = "2S + 2 * O2 → 2SO2";
is molecular-mass($eq3).key, molecular-mass($eq3).value;

## 4
# The equation is not balanced. (And it can be generated by an LLM.)
my $eq4 = "2S + O2 → 2SO2";
is molecular-mass($eq4).key < molecular-mass($eq4).value, True;

done-testing;


