Changeset 229


Ignore:
Timestamp:
Jun 24, 2023, 11:23:26 PM (10 months ago)
Author:
chronos
Message:
  • Added: Several basic interpretter tests.
Location:
branches/xpascal
Files:
1 deleted
15 edited

Legend:

Unmodified
Added
Removed
  • branches/xpascal/Executor.pas

    r224 r229  
    632632    if TValueBoolean(Value).Value then ExecuteCommand(Block, IfThenElse.CommandThen)
    633633      else begin
    634         if not (IfThenElse.CommandElse is TCommand) then
     634        if Assigned(IfThenElse.CommandElse) then
    635635          ExecuteCommand(Block, IfThenElse.CommandElse);
    636636      end;
  • branches/xpascal/Forms/FormMain.lfm

    r228 r229  
    123123      Caption = 'Test'
    124124      OnExecute = ATestExecute
     125      ShortCut = 122
    125126    end
    126127  end
  • branches/xpascal/Forms/FormMain.pas

    r228 r229  
    7575uses
    7676  Parser, Executor, GeneratorPascal, GeneratorPhp, FormTests, Translator,
    77   GeneratorCSharp, GeneratorXml, ParserPascal;
     77  GeneratorCSharp, GeneratorXml, ParserPascal, Tests;
    7878
    7979{ TFormMain }
     
    198198  with TFormTests.Create(nil) do
    199199  try
     200    TestCases := GetTests;
    200201    ShowModal;
    201202  finally
     203    TestCases.Free;
    202204    Free;
    203205  end;
  • branches/xpascal/Packages/Common/Common.lpk

    r228 r229  
    4343    <License Value="Copy left."/>
    4444    <Version Minor="11"/>
    45     <Files Count="37">
     45    <Files Count="36">
    4646      <Item1>
    4747        <Filename Value="StopWatch.pas"/>
     
    160160      </Item26>
    161161      <Item27>
    162         <Filename Value="AboutDialog.pas"/>
    163         <HasRegisterProc Value="True"/>
    164         <UnitName Value="AboutDialog"/>
     162        <Filename Value="PixelPointer.pas"/>
     163        <UnitName Value="PixelPointer"/>
    165164      </Item27>
    166165      <Item28>
    167         <Filename Value="PixelPointer.pas"/>
    168         <UnitName Value="PixelPointer"/>
     166        <Filename Value="DataFile.pas"/>
     167        <UnitName Value="DataFile"/>
    169168      </Item28>
    170169      <Item29>
    171         <Filename Value="DataFile.pas"/>
    172         <UnitName Value="DataFile"/>
     170        <Filename Value="TestCase.pas"/>
     171        <UnitName Value="TestCase"/>
    173172      </Item29>
    174173      <Item30>
    175         <Filename Value="TestCase.pas"/>
    176         <UnitName Value="TestCase"/>
     174        <Filename Value="Generics.pas"/>
     175        <UnitName Value="Generics"/>
    177176      </Item30>
    178177      <Item31>
    179         <Filename Value="Generics.pas"/>
    180         <UnitName Value="Generics"/>
    181       </Item31>
    182       <Item32>
    183178        <Filename Value="CommonPackage.pas"/>
    184179        <Type Value="Main Unit"/>
    185180        <UnitName Value="CommonPackage"/>
     181      </Item31>
     182      <Item32>
     183        <Filename Value="Table.pas"/>
     184        <UnitName Value="Table"/>
    186185      </Item32>
    187186      <Item33>
    188         <Filename Value="Table.pas"/>
    189         <UnitName Value="Table"/>
     187        <Filename Value="FormEx.pas"/>
     188        <HasRegisterProc Value="True"/>
     189        <UnitName Value="FormEx"/>
    190190      </Item33>
    191191      <Item34>
    192         <Filename Value="FormEx.pas"/>
    193         <HasRegisterProc Value="True"/>
    194         <UnitName Value="FormEx"/>
     192        <Filename Value="Forms\FormTests.pas"/>
     193        <UnitName Value="FormTests"/>
    195194      </Item34>
    196195      <Item35>
    197         <Filename Value="Forms\FormTests.pas"/>
    198         <UnitName Value="FormTests"/>
     196        <Filename Value="Forms\FormTest.pas"/>
     197        <UnitName Value="FormTest"/>
    199198      </Item35>
    200199      <Item36>
    201         <Filename Value="Forms\FormTest.pas"/>
    202         <UnitName Value="FormTest"/>
    203       </Item36>
    204       <Item37>
    205200        <Filename Value="Forms\FormAbout.pas"/>
    206201        <UnitName Value="FormAbout"/>
    207       </Item37>
     202      </Item36>
    208203    </Files>
    209204    <CompatibilityMode Value="True"/>
  • branches/xpascal/Packages/Common/CommonPackage.pas

    r228 r229  
    1313  XML, ApplicationInfo, SyncCounter, ListViewSort, PersistentForm, FindFile,
    1414  ScaleDPI, Theme, StringTable, MetaCanvas, Geometric, Translator, Languages,
    15   AboutDialog, PixelPointer, DataFile, TestCase, Generics, Table, FormEx,
    16   FormTests, FormTest, FormAbout, LazarusPackageIntf;
     15  PixelPointer, DataFile, TestCase, Generics, Table, FormEx, FormTests,
     16  FormTest, FormAbout, LazarusPackageIntf;
    1717
    1818implementation
     
    3131  RegisterUnit('Theme', @Theme.Register);
    3232  RegisterUnit('Translator', @Translator.Register);
    33   RegisterUnit('AboutDialog', @AboutDialog.Register);
    3433  RegisterUnit('FormEx', @FormEx.Register);
    3534end;
  • branches/xpascal/Packages/Common/Forms/FormAbout.lfm

    r228 r229  
    11object FormAbout: TFormAbout
    2   Left = 1014
    3   Height = 349
    4   Top = 577
    5   Width = 609
     2  Left = 624
     3  Height = 402
     4  Top = 622
     5  Width = 702
    66  Caption = 'About'
    7   ClientHeight = 349
    8   ClientWidth = 609
    9   DesignTimePPI = 125
     7  ClientHeight = 402
     8  ClientWidth = 702
     9  DesignTimePPI = 144
    1010  OnShow = FormShow
    1111  Position = poScreenCenter
    12   LCLVersion = '2.2.4.0'
     12  LCLVersion = '2.2.6.0'
    1313  object LabelDescription: TLabel
    14     Left = 26
    15     Height = 22
    16     Top = 117
    17     Width = 557
     14    Left = 30
     15    Height = 26
     16    Top = 135
     17    Width = 642
    1818    Align = alTop
    19     BorderSpacing.Left = 26
    20     BorderSpacing.Right = 26
    21     BorderSpacing.Bottom = 26
     19    BorderSpacing.Left = 30
     20    BorderSpacing.Right = 30
     21    BorderSpacing.Bottom = 30
    2222    Caption = 'Description'
    2323    ParentColor = False
     
    2626  end
    2727  object LabelContent: TLabel
    28     Left = 26
    29     Height = 22
    30     Top = 165
    31     Width = 557
     28    Left = 30
     29    Height = 26
     30    Top = 191
     31    Width = 642
    3232    Align = alTop
    33     BorderSpacing.Around = 26
     33    BorderSpacing.Around = 30
    3434    Caption = '   '
    3535    ParentColor = False
     
    3838  object PanelTop: TPanel
    3939    Left = 0
    40     Height = 117
     40    Height = 135
    4141    Top = 0
    42     Width = 609
     42    Width = 702
    4343    Align = alTop
    4444    BevelOuter = bvNone
    45     ClientHeight = 117
    46     ClientWidth = 609
     45    ClientHeight = 135
     46    ClientWidth = 702
    4747    FullRepaint = False
    4848    ParentFont = False
    4949    TabOrder = 0
    5050    object LabelAppName: TLabel
    51       Left = 94
    52       Height = 73
    53       Top = 17
    54       Width = 489
     51      Left = 108
     52      Height = 84
     53      Top = 20
     54      Width = 564
    5555      Anchors = [akTop, akLeft, akRight]
    5656      AutoSize = False
    57       BorderSpacing.Around = 26
     57      BorderSpacing.Around = 30
    5858      Caption = 'Title'
    59       Font.Height = -52
     59      Font.Height = -60
    6060      ParentColor = False
    6161      ParentFont = False
     
    6363    end
    6464    object ImageLogo: TImage
    65       Left = 21
    66       Height = 64
    67       Top = 26
    68       Width = 62
     65      Left = 24
     66      Height = 74
     67      Top = 30
     68      Width = 71
    6969      Proportional = True
    7070      Stretch = True
     
    7373  object PanelButtons: TPanel
    7474    Left = 0
    75     Height = 65
    76     Top = 284
    77     Width = 609
     75    Height = 75
     76    Top = 327
     77    Width = 702
    7878    Align = alBottom
    7979    BevelOuter = bvNone
    80     ClientHeight = 65
    81     ClientWidth = 609
     80    ClientHeight = 75
     81    ClientWidth = 702
    8282    TabOrder = 1
    8383    object ButtonHomePage: TButton
    84       Left = 21
    85       Height = 33
    86       Top = 21
    87       Width = 229
     84      Left = 24
     85      Height = 38
     86      Top = 24
     87      Width = 264
    8888      Anchors = [akLeft, akBottom]
    8989      Caption = 'Home page'
     
    9393    end
    9494    object ButtonClose: TButton
    95       Left = 461
    96       Height = 33
    97       Top = 21
    98       Width = 122
     95      Left = 531
     96      Height = 38
     97      Top = 24
     98      Width = 141
    9999      Anchors = [akRight, akBottom]
    100100      Caption = 'Close'
  • branches/xpascal/Packages/Common/Forms/FormAbout.pas

    r228 r229  
    55uses
    66  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Menus,
    7   StdCtrls, ExtCtrls, ApplicationInfo, Common, Translator, Theme;
     7  StdCtrls, ExtCtrls, ApplicationInfo, Common, Translator, Theme, FormEx;
    88
    99type
    1010  { TFormAbout }
    1111
    12   TFormAbout = class(TForm)
     12  TFormAbout = class(TFormEx)
    1313    ButtonClose: TButton;
    1414    ButtonHomePage: TButton;
     
    2121    procedure ButtonHomePageClick(Sender: TObject);
    2222    procedure FormShow(Sender: TObject);
     23  private
     24    FApplicationInfo: TApplicationInfo;
    2325  public
    24     AboutDialog: TObject; //TAboutDialog
    2526    procedure UpdateInterface;
     27    property ApplicationInfo: TApplicationInfo read FApplicationInfo write
     28      FApplicationInfo;
    2629  end;
    2730
     
    3033
    3134{$R *.lfm}
    32 
    33 uses
    34   AboutDialog;
    3535
    3636resourcestring
     
    4343procedure TFormAbout.FormShow(Sender: TObject);
    4444begin
    45   if Assigned(AboutDialog) then
    46   with TAboutDialog(AboutDialog) do begin
    47     if Assigned(Translator) then
    48       Translator.TranslateComponentRecursive(Self);
    49     if Assigned(ThemeManager) then
    50       ThemeManager.UseTheme(Self);
    51 
    52     if Assigned(ApplicationInfo) then
    53     with ApplicationInfo do begin
    54       LabelAppName.Caption := AppName;
    55       LabelContent.Caption := SVersion + ': ' + Version + LineEnding +
    56         SReleaseDate + ': ' + DateToStr(ReleaseDate) + LineEnding +
    57         SLicense + ': ' + License;
    58       LabelDescription.Caption := Description;
    59       ImageLogo.Picture.Bitmap.Assign(Icon);
    60     end;
     45  if Assigned(ApplicationInfo) then
     46  with ApplicationInfo do begin
     47    LabelAppName.Caption := AppName;
     48    LabelContent.Caption := SVersion + ': ' + Version + LineEnding +
     49      SReleaseDate + ': ' + DateToStr(ReleaseDate) + LineEnding +
     50      SLicense + ': ' + License;
     51    LabelDescription.Caption := Description;
     52    ImageLogo.Picture.Bitmap.Assign(Icon);
    6153  end;
    6254  UpdateInterface;
     
    6557procedure TFormAbout.UpdateInterface;
    6658begin
    67   ButtonHomePage.Enabled := Assigned(AboutDialog) and
    68     Assigned(TAboutDialog(AboutDialog).ApplicationInfo);
     59  ButtonHomePage.Enabled := Assigned(ApplicationInfo);
    6960end;
    7061
    7162procedure TFormAbout.ButtonHomePageClick(Sender: TObject);
    7263begin
    73   OpenWebPage(TAboutDialog(AboutDialog).ApplicationInfo.HomePage);
     64  OpenWebPage(ApplicationInfo.HomePage);
    7465end;
    7566
  • branches/xpascal/Packages/Common/Forms/FormTest.lfm

    r228 r229  
    1 object FormTestCase: TFormTestCase
     1object FormTest: TFormTest
    22  Left = 579
    33  Height = 521
    44  Top = 468
    55  Width = 865
    6   Caption = 'Test case'
     6  Caption = 'Test'
    77  ClientHeight = 521
    88  ClientWidth = 865
    99  DesignTimePPI = 144
    10   OnClose = FormClose
    11   OnCreate = FormCreate
    12   OnShow = FormShow
    1310  LCLVersion = '2.2.6.0'
    1411  object MemoLog: TMemo
  • branches/xpascal/Packages/Common/Forms/FormTest.lrj

    r228 r229  
    11{"version":1,"strings":[
    2 {"hash":174506581,"name":"tformtestcase.caption","sourcebytes":[84,101,115,116,32,99,97,115,101],"value":"Test case"}
     2{"hash":371876,"name":"tformtest.caption","sourcebytes":[84,101,115,116],"value":"Test"}
    33]}
  • branches/xpascal/Packages/Common/Forms/FormTest.pas

    r228 r229  
    88type
    99
    10   { TFormTestCase }
     10  { TFormTest }
    1111
    12   TFormTestCase = class(TFormEx)
     12  TFormTest = class(TFormEx)
    1313    MemoLog: TMemo;
    1414  end;
  • branches/xpascal/Packages/Common/Forms/FormTests.lfm

    r228 r229  
    44  Top = 338
    55  Width = 1072
    6   Caption = 'Test'
     6  Caption = 'Tests'
    77  ClientHeight = 632
    88  ClientWidth = 1072
  • branches/xpascal/Packages/Common/Forms/FormTests.lrj

    r228 r229  
    11{"version":1,"strings":[
    2 {"hash":371876,"name":"tformtest.caption","sourcebytes":[84,101,115,116],"value":"Test"},
    3 {"hash":346165,"name":"tformtest.listviewtestcases.columns[0].caption","sourcebytes":[78,97,109,101],"value":"Name"},
    4 {"hash":93105204,"name":"tformtest.listviewtestcases.columns[1].caption","sourcebytes":[82,101,115,117,108,116],"value":"Result"},
    5 {"hash":22974,"name":"tformtest.buttonrun.caption","sourcebytes":[82,117,110],"value":"Run"},
    6 {"hash":8736,"name":"tformtest.labelresult.caption","sourcebytes":[32,32,32],"value":"   "},
    7 {"hash":368487,"name":"tformtest.ashow.caption","sourcebytes":[83,104,111,119],"value":"Show"},
    8 {"hash":22974,"name":"tformtest.arun.caption","sourcebytes":[82,117,110],"value":"Run"}
     2{"hash":5950131,"name":"tformtests.caption","sourcebytes":[84,101,115,116,115],"value":"Tests"},
     3{"hash":346165,"name":"tformtests.listviewtestcases.columns[0].caption","sourcebytes":[78,97,109,101],"value":"Name"},
     4{"hash":93105204,"name":"tformtests.listviewtestcases.columns[1].caption","sourcebytes":[82,101,115,117,108,116],"value":"Result"},
     5{"hash":22974,"name":"tformtests.buttonrun.caption","sourcebytes":[82,117,110],"value":"Run"},
     6{"hash":8736,"name":"tformtests.labelresult.caption","sourcebytes":[32,32,32],"value":"   "},
     7{"hash":368487,"name":"tformtests.ashow.caption","sourcebytes":[83,104,111,119],"value":"Show"},
     8{"hash":22974,"name":"tformtests.arun.caption","sourcebytes":[82,117,110],"value":"Run"}
    99]}
  • branches/xpascal/Packages/Common/Forms/FormTests.pas

    r228 r229  
    8989  ARun.Enabled := Selected;
    9090  AShow.Enabled := Selected;
     91  ButtonRun.Enabled := Assigned(TestCases);
    9192
    9293  Passed := 0;
     
    116117begin
    117118  if Assigned(ListViewTestCases.Selected) then
    118   with TFormTestCase.Create(nil) do
     119  with TFormTest.Create(nil) do
    119120  try
    120121    MemoLog.Text := TTestCase(ListViewTestCases.Selected.Data).Log;
  • branches/xpascal/xpascal.lpi

    r228 r229  
    8585      </Item3>
    8686    </RequiredPackages>
    87     <Units Count="17">
     87    <Units Count="18">
    8888      <Unit0>
    8989        <Filename Value="xpascal.lpr"/>
     
    166166        <IsPartOfProject Value="True"/>
    167167      </Unit16>
     168      <Unit17>
     169        <Filename Value="Tests.pas"/>
     170        <IsPartOfProject Value="True"/>
     171      </Unit17>
    168172    </Units>
    169173  </ProjectOptions>
  • branches/xpascal/xpascal.lpr

    r228 r229  
    1010  Forms, Parser, Tokenizer, Source, Executor, Interpreter, Generator,
    1111  FormMessages, FormSource, Optimizer, FormOutput, FormMain,
    12   ParserPascal;
     12  ParserPascal, Tests;
    1313
    1414{$R *.res}
Note: See TracChangeset for help on using the changeset viewer.