unit uMathLibrarytest;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;

type
  TForm6 = class(TForm)
    btnAPlusB: TButton;
    ebA: TEdit;
    ebB: TEdit;
    ebResult: TEdit;
    btnAddInt: TButton;
    btnAND: TButton;
    btnJimAdd: TButton;
    btnVersion: TButton;
    btnStringWithLength: TButton;
    procedure btnAPlusBClick(Sender: TObject);
    procedure btnAddIntClick(Sender: TObject);
    procedure btnANDClick(Sender: TObject);
    procedure btnJimAddClick(Sender: TObject);
    procedure btnVersionClick(Sender: TObject);
    procedure btnStringWithLengthClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form6: TForm6;

implementation

{$R *.dfm}

uses uMathLibrary;

procedure TForm6.btnAddIntClick(Sender: TObject);
var
  sum: integer;
begin
  sum := AddInt(246, 1296);
  ShowMessage('246 + 1296 must = 1542 ' + IntToStr(sum));
end;

procedure TForm6.btnANDClick(Sender: TObject);
var
  res: boolean;
begin
  res := ANDER(boolean(1), boolean(0));
end;

procedure TForm6.btnAPlusBClick(Sender: TObject);
var
  a, b, Ans: double;
begin
  a := StrToFloat(ebA.Text);
  b := StrToFloat(ebB.Text);
  Ans := Add(a, b);
  ebResult.Text := FloatToStr(Ans);
end;

procedure TForm6.btnJimAddClick(Sender: TObject);
var
  a, b, Ans: double;
begin
  a := StrToFloat(ebA.Text);
  b := StrToFloat(ebB.Text);
  Ans := JimAdd(a, b);
  ebResult.Text := FloatToStr(Ans);

end;

procedure TForm6.btnVersionClick(Sender: TObject);
var
  buf1, buf2: array [0 .. 255] of Ansichar;

begin

  Version(buf1, buf2);
  ShowMessage('buf1 ;' + buf1);

end;

procedure TForm6.btnStringWithLengthClick(Sender: TObject);
var
   buf1: array [0 .. 255] of Ansichar;

  len: integer;
begin
  len := StringWithLength(buf1);

  ShowMessage('buf1: ' + buf1 + ' and Len = ' + IntToStr(len));
end;

end.
