home *** CD-ROM | disk | FTP | other *** search
Text File | 1988-05-03 | 114.0 KB | 3,037 lines |
- ::::::::::
- style_tst.dis
- ::::::::::
- -- This is the distribution list for the Style Checker testing files
- test1.ada
- test1.flw
- test1.sty
- test1a.ada
- test1a.flw
- test1a.sty
- test1b.ada
- test1b.flw
- test1b.sty
- test2.ada
- test2.flw
- test2.sty
- test3a.ada
- test3a.flw
- test3a.sty
- test4.ada
- test4.flw
- test4.sty
- test5.ada
- test5.flw
- test5.sty
- test6.ada
- test6.flw
- test6.sty
- test7.ada
- test7.flw
- test7.sty
- -- The acceptance testing procedures document is on the VAX at location:
- -- user1:[jmellby.nosc.style.doc]test_procedures.mem
- testplan.doc
- ::::::::::
- test1.ada
- ::::::::::
- --
- -- T E S T 1
- --
- -- This module is used to test the Coding Standards Checker for ADA - The
- -- tests that are to be applied to the module are Test A1 indices 1 thru 7
- -- and 14. Various additions have been added to a module originally named
- -- Menu.ada authored by Jerry Baskette. Changes were made January 30, 1985
- -- by James Rea.
- --
- -- Additions and changes have been commented throughout the module. These
- -- comments relate the tests to the code.
-
- with CURRENT_EXCEPTION;
- separate (HELP_UTILITY)
-
- -------------------------------------------------------------------------
- -- The reserved word 'procedure' is in upper case
- -- This should be flagged as improper case - Test A1 index 1
- -------------------------------------------------------------------------
-
- PROCEDURE PRINT_TOPIC_MENU (NODE: in HELP_LINK) is
-
- LINE_COUNT: TEXT_RANGE := 0; -- number of lines to be output
- TOTAL_NUMBER_OF_TOPICS: NATURAL := 0;
-
- -- The name NUM_TOPICS_IN_COLUMN_ONE in the wrong case
-
- -------------------------------------------------------------------------
- -- This should be flagged as improper case - Test A1 index 2
- -------------------------------------------------------------------------
-
- num_TOPICS_IN_COLUMN_ONE: POSITIVE := 1;
- TOPICS_IN_COLUMN_TWO: BOOLEAN := FALSE;
- OUTPUT_LINE: HELP_INFO_TEXT_LINE;
- OUTPUT_BUFFER: SAVED_TEXT; -- buffer of OUTPUT_LINES to be output
- RIGHT_COLUMN_START: INTEGER := (MAX_LINE_LENGTH/2) + 2;
-
- -------------------------------------------------------------------------
- -- The name EVEN should flag the short word (length 4)
- -------------------------------------------------------------------------
-
- EVEN: BOOLEAN := FALSE;
-
- -------------------------------------------------------------------------
- -- The name 'EVENS' should not flag the short name defn. Test A1 index 6
- -------------------------------------------------------------------------
-
- EVENS: POSITIVE := 1;
-
- -------------------------------------------------------------------------
- --The names 'I,J,K' should not be flagged. Test A1 index 7
- -------------------------------------------------------------------------
-
- I: POSITIVE;
- J: POSITIVE;
- K: POSITIVE;
- TESTFLAG: BOOLEAN;
- TEST_FLAG: BOOLEAN;
-
- ------------------------------------------------------------------------
- --The name 'TSTFLG' should be flagged as an abbreviation
- --Test A1 index 14
- ------------------------------------------------------------------------
-
- TSTFLG: BOOLEAN;
- TEST_FLAG: BOOLEAN;
- TESTFLAGS: BOOLEAN; --should be flagged for indentation
- TEST_FLAGS: BOOLEAN; --should be flagged for indentation
- CURRENT_NODE: HELP_LINK := null;--flag for indentation
- COL_ONE_NODE: HELP_LINK := null;--flag for indentation
- COL_TWO_NODE: HELP_LINK := null;--flag for indentation
-
- begin
-
- --------------------------------------------------------------
- --Indentation should be checked per Test A2
- --------------------------------------------------------------
-
- CURRENT_NODE := NODE.SUBTOPICS;
- -- count the number of subtopics for this node
-
- while CURRENT_NODE /= null loop
- TOTAL_NUMBER_OF_TOPICS := TOTAL_NUMBER_OF_TOPICS + 1;
- CURRENT_NODE:= CURRENT_NODE.NEXT_TOPIC;
- end loop;
-
- -- If there is more than one topic, then split the topics into two columns
- -- Column one will have the first half and column two the second half.
- -- If there are an odd number of topics, column one will have the odd number
-
- ---------------------------------------------------------------
- --The following 'if statements should be flagged as two statements
- --on one line. Test A2 index 1
- ---------------------------------------------------------------
-
- if TOTAL_NUMBER_OF_TOPICS /= 0 then if TOTAL_NUMBER_OF_TOPICS >= 2 then
- TOPICS_IN_COLUMN_TWO := TRUE;
- NUM_TOPICS_IN_COLUMN_ONE := TOTAL_NUMBER_OF_TOPICS / 2;
-
- -- More than one topic, split the number
- --See if odd number. If so, increment the topic count so odd goes in 1st col.
-
- if TOTAL_NUMBER_OF_TOPICS /= (TOTAL_NUMBER_OF_TOPICS/2) * 2 then
- NUM_TOPICS_IN_COLUMN_ONE := NUM_TOPICS_IN_COLUMN_ONE + 1;
-
- else
-
- -------------------------------------------------------------------
- --A second test of multiple statements on one line.
- -------------------------------------------------------------------
-
- EVEN := TRUE; end if; end if; --three statements on this line!
-
- -- set the beginning node for each column
-
- COL_ONE_NODE := NODE.SUBTOPICS;
- CURRENT_NODE := NODE.SUBTOPICS;
-
- ------------------------------------------------------------------
- --The following 'for' statement should flag improper indentation
- --Test A2 index 3
- ------------------------------------------------------------------
-
- for I in 1..NUM_TOPICS_IN_COLUMN_ONE loop
- COL_TWO_NODE := CURRENT_NODE.NEXT_TOPIC;
- CURRENT_NODE := CURRENT_NODE.NEXT_TOPIC;
- end loop;
- ----------------------------------------------------------------
- --The following 'while' and 'if' statements should be flagged for
- --improper indentation. Test A2 index 3
- --Lack of blank line following the above 'for' loop should be flagged.
- --This lack of blank line preceeding the 'if' below should also
- --should also be flagged. Text A2 indices 8 & 9 respectively.
- ----------------------------------------------------------------
- if TOPICS_IN_COLUMN_TWO then
- while COL_TWO_NODE /= null loop
- OUTPUT_LINE := BLANK_LINE; -- blank the line buffer
-
- -- Put first topic in left half of output line
-
- OUTPUT_LINE(1..COL_ONE_NODE.NAME_LENGTH) :=
- COL_ONE_NODE.NAME(1..COL_ONE_NODE.NAME_LENGTH);
-
- -- Put second topic in second half of output line
-
- OUTPUT_LINE(RIGHT_COLUMN_START..RIGHT_COLUMN_START +
- COL_TWO_NODE.NAME_LENGTH - 1 ) :=
- COL_TWO_NODE.NAME(1..COL_TWO_NODE.NAME_LENGTH);
-
- -- Put the line in the output buffer. LINE_COUNT is incremented automatically
-
-
- ----------------------------------------------------------------------
- --This is a block of comments to check the proper indentation of
- --the block of comments. This is done in accordance with Test A2
- --index 6. This should be flagged.
- --------------------------------------------------------------------
-
- HELP_INFO_SUPPORT.APPEND_TO_DISPLAY(OUTPUT_LINE,OUTPUT_BUFFER,LINE_COUNT);
- COL_ONE_NODE := COL_ONE_NODE.NEXT_TOPIC;
- COL_TWO_NODE := COL_TWO_NODE.NEXT_TOPIC;
- end loop;
- end if;
-
- if not EVEN then
-
- -- Put the odd topic in the output buffer
-
- OUTPUT_LINE := BLANK_LINE;
- OUTPUT_LINE(1..COL_ONE_NODE.NAME_LENGTH) :=
- COL_ONE_NODE.NAME(1..COL_ONE_NODE.NAME_LENGTH);
- HELP_INFO_SUPPORT.APPEND_TO_DISPLAY(OUTPUT_LINE,OUTPUT_BUFFER,LINE_COUNT);
- end if;
-
-
- -- Now print the output buffer
-
- HELP_INFO_SUPPORT.PRINT_TEXT(OUTPUT_BUFFER,LINE_COUNT);
- end if;
- ---------------------------------------------------------------------
- --Lack of blank lines separating the major block (exception) should
- --be flagged. Test A2 index 7.
- ---------------------------------------------------------------------
- exception
- when others => text_io.put_line("Print Menu " & CURRENT_EXCEPTION.NAME);
- raise;
- end PRINT_TOPIC_MENU;
- ::::::::::
- test1.flw
- ::::::::::
- with CURRENT_EXCEPTION;
- This package is on the list of packages to be warned against.
-
- PROCEDURE PRINT_TOPIC_MENU (NODE: in HELP_LINK) is
- Reserve word PROCEDURE should be in lower case
-
- num_TOPICS_IN_COLUMN_ONE: POSITIVE := 1;
- Object name num_TOPICS_IN_COLUMN_ONE should be in upper case
-
- TESTFLAGS: BOOLEAN; --should be flagged for indentation
- This line should be indented to column: 5
-
- TEST_FLAGS: BOOLEAN; --should be flagged for indentation
- This line should be indented to column: 5
-
- if TOTAL_NUMBER_OF_TOPICS /= 0 then if TOTAL_NUMBER_OF_TOPICS >= 2 then
- There are more than one statements on this line!
-
- EVEN := TRUE; end if; end if; --three statements on this line!
- There are more than one statements on this line!
-
- if TOTAL_NUMBER_OF_TOPICS /= 0 then if TOTAL_NUMBER_OF_TOPICS >= 2 then
- This structure should have following blank lines to set it off.
-
- COL_ONE_NODE := NODE.SUBTOPICS;
- This line should be indented to column: 2
-
- CURRENT_NODE := NODE.SUBTOPICS;
- This line should be indented to column: 2
-
- for I in 1..NUM_TOPICS_IN_COLUMN_ONE loop
- This line should be indented to column: 2
-
- if TOPICS_IN_COLUMN_TWO then
- This line should be indented to column: 2
-
- OUTPUT_LINE := BLANK_LINE; -- blank the line buffer
- Beginning of this block not indented properly. Line ignored for Indentation!
-
- OUTPUT_LINE(1..COL_ONE_NODE.NAME_LENGTH) :=
- Beginning of this block not indented properly. Line ignored for Indentation!
-
- COL_TWO_NODE.NAME_LENGTH - 1 ) :=
- The statement-continuation in this line should be indented!
-
- while COL_TWO_NODE /= null loop
- This structure should have preceeding blank lines to set it off.
-
- while COL_TWO_NODE /= null loop
- This structure should have following blank lines to set it off.
-
- while COL_TWO_NODE /= null loop
- This structure is large enough that it should have a loop-name!
-
- if TOPICS_IN_COLUMN_TWO then
- This structure should have following blank lines to set it off.
-
- if not EVEN then
- This line should be indented to column: 2
-
- if TOTAL_NUMBER_OF_TOPICS /= 0 then if TOTAL_NUMBER_OF_TOPICS >= 2 then
- This structure should have following blank lines to set it off.
-
- when others => text_io.put_line("Print Menu " & CURRENT_EXCEPTION.NAME);
- Object name text_io should be in upper case
-
- when others => text_io.put_line("Print Menu " & CURRENT_EXCEPTION.NAME);
- Object name put_line should be in upper case
-
- --
- Finish checking started in above statement. Total statements: 66
- ::::::::::
- test1.sty
- ::::::::::
- STYLE Report
- :USER1:POWERS:NOSC:TEST1.ADA
-
- Naming Conventions
- --------------------------------------------------------------------------
- * Invalid Case for an Object Identifier 3 Errors
- * Invalid Case for a Keyword 1 Error
- Name Segment Size (Separated Desired <5 Characters
- by Underscores) Actual 4.8 Characters
- Average Name Size Desired >5 Characters
- Actual 10.2 Characters
- --------------------------------------------------------------------------
-
- Physical Layout
- --------------------------------------------------------------------------
- * Occurrences of More Than One Statement/Line 2 Errors
- * Inconsistant Indentation 13 Errors
- * Missing Blank Lines to Set Off a Block 4 Errors
- * Loops Without Names 1
- --------------------------------------------------------------------------
-
- Information Hiding, Abstraction, Data Use
- --------------------------------------------------------------------------
- Percent of Literals In Body Desired < 30.0%
- * Actual 71.4%
- Percent of Universal Types Desired < 40.0%
- Actual 33.3%
- ! Data Structuring Types NOT Used
- Array Types
- Enumeration Types
- Record Types
- ! No Attributes are Used
- ! Ada-Specific Features NOT used
- AND THEN
- OR ELSE
- EXITS
- XOR
- ELSIF
- OUT parameters
- IN OUT parameters
- PRIVATEs
- --------------------------------------------------------------------------
-
- Modularity
- --------------------------------------------------------------------------
- Average Number of Parameters Range 0..4 Parameters
- Instances of parameters below minimum 0
- Instances of parameters above maximum 0
- Average Subprogram Size Range 10..200 Statements
- Instances of size below minimum 0
- Instances of size above maximum 0
- Loops with too many exit statements 0 Instances
- Control Structure Nesting Maximum 8
- Exceeded 0 Instances
- Package Nesting Maximum 2
- Exceeded 0 Instances
- Subprogram Nesting Maximum 4
- Exceeded 0 Instances
- --------------------------------------------------------------------------
-
- Comment Usage
- --------------------------------------------------------------------------
- Number of Comments 83 Comments
- Average Comment Size Desired >15 Characters
- Actual 53.0 Characters
- --------------------------------------------------------------------------
-
- Transportability
- --------------------------------------------------------------------------
- Number of Lines Exceeding Line Length 0
- Address Clauses 0
- Representation Specifications 0
- PRAGMA'S used:
- Non-Standard PRAGMA's Used
- Packages/Procedures WITHed
- CURRENT_EXCEPTION
- --------------------------------------------------------------------------
-
- * => Style Flaw ! => Note: Potential for improvement
-
- Keyword Usage
- Used Keyword Allowed Restriction Occurrences Percentage
- --------------------------------------------------------------------------
- IF yes 0.0% 10 19.6%
- IN yes 0.0% 2 3.9%
- IS yes 0.0% 1 2.0%
- END yes 0.0% 9 17.6%
- FOR yes 0.0% 1 2.0%
- NOT yes 0.0% 1 2.0%
- ELSE yes 0.0% 1 2.0%
- LOOP yes 0.0% 6 11.8%
- NULL yes 0.0% 5 9.8%
- THEN yes 0.0% 5 9.8%
- WHEN yes 0.0% 1 2.0%
- WITH yes 0.0% 1 2.0%
- BEGIN yes 0.0% 1 2.0%
- RAISE yes 0.0% 1 2.0%
- WHILE yes 0.0% 2 3.9%
- OTHERS yes 0.0% 1 2.0%
- SEPARATE yes 0.0% 1 2.0%
- EXCEPTION yes 0.0% 1 2.0%
- PROCEDURE yes 0.0% 1 2.0%
- --------------------------------------------------------------------------
- ::::::::::
- test1a.ada
- ::::::::::
- --
- -- T E S T 1 A
- --
- -------------------------------------------------
- -- Test for Short names
- -------------------------------------------------
- procedure XYZ ( Z : in INTEGER; Y : OUT FLOAT ) is
- begin
- return;
- end XYZ;
- ::::::::::
- test1a.flw
- ::::::::::
- procedure XYZ ( Z : in INTEGER; Y : OUT FLOAT ) is
- Reserve word OUT should be in lower case
-
- procedure XYZ ( Z : in INTEGER; Y : OUT FLOAT ) is
- This subprogram is smaller than the defined limits!
-
- --
- Finish checking started in above statement. Total statements: 4
- ::::::::::
- test1a.sty
- ::::::::::
- STYLE Report
- :USER1:POWERS:NOSC:TEST1A.ADA
-
- Naming Conventions
- --------------------------------------------------------------------------
- Invalid Case for an Object Identifier 0 Errors
- * Invalid Case for a Keyword 1 Error
- Name Segment Size (Separated Desired <5 Characters
- * by Underscores) Actual 7.0 Characters
- Average Name Size Desired >5 Characters
- * Actual 3.4 Characters
- --------------------------------------------------------------------------
-
- Physical Layout
- --------------------------------------------------------------------------
- Occurrences of More Than One Statement/Line 0 Errors
- Inconsistant Indentation 0 Errors
- Missing Blank Lines to Set Off a Block 0 Errors
- Loops Without Names 0
- --------------------------------------------------------------------------
-
- Information Hiding, Abstraction, Data Use
- --------------------------------------------------------------------------
- Percent of Literals In Body Desired < 30.0%
- Actual 0.0%
- Percent of Universal Types Desired < 40.0%
- Actual 0.0%
- ! Data Structuring Types NOT Used
- Array Types
- Enumeration Types
- Record Types
- ! No Attributes are Used
- ! Ada-Specific Features NOT used
- AND THEN
- OR ELSE
- EXITS
- XOR
- ELSIF
- EXCEPTION
- IN OUT parameters
- PRIVATEs
- --------------------------------------------------------------------------
-
- Modularity
- --------------------------------------------------------------------------
- Average Number of Parameters Range 0..4 Parameters
- Instances of parameters below minimum 0
- Instances of parameters above maximum 0
- Average Subprogram Size Range 10..200 Statements
- * Instances of size below minimum 1
- Instances of size above maximum 0
- Loops with too many exit statements 0 Instances
- Control Structure Nesting Maximum 8
- Exceeded 0 Instances
- Package Nesting Maximum 2
- Exceeded 0 Instances
- Subprogram Nesting Maximum 4
- Exceeded 0 Instances
- --------------------------------------------------------------------------
-
- Comment Usage
- --------------------------------------------------------------------------
- Number of Comments 6 Comments
- Average Comment Size Desired >15 Characters
- Actual 22.5 Characters
- --------------------------------------------------------------------------
-
- Transportability
- --------------------------------------------------------------------------
- Number of Lines Exceeding Line Length 0
- Address Clauses 0
- Representation Specifications 0
- PRAGMA'S used:
- Non-Standard PRAGMA's Used
- Packages/Procedures WITHed
- --------------------------------------------------------------------------
-
- * => Style Flaw ! => Note: Potential for improvement
-
- Keyword Usage
- Used Keyword Allowed Restriction Occurrences Percentage
- --------------------------------------------------------------------------
- IN yes 0.0% 1 14.3%
- IS yes 0.0% 1 14.3%
- END yes 0.0% 1 14.3%
- OUT yes 0.0% 1 14.3%
- BEGIN yes 0.0% 1 14.3%
- RETURN yes 0.0% 1 14.3%
- PROCEDURE yes 0.0% 1 14.3%
- --------------------------------------------------------------------------
- ::::::::::
- test1b.ada
- ::::::::::
- --
- -- T E S T 1 B
- --
- -------------------------------------------------
- -- Test for UNDERSCORES -- the result should flag
- -- this program as having not enough underscores,
- -- i.e. the name segment size too small!
- -------------------------------------------------
- procedure XYZANDPDQ_FOR_LONG_NAME (
- ZYZENZUZEN_ZULULONG : in INTEGER;
- YYILLERBYTE_YTHISIS_ALSOTOOLONG : OUT FLOAT ) is
- begin
- return;
- end XYZANDPDQ_FOR_LONG_NAME;
- ::::::::::
- test1b.flw
- ::::::::::
- YYILLERBYTE_YTHISIS_ALSOTOOLONG : OUT FLOAT ) is
- Reserve word OUT should be in lower case
-
- procedure XYZANDPDQ_FOR_LONG_NAME (
- This subprogram is smaller than the defined limits!
-
- --
- Finish checking started in above statement. Total statements: 4
- ::::::::::
- test1b.sty
- ::::::::::
- STYLE Report
- :USER1:POWERS:NOSC:TEST1B.ADA
-
- Naming Conventions
- --------------------------------------------------------------------------
- Invalid Case for an Object Identifier 0 Errors
- * Invalid Case for a Keyword 1 Error
- Name Segment Size (Separated Desired <5 Characters
- * by Underscores) Actual 7.4 Characters
- Average Name Size Desired >5 Characters
- Actual 17.0 Characters
- --------------------------------------------------------------------------
-
- Physical Layout
- --------------------------------------------------------------------------
- Occurrences of More Than One Statement/Line 0 Errors
- Inconsistant Indentation 0 Errors
- Missing Blank Lines to Set Off a Block 0 Errors
- Loops Without Names 0
- --------------------------------------------------------------------------
-
- Information Hiding, Abstraction, Data Use
- --------------------------------------------------------------------------
- Percent of Literals In Body Desired < 30.0%
- Actual 0.0%
- Percent of Universal Types Desired < 40.0%
- Actual 0.0%
- ! Data Structuring Types NOT Used
- Array Types
- Enumeration Types
- Record Types
- ! No Attributes are Used
- ! Ada-Specific Features NOT used
- AND THEN
- OR ELSE
- EXITS
- XOR
- ELSIF
- EXCEPTION
- IN OUT parameters
- PRIVATEs
- --------------------------------------------------------------------------
-
- Modularity
- --------------------------------------------------------------------------
- Average Number of Parameters Range 0..4 Parameters
- Instances of parameters below minimum 0
- Instances of parameters above maximum 0
- Average Subprogram Size Range 10..200 Statements
- * Instances of size below minimum 1
- Instances of size above maximum 0
- Loops with too many exit statements 0 Instances
- Control Structure Nesting Maximum 8
- Exceeded 0 Instances
- Package Nesting Maximum 2
- Exceeded 0 Instances
- Subprogram Nesting Maximum 4
- Exceeded 0 Instances
- --------------------------------------------------------------------------
-
- Comment Usage
- --------------------------------------------------------------------------
- Number of Comments 8 Comments
- Average Comment Size Desired >15 Characters
- Actual 31.0 Characters
- --------------------------------------------------------------------------
-
- Transportability
- --------------------------------------------------------------------------
- Number of Lines Exceeding Line Length 0
- Address Clauses 0
- Representation Specifications 0
- PRAGMA'S used:
- Non-Standard PRAGMA's Used
- Packages/Procedures WITHed
- --------------------------------------------------------------------------
-
- * => Style Flaw ! => Note: Potential for improvement
-
- Keyword Usage
- Used Keyword Allowed Restriction Occurrences Percentage
- --------------------------------------------------------------------------
- IN yes 0.0% 1 14.3%
- IS yes 0.0% 1 14.3%
- END yes 0.0% 1 14.3%
- OUT yes 0.0% 1 14.3%
- BEGIN yes 0.0% 1 14.3%
- RETURN yes 0.0% 1 14.3%
- PROCEDURE yes 0.0% 1 14.3%
- --------------------------------------------------------------------------
- ::::::::::
- test2.ada
- ::::::::::
- --
- -- T E S T 2
- --
-
- package body INITIALIZE is
-
- begin
-
- ----------------------------------------------------------------------------
- --The following assignments should raise flags for Test A4
- --The assignments that show 1 and 0 should not be flagged for Test A4
- ----------------------------------------------------------------------------
-
- OPENED := FALSE;
- CHECK := 5;
- CHECKONE := 1; --should not be flagged
- CHECKONE := 0; --should not be flagged
- CHECK := 150;
- CHECK := 32767;
- CHECKTWO := "FIVE";
- CHECKTWO := "FOUR";
-
- WHILE not OPENED loop
- FILE_IO.OPEN_INPUT_FILE(INPUT_FILES(FILE_LEVEL).FILE,OPENED,DUMMY);
- end loop;
- if TEXT_IO.IS_OPEN(INPUT_FILES(FILE_LEVEL).FILE) then
- OPENED := FALSE;
- while not OPENED loop
- FILE_IO.OPEN_OUTPUT_FILE(OUTPUT_FILE,
- TEXT_IO.NAME(INPUT_FILES(FILE_LEVEL).FILE),OPENED);
- end loop;
- HOST_LCD_IF.GET_TIME(TODAY,TIME_ERROR);
- if TIME_ERROR = HOST_LCD_IF.NOT_AN_ERROR then
- TIME_STAMP := " ";
- TEXT_IO.INTEGER_IO.PUT(TIME_STAMP(11..12),TODAY.MONTH);
- TIME_STAMP(13) := '/';
- TEXT_IO.INTEGER_IO.PUT(TIME_STAMP(14..15),TODAY.DAY);
- TIME_STAMP(16) := '/';
- TEXT_IO.INTEGER_IO.PUT(TIME_STAMP(17..20),TODAY.YEAR);
- SECONDS_SINCE_MIDNIGHT := TODAY.TICKS_SINCE_MIDNIGHT /
- TODAY.TICKS_PER_SECOND;
- HOURS := SECONDS_SINCE_MIDNIGHT / SECONDS_PER_HOUR;
- MINUTES := ((SECONDS_SINCE_MIDNIGHT) - (SECONDS_PER_HOUR * HOURS)) /
- SECONDS_PER_MINUTE;
- SECONDS := ((SECONDS_SINCE_MIDNIGHT) - (SECONDS_PER_HOUR * HOURS)) -
- (SECONDS_PER_MINUTE * MINUTES);
- TEXT_IO.LONG_INTEGER_IO.PUT(TIME_STAMP(1..2),HOURS);
- TIME_STAMP(3) := ':';
- TEXT_IO.LONG_INTEGER_IO.PUT(TIME_STAMP(4..5),MINUTES);
- TIME_STAMP(6) := ':';
- TEXT_IO.LONG_INTEGER_IO.PUT(TIME_STAMP(7..8),SECONDS);
- else
- TIME_STAMP := " ";
- end if;
- end if;
- end INITIALIZE;
- ::::::::::
- test2.flw
- ::::::::::
- WHILE not OPENED loop
- Reserve word WHILE should be in lower case
-
- if TIME_ERROR = HOST_LCD_IF.NOT_AN_ERROR then
- This structure should have preceeding blank lines to set it off.
-
- if TIME_ERROR = HOST_LCD_IF.NOT_AN_ERROR then
- This structure should have following blank lines to set it off.
-
- if TEXT_IO.IS_OPEN(INPUT_FILES(FILE_LEVEL).FILE) then
- This structure should have preceeding blank lines to set it off.
-
- if TEXT_IO.IS_OPEN(INPUT_FILES(FILE_LEVEL).FILE) then
- This structure should have following blank lines to set it off.
-
- --
- Finish checking started in above statement. Total statements: 39
- ::::::::::
- test2.sty
- ::::::::::
- STYLE Report
- :USER1:POWERS:NOSC:TEST2.ADA
-
- Naming Conventions
- --------------------------------------------------------------------------
- Invalid Case for an Object Identifier 0 Errors
- * Invalid Case for a Keyword 1 Error
- Name Segment Size (Separated Desired <5 Characters
- by Underscores) Actual 4.8 Characters
- Average Name Size Desired >5 Characters
- Actual 9.4 Characters
- --------------------------------------------------------------------------
-
- Physical Layout
- --------------------------------------------------------------------------
- Occurrences of More Than One Statement/Line 0 Errors
- Inconsistant Indentation 0 Errors
- * Missing Blank Lines to Set Off a Block 2 Errors
- Loops Without Names 0
- --------------------------------------------------------------------------
-
- Information Hiding, Abstraction, Data Use
- --------------------------------------------------------------------------
- Percent of Literals In Body Desired < 30.0%
- * Actual 100.0%
- Percent of Universal Types Desired < 40.0%
- Actual 0.0%
- ! Data Structuring Types NOT Used
- Array Types
- Enumeration Types
- Record Types
- ! No Attributes are Used
- ! Ada-Specific Features NOT used
- AND THEN
- OR ELSE
- EXITS
- XOR
- ELSIF
- EXCEPTION
- IN parameters
- OUT parameters
- IN OUT parameters
- PRIVATEs
- --------------------------------------------------------------------------
-
- Modularity
- --------------------------------------------------------------------------
- Average Number of Parameters Range 0..4 Parameters
- Instances of parameters below minimum 0
- Instances of parameters above maximum 0
- Average Subprogram Size Range 10..200 Statements
- Instances of size below minimum 0
- Instances of size above maximum 0
- Loops with too many exit statements 0 Instances
- Control Structure Nesting Maximum 8
- Exceeded 0 Instances
- Package Nesting Maximum 2
- Exceeded 0 Instances
- Subprogram Nesting Maximum 4
- Exceeded 0 Instances
- --------------------------------------------------------------------------
-
- Comment Usage
- --------------------------------------------------------------------------
- Number of Comments 9 Comments
- Average Comment Size Desired >15 Characters
- Actual 37.4 Characters
- --------------------------------------------------------------------------
-
- Transportability
- --------------------------------------------------------------------------
- Number of Lines Exceeding Line Length 0
- Address Clauses 0
- Representation Specifications 0
- PRAGMA'S used:
- Non-Standard PRAGMA's Used
- Packages/Procedures WITHed
- --------------------------------------------------------------------------
-
- * => Style Flaw ! => Note: Potential for improvement
-
- Keyword Usage
- Used Keyword Allowed Restriction Occurrences Percentage
- --------------------------------------------------------------------------
- IF yes 0.0% 4 16.7%
- IS yes 0.0% 1 4.2%
- END yes 0.0% 5 20.8%
- NOT yes 0.0% 2 8.3%
- BODY yes 0.0% 1 4.2%
- ELSE yes 0.0% 1 4.2%
- LOOP yes 0.0% 4 16.7%
- THEN yes 0.0% 2 8.3%
- BEGIN yes 0.0% 1 4.2%
- WHILE yes 0.0% 2 8.3%
- PACKAGE yes 0.0% 1 4.2%
- --------------------------------------------------------------------------
- ::::::::::
- test3a.ada
- ::::::::::
- --
- -- T E S T 3A
- --
- ------------------------------------------------------------------------
- -- This is a modification of Test 3 to include ALL Ada keywords!
-
- with TEXT_IO;
- procedure INSERT (LENGTH : in ID_RANGE;
- STRG : in ID_STRING;
- T : in out TREE;
- REFERENCE_LINE_NUMBER : in LINE_NUM_RANGE) is
- FOLLOW_CHAIN : REFPTR; -- used to follow
- -- chain of references
- TESTER : BOOLEAN := TRUE;
-
- -----------------------------------------------------------------------
- --The following package declarations and package bodies have been
- --added to this module for testing purposes.
- -----------------------------------------------------------------------
-
- package CHECKER is
-
- task INTERRUPT is
- entry DONE;
- for DONE use at 16#40#;
-
- function HELP return BOOLEAN is separate;
-
- subtype XDATA is new REALS digits 4;
- type YDATA is REALS digits 4 range 0.0 .. 100.0;
- LIMIT : constant INTEGER := 3;
-
- type INFO is
- record
- VERTICAL : YDATA;
- HORIZONTAL : XDATA
- end record;
- limited private
-
- type NEW_PTR is access INFO;
-
- OOPS : exception;
- generic
- package COUNTER is
- begin
- return;
- end COUNTER;
- begin
-
- LOOP_NAME:
- loop
- <<INTERRUPT_NAME>>
- accept INTERRUPT do
- delay 60.0;
- GET_IT(INFO.all);
- end INTERRUPT;
-
-
- declare
- EXTRA : exception renames OOPS;
- FRACT : FRACTION delta 0.0001;
- SAVER : array(0..1) of BOOLEAN;
-
- begin
- for I in reverse 1..31 loop
- if abs(INFO.HORIZONTAL) mod 30 = 0 and then
- not HELP
- or else INFO.VERTICAL rem 30 then
- abort OTHER_TASK;
- elsif HELP xor TRUE then
- goto INTERRUPT_NAME;
- end if;
- end loop;
- end;
-
-
- case HELP is
- when others =>
- exit;
- end case;
-
-
- select
- when HELP =>
- exit;
- when others =>
- raise OOPS;
- end select;
- end loop LOOP_NAME;
- terminate;
- end INTERRUPT;
-
- ----------------------------------------------------
- -- The following should be flagged on the inner packages
- -- as being nested too deeply!
- ----------------------------------------------------
-
- package CHECKER_ONE is
- package CHECKER_TWO is
- package CHECKER_THREE is
- procedure TRY_AGAIN;
- end CHECKER_THREE;
- end CHECKER_TWO;
- end CHECKER_ONE;
-
- end CHECKER;
-
- package body CHECKER is
-
- package body CHECKER_ONE is
- package body CHECKER_TWO is
- package body CHECKER_THREE is
- procedure TRY_AGAIN is
- begin
- null;
- end TRY_AGAIN;
- end CHECKER_THREE;
- end CHECKER_TWO;
- end CHECKER_ONE;
-
- end CHECKER;
-
- -----------------------------------------------------------------------
- --The following procedure calls have been added to check for nesting
- --levels.
- -----------------------------------------------------------------------
-
- procedure STUFFER is
-
- procedure STUFFERONE is
-
- procedure STUFFERTWO is
-
- procedure STUFFERTHREE is
-
- procedure STUFFERFOUR is
- begin
- TEXT_IO.PUT_LINE("In stufferfour!");
- end STUFFERFOUR;
-
- begin
- TEXT_IO.PUT_LINE("In stufferthree!");
- end STUFFERTHREE;
-
- begin
- TEXT_IO.PUT_LINE("In stuffertwo!");
- end STUFFERTWO;
-
- begin
- TEXT_IO.PUT_LINE("In stufferone!");
- end STUFFERONE;
-
- begin
- TEXT_IO.PUT_LINE("In stuffer!");
- end STUFFER;
-
- begin
- if T = null then -- add this identifier and reference here
- T := new NODE'(STRG,LENGTH,null,null,null);
- T.REFERENCES := new REFS'(REFERENCE_LINE_NUMBER,null);
- else
- if T.STRG = STRG then -- new reference to old identifier
- FOLLOW_CHAIN := T.REFERENCES;
- while FOLLOW_CHAIN.NEXT /= null loop
- FOLLOW_CHAIN := FOLLOW_CHAIN.NEXT;
-
- -------------------------------------------------------------------
- --The following loops are added to test nesting levels of loops.
- -- The outer loop should be flagged as nested too deep.
- -- The inner loop should be flagged as needing a loop name.
- -------------------------------------------------------------------
-
- while TESTER loop
- while TESTER loop
- while TESTER loop
- for INDEX in 1..100 loop
- while TESTER loop
- while TESTER loop
- -- should be flagged - nesting too deep
- while TESTER loop
- null;
- end loop;
- end loop;
- end loop;
- end loop;
- TESTER := FALSE;
- end loop;
- end loop;
- end loop;
- end loop;
- TESTER := TRUE;
- if FOLLOW_CHAIN.REFNUM /= REFERENCE_LINE_NUMBER then
- FOLLOW_CHAIN.NEXT := new REFS'(REFERENCE_LINE_NUMBER,null);
- end if;
- else
- if T.STRG > STRG then
- INSERT(LENGTH,STRG,T.LEFT,REFERENCE_LINE_NUMBER);
- else
- INSERT(LENGTH,STRG,T.RIGHT,REFERENCE_LINE_NUMBER);
-
- -----------------------------------------------------------------------
- --The following if's are inserted for testing purposes.
- -----------------------------------------------------------------------
-
- if TESTER then
- if TESTER then
- if TESTER then
- if TESTER then
- null;
- end if;
- null;
- end if;
- null;
- end if;
- null;
- end if;
- end if;
- end if;
- end if;
- end INSERT;
- pragma MAIN;
- ::::::::::
- test3a.flw
- ::::::::::
- for DONE use at 16#40#;
- This may be a non-transportable statement (Address Clause).
-
- declare
- This structure should have following blank lines to set it off.
-
- loop
- This structure should have following blank lines to set it off.
-
- loop
- This structure is large enough that it should have a loop-name!
-
- terminate;
- This line should be indented to column: 7
-
- task INTERRUPT is
- This structure should have following blank lines to set it off.
-
- package CHECKER_TWO is
- This package is nested too deeply!
-
- package CHECKER_THREE is
- This package is nested too deeply!
-
- package CHECKER_ONE is
- This structure should have following blank lines to set it off.
-
- package body CHECKER_TWO is
- This package is nested too deeply!
-
- package body CHECKER_THREE is
- This package is nested too deeply!
-
- procedure TRY_AGAIN is
- This subprogram is smaller than the defined limits!
-
- package body CHECKER_TWO is
- This structure should have preceeding blank lines to set it off.
-
- package body CHECKER_TWO is
- This structure should have following blank lines to set it off.
-
- package body CHECKER_ONE is
- This structure should have following blank lines to set it off.
-
- procedure STUFFERTHREE is
- This subprogram is nested too deeply!
-
- procedure STUFFERFOUR is
- This subprogram is nested too deeply!
-
- procedure STUFFERFOUR is
- This subprogram is smaller than the defined limits!
-
- procedure STUFFERTHREE is
- This subprogram is smaller than the defined limits!
-
- while TESTER loop
- This control structure is nested too deeply!
-
- while TESTER loop
- This control structure is nested too deeply!
-
- while TESTER loop
- This structure should have preceeding blank lines to set it off.
-
- while TESTER loop
- This structure should have following blank lines to set it off.
-
- while TESTER loop
- This structure is large enough that it should have a loop-name!
-
- for INDEX in 1..100 loop
- This structure should have preceeding blank lines to set it off.
-
- for INDEX in 1..100 loop
- This structure is large enough that it should have a loop-name!
-
- while TESTER loop
- This structure is large enough that it should have a loop-name!
-
- while TESTER loop
- This structure is large enough that it should have a loop-name!
-
- while TESTER loop
- This structure is large enough that it should have a loop-name!
-
- while FOLLOW_CHAIN.NEXT /= null loop
- This structure is large enough that it should have a loop-name!
-
- pragma MAIN;
- Transportability Note: Non-Standard Pragma!
-
- --
- Finish checking started in above statement. Total statements: 136
- ::::::::::
- test3a.sty
- ::::::::::
- STYLE Report
- :USER1:POWERS:NOSC:TEST3A.ADA
-
- Naming Conventions
- --------------------------------------------------------------------------
- Invalid Case for an Object Identifier 0 Errors
- Invalid Case for a Keyword 0 Errors
- Name Segment Size (Separated Desired <5 Characters
- * by Underscores) Actual 5.8 Characters
- Average Name Size Desired >5 Characters
- Actual 7.2 Characters
- --------------------------------------------------------------------------
-
- Physical Layout
- --------------------------------------------------------------------------
- Occurrences of More Than One Statement/Line 0 Errors
- * Inconsistant Indentation 1 Error
- * Missing Blank Lines to Set Off a Block 18 Errors
- * Loops Without Names 7
- --------------------------------------------------------------------------
-
- Information Hiding, Abstraction, Data Use
- --------------------------------------------------------------------------
- Percent of Literals In Body Desired < 30.0%
- * Actual 59.1%
- Percent of Universal Types Desired < 40.0%
- Actual 8.3%
- ! Data Structuring Types NOT Used
- Enumeration Types
- ! No Attributes are Used
- ! Ada-Specific Features NOT used
- EXCEPTION
- OUT parameters
- --------------------------------------------------------------------------
-
- Modularity
- --------------------------------------------------------------------------
- Average Number of Parameters Range 0..4 Parameters
- Instances of parameters below minimum 0
- Instances of parameters above maximum 0
- Average Subprogram Size Range 10..200 Statements
- * Instances of size below minimum 3
- Instances of size above maximum 0
- Loops with too many exit statements 0 Instances
- Control Structure Nesting Maximum 8
- * Exceeded 2 Instances
- Package Nesting Maximum 2
- * Exceeded 4 Instances
- Subprogram Nesting Maximum 4
- * Exceeded 2 Instances
- --------------------------------------------------------------------------
-
- Comment Usage
- --------------------------------------------------------------------------
- Number of Comments 30 Comments
- Average Comment Size Desired >15 Characters
- Actual 48.2 Characters
- --------------------------------------------------------------------------
-
- Transportability
- --------------------------------------------------------------------------
- Number of Lines Exceeding Line Length 0
- * Address Clauses 1
- Representation Specifications 0
- PRAGMA'S used:
- Non-Standard PRAGMA's Used
- MAIN
- Packages/Procedures WITHed
- --------------------------------------------------------------------------
-
- * => Style Flaw ! => Note: Potential for improvement
-
- Keyword Usage
- Used Keyword Allowed Restriction Occurrences Percentage
- --------------------------------------------------------------------------
- AT yes 0.0% 1 0.4%
- DO yes 0.0% 1 0.4%
- IF yes 0.0% 18 7.5%
- IN yes 0.0% 6 2.5%
- IS yes 0.0% 23 9.5%
- OF yes 0.0% 1 0.4%
- OR yes 0.0% 1 0.4%
- ABS yes 0.0% 1 0.4%
- ALL yes 0.0% 1 0.4%
- AND yes 0.0% 1 0.4%
- END yes 0.0% 41 17.0%
- FOR yes 0.0% 3 1.2%
- MOD yes 0.0% 1 0.4%
- NEW yes 0.0% 4 1.7%
- NOT yes 0.0% 1 0.4%
- OUT yes 0.0% 1 0.4%
- REM yes 0.0% 1 0.4%
- USE yes 20.0% 1 0.4%
- XOR yes 0.0% 1 0.4%
- BODY yes 0.0% 4 1.7%
- CASE yes 0.0% 2 0.8%
- ELSE yes 0.0% 4 1.7%
- EXIT yes 0.0% 2 0.8%
- * GOTO no 0.0% 1 0.4%
- LOOP yes 0.0% 20 8.3%
- NULL yes 0.0% 13 5.4%
- TASK yes 0.0% 1 0.4%
- THEN yes 0.0% 11 4.6%
- TYPE yes 0.0% 3 1.2%
- WHEN yes 0.0% 3 1.2%
- WITH yes 0.0% 1 0.4%
- ABORT yes 0.0% 1 0.4%
- ARRAY yes 0.0% 1 0.4%
- BEGIN yes 0.0% 10 4.1%
- DELAY yes 0.0% 1 0.4%
- DELTA yes 0.0% 1 0.4%
- ELSIF yes 0.0% 1 0.4%
- ENTRY yes 0.0% 1 0.4%
- RAISE yes 0.0% 1 0.4%
- RANGE yes 0.0% 1 0.4%
- WHILE yes 0.0% 7 2.9%
- ACCEPT yes 0.0% 1 0.4%
- ACCESS yes 0.0% 1 0.4%
- DIGITS yes 0.0% 2 0.8%
- OTHERS yes 0.0% 2 0.8%
- PRAGMA yes 0.0% 1 0.4%
- RECORD yes 0.0% 2 0.8%
- RETURN yes 0.0% 2 0.8%
- SELECT yes 0.0% 2 0.8%
- DECLARE yes 0.0% 1 0.4%
- GENERIC yes 0.0% 1 0.4%
- LIMITED yes 0.0% 1 0.4%
- PACKAGE yes 0.0% 9 3.7%
- PRIVATE yes 0.0% 1 0.4%
- RENAMES yes 0.0% 1 0.4%
- REVERSE yes 0.0% 1 0.4%
- SUBTYPE yes 0.0% 1 0.4%
- CONSTANT yes 0.0% 1 0.4%
- FUNCTION yes 0.0% 1 0.4%
- SEPARATE yes 0.0% 1 0.4%
- EXCEPTION yes 0.0% 2 0.8%
- PROCEDURE yes 0.0% 8 3.3%
- TERMINATE yes 0.0% 1 0.4%
- --------------------------------------------------------------------------
- ::::::::::
- test4.ada
- ::::::::::
- -------------------------PROLOGUE---------------------------------------
- -- -*
- -- Unit name : next_character
- -- Author : Richard D. Powers
- -- Date created : 7-29-83
- -- Last update :
- -- -*
- ------------------------------------------------------------------------
- -- -*
- -- Abstract : This procedure returns the next character from the
- ----------------: input stream. If the character is a lower case
- ----------------: letter then it is converted to upper case.
- -- -*
- ------------------------------------------------------------------------
- -- -*
- -- Inputs : INPUT_FILES - global file record
- -- Outputs : CH - next character from input stream
- -- Procedures called : GET_LINE, NEXT_CHARACTER
- -- Exceptions : If end of file is encountered then the return
- -- character is not changed, but current line will
- -- have it's length set to -1.
- -- -*
- ------------------------------------------------------------------------
- --
- -- Mnemonic :
- -- Name :
- -- Release date :
- ------------------ Revision history ------------------------------------
- --
- -- DATE AUTHOR HISTORY
- --
- --
- --
- --------------------END-PROLOGUE----------------------------------------
-
- with TEXT_IO;
- procedure NEXT_CHARACTER (CH : out CHARACTER) is
- --pragma INCLUDE("GETLINE.ada.");
- -------------------------PROLOGUE---------------------------------------
- -- -*
- -- Unit name : get_line
- -- Author : Richard D. Powers
- -- Date created : 7-29-83
- -- Last update : 10-07-83
- -- -*
- ------------------------------------------------------------------------
- -- -*
- -- Abstract : This procedure gets the next line from the input
- ----------------: stream.
- -- -*
- ------------------------------------------------------------------------
- -- -*
- -- Inputs : INPUT_FILE - global file record
- -- Outputs : LINE - next line from input stream
- -- Procedures called : PUT_HEADER, TEXT_IO.END_OF_FILE,
- -- TEXT_IO.END_OF_LINE, TEXT_IO.GET,
- -- TEXT_IO.INTEGER_IO.PUT, TEXT_IO.NEW_LINE
- -- TEXT_IO.PUT, TEXT_IO.SKIP_LINE
- -- Exceptions : If end of file is encountered then line length is
- -- set to -1.
- -- -*
- ------------------------------------------------------------------------
- --
- -- Mnemonic :
- -- Name :
- -- Release date :
- ------------------ Revision history ------------------------------------
- --
- -- DATE AUTHOR HISTORY
- -- 10-07-83 R. Powers Don't read a character at a time
- --
- --
- --------------------END-PROLOGUE----------------------------------------
- procedure GET_LINE(LINE : out LINE_RECORD) is
- NEWLINE : STRING(1..MAX_LINE_LENGTH); -- parameter for text_io routines
-
- LOOP_FLAG,LOOP_FLAG_ONE : BOOLEAN := true;
-
- begin
-
- ---------------------------------------------------------------------
- --A loop added here for testing purposes.
- ---------------------------------------------------------------------
-
- for INDEX in 1..1 loop --long loop (no name) should be flagged.
- LOOP_TEST: --long loop with a name (no flag)
- for INDEX in 1..1 loop
- if TEXT_IO.END_OF_FILE(INPUT_FILES(FILE_LEVEL).FILE) then
- LINE.LENGTH := -1;
- LINE.COLUMN := 0;
- else
- if LINE_NUMBER mod 40 = 0 then
- TEXT_IO.NEW_LINE;
- end if;
- if LINE_NUMBER mod 58 = 0 then
- PUT_HEADER;
- end if;
- TEXT_IO.PUT('.');
- LINE_NUMBER := LINE_NUMBER + 1;
- TEXT_IO.INTEGER_IO.PUT(OUTPUT_FILE,LINE_NUMBER,5);
- if LOOP_FLAG then
- exit;
- end if;
- if LOOP_FLAG_ONE then
- exit LOOP_TEST;
- end if;
- while LOOP_FLAG loop --Multiple exits should be flagged.
- LOOP_FLAG := false;
- if LOOP_FLAG then
- exit LOOP_TEST;
- end if;
- exit;
- end loop;
- exit LOOP_TEST;
- TEXT_IO.PUT(OUTPUT_FILE,' ');
- TEXT_IO.GET_LINE(INPUT_FILES(FILE_LEVEL).FILE,NEWLINE,LINE.LENGTH);
- if LINE.LENGTH > 75 then -- only write first 75 characters
- TEXT_IO.PUT(OUTPUT_FILE,NEWLINE(1..74));
- else
- TEXT_IO.PUT(OUTPUT_FILE,NEWLINE(1..LINE.LENGTH));
- end if;
- for I in 1..LINE.LENGTH loop
- LINE.LINE(I) := NEWLINE(I); --No exits in loop (no flags)
- end loop;
- LINE.COLUMN := 0;
- TEXT_IO.NEW_LINE(OUTPUT_FILE);
- end if;
- end loop LOOP_TEST;
- end loop;
- end GET_LINE;
-
- begin
- if INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN <
- INPUT_FILES(FILE_LEVEL).CURRENT_LINE.LENGTH then
- INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN :=
- INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN + 1;
- CH := INPUT_FILES(FILE_LEVEL).CURRENT_LINE.
- LINE(INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN);
- elsif INPUT_FILES(FILE_LEVEL).CURRENT_LINE.LENGTH > -1 then
- GET_LINE(INPUT_FILES(FILE_LEVEL).CURRENT_LINE);
- NEXT_CHARACTER(CH);
- end if;
- if (CH >= 'a') and (CH <= 'z') then
- CH := CHARACTER'VAL(CHARACTER'POS(CH) - CHARACTER'POS('a') +
- CHARACTER'POS('A'));
- end if;
- end NEXT_CHARACTER;
- ::::::::::
- test4.flw
- ::::::::::
- procedure GET_LINE(LINE : out LINE_RECORD) is
- Beginning of this block not indented properly. Line ignored for Indentation!
-
- LOOP_FLAG,LOOP_FLAG_ONE : BOOLEAN := true;
- Object name true should be in upper case
-
- for INDEX in 1..1 loop --long loop (no name) should be flagged.
- Beginning of this block not indented properly. Line ignored for Indentation!
-
- LOOP_TEST: --long loop with a name (no flag)
- This Loop-name should be outdented further!
-
- if TEXT_IO.END_OF_FILE(INPUT_FILES(FILE_LEVEL).FILE) then
- Beginning of this block not indented properly. Line ignored for Indentation!
-
- LOOP_FLAG := false;
- Object name false should be in upper case
-
- while LOOP_FLAG loop --Multiple exits should be flagged.
- This structure should have preceeding blank lines to set it off.
-
- while LOOP_FLAG loop --Multiple exits should be flagged.
- This structure should have following blank lines to set it off.
-
- while LOOP_FLAG loop --Multiple exits should be flagged.
- This structure is large enough that it should have a loop-name!
-
- while LOOP_FLAG loop --Multiple exits should be flagged.
- This loop has more EXITS than allowed by the style.
-
- if TEXT_IO.END_OF_FILE(INPUT_FILES(FILE_LEVEL).FILE) then
- This structure should have preceeding blank lines to set it off.
-
- if TEXT_IO.END_OF_FILE(INPUT_FILES(FILE_LEVEL).FILE) then
- This structure should have following blank lines to set it off.
-
- for INDEX in 1..1 loop
- This structure should have following blank lines to set it off.
-
- for INDEX in 1..1 loop
- This structure is large enough that it should have a loop-name!
-
- for INDEX in 1..1 loop --long loop (no name) should be flagged.
- This structure should have following blank lines to set it off.
-
- for INDEX in 1..1 loop --long loop (no name) should be flagged.
- This structure is large enough that it should have a loop-name!
-
- procedure GET_LINE(LINE : out LINE_RECORD) is
- This structure should have following blank lines to set it off.
-
- procedure NEXT_CHARACTER (CH : out CHARACTER) is
- This structure should have following blank lines to set it off.
-
- -------------------------PROLOGUE---------------------------------------
- Finish checking started in above statement. Total statements: 61
- ::::::::::
- test4.sty
- ::::::::::
- STYLE Report
- :USER1:POWERS:NOSC:TEST4.ADA
-
- Naming Conventions
- --------------------------------------------------------------------------
- * Invalid Case for an Object Identifier 2 Errors
- Invalid Case for a Keyword 0 Errors
- Name Segment Size (Separated Desired <5 Characters
- by Underscores) Actual 4.6 Characters
- Average Name Size Desired >5 Characters
- Actual 7.7 Characters
- --------------------------------------------------------------------------
-
- Physical Layout
- --------------------------------------------------------------------------
- Occurrences of More Than One Statement/Line 0 Errors
- * Inconsistant Indentation 4 Errors
- * Missing Blank Lines to Set Off a Block 6 Errors
- * Loops Without Names 3
- --------------------------------------------------------------------------
-
- Information Hiding, Abstraction, Data Use
- --------------------------------------------------------------------------
- Percent of Literals In Body Desired < 30.0%
- * Actual 96.3%
- Percent of Universal Types Desired < 40.0%
- Actual 0.0%
- ! Data Structuring Types NOT Used
- Array Types
- Enumeration Types
- Record Types
- ! Ada-Specific Features NOT used
- AND THEN
- OR ELSE
- XOR
- EXCEPTION
- IN OUT parameters
- PRIVATEs
- --------------------------------------------------------------------------
-
- Modularity
- --------------------------------------------------------------------------
- Average Number of Parameters Range 0..4 Parameters
- Instances of parameters below minimum 0
- Instances of parameters above maximum 0
- Average Subprogram Size Range 10..200 Statements
- Instances of size below minimum 0
- Instances of size above maximum 0
- * Loops with too many exit statements 1 Instance
- Control Structure Nesting Maximum 8
- Exceeded 0 Instances
- Package Nesting Maximum 2
- Exceeded 0 Instances
- Subprogram Nesting Maximum 4
- Exceeded 0 Instances
- --------------------------------------------------------------------------
-
- Comment Usage
- --------------------------------------------------------------------------
- Number of Comments 79 Comments
- Average Comment Size Desired >15 Characters
- Actual 45.5 Characters
- --------------------------------------------------------------------------
-
- Transportability
- --------------------------------------------------------------------------
- Number of Lines Exceeding Line Length 0
- Address Clauses 0
- Representation Specifications 0
- PRAGMA'S used:
- Non-Standard PRAGMA's Used
- Packages/Procedures WITHed
- --------------------------------------------------------------------------
-
- * => Style Flaw ! => Note: Potential for improvement
-
- Keyword Usage
- Used Keyword Allowed Restriction Occurrences Percentage
- --------------------------------------------------------------------------
- IF yes 0.0% 18 23.1%
- IN yes 0.0% 3 3.8%
- IS yes 0.0% 2 2.6%
- AND yes 0.0% 1 1.3%
- END yes 0.0% 15 19.2%
- FOR yes 0.0% 3 3.8%
- MOD yes 0.0% 2 2.6%
- OUT yes 0.0% 2 2.6%
- ELSE yes 0.0% 2 2.6%
- EXIT yes 0.0% 5 6.4%
- LOOP yes 0.0% 8 10.3%
- THEN yes 0.0% 10 12.8%
- WITH yes 0.0% 1 1.3%
- BEGIN yes 0.0% 2 2.6%
- ELSIF yes 0.0% 1 1.3%
- WHILE yes 0.0% 1 1.3%
- PROCEDURE yes 0.0% 2 2.6%
- --------------------------------------------------------------------------
- ::::::::::
- test5.ada
- ::::::::::
- -----------------------------------------------------------------------
- --This procedure has been altered in order to provide tests for the
- --Style Checker program. Line length must be set by the parameters
- --of the Checker with a maximum length of 80 characters.
- -------------------------PROLOGUE---------------------------------------
- -- -*
- -- Unit name : next_identifier
- -- Author : Richard D. Powers
- -- Date created : 7-29-83
- -- Last update :
- -- -*
- ------------------------------------------------------------------------
- -- -*
- -- Abstract : This procedure returns the next identifier in the
- ----------------: input stream.
- -- -*
- ------------------------------------------------------------------------
- -- -*
- -- Inputs : INPUT_FILES - global input file record
- -- Outputs : IDENTIFIER - next identifier from input stream
- -- LENGTH - length of next identifier
- -- REFERENCE_LINE_NUMBER - line number of this id
- -- Procedures called : NEXT_CHARACTER
- -- Exceptions : if no identifier is found (i.e. end of file) then
- -- LENGTH is set to zero.
- -- -*
- ------------------------------------------------------------------------
- --
- -- Mnemonic :
- -- Name :
- -- Release date :
- ------------------ Revision history ------------------------------------
- --
- -- DATE AUTHOR HISTORY
- --
- --
- --
- --------------------END-PROLOGUE----------------------------------------
-
- with CURRENT_EXCEPTION;
- with TEXT_IO;
- procedure NEXT_IDENTIFIER(IDENTIFIER : out LINE_STRING;
- LENGTH : out LINE_INDEX_RANGE;
- REFERENCE_LINE_NUMBER : out LINE_NUM_RANGE) is
-
- ------------------------------------------------------------------------
- --The following is added to test the flagging of representation specs.
- ------------------------------------------------------------------------
-
- type MEDIUM is range 0..100;
- BYTE : constant := 8;
- for MEDIUM'SIZE use 2*BYTE;
-
- type COLOR is (RED,BLUE,YELLOW);
- for COLOR use (RED => 5,BLUE => 10,YELLOW => 15);
-
-
- CH : CHARACTER; -- get a character at a time
- INDEX : INTEGER range 0..MAX_LINE_LENGTH; -- index into identifier
-
- ------------------------------------------------------------------------
- --The following is a test for recognition of Pragmas
- ------------------------------------------------------------------------
-
-
-
- pragma LIST(OFF);
- pragma LIST(ON);
- pragma OPTIMIZE(SPACE);
- pragma PAGE;
- begin
- for I in 1..ID_LENGTH loop
- IDENTIFIER(I) := ' ';
- end loop;
- CH := ' '; -- force entry into first loop
- WHILE not ((CH >= 'A') and (CH <= 'Z'))
- and (INPUT_FILES(FILE_LEVEL).CURRENT_LINE.LENGTH > -1) loop
- NEXT_CHARACTER(CH);
- if CH = '-' then -- look for comment indicator
- INDEX := INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN;
- -- remember which column we are at
- NEXT_CHARACTER(CH);
- if (CH = '-') and
- (INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN = INDEX + 1)
- then -- found a comment
- while INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN <
- INPUT_FILES(FILE_LEVEL).CURRENT_LINE.LENGTH loop
- NEXT_CHARACTER(CH);
- end loop;
- CH := ' '; -- force us to remain in loop
- end if;
- end if;
- ----------------------------------------------------------------------------
- --This is a long line to allow for the maximum parameter of the StyleChecker
- ----------------------------------------------------------------------------
-
- if (CH >= '0' and CH <= '9') then -- skip over literals
- NEXT_CHARACTER(CH);
- while ((CH >= '0' and CH <= '9') or (CH = 'E') OR (CH = '_')) and
- (INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN <
- INPUT_FILES(FILE_LEVEL).CURRENT_LINE.LENGTH)
- loop
- NEXT_CHARACTER(CH);
- if (CH = '#') then -- skip over based literals
- NEXT_CHARACTER(CH);
- WHILE (CH /= '#') and
- (INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN <
- INPUT_FILES(FILE_LEVEL).CURRENT_LINE.LENGTH)
- loop
- NEXT_CHARACTER(CH);
- end loop;
- NEXT_CHARACTER(CH);
- end if;
- end loop;
- end if;
- if (CH = '"') then -- skip over string constants
- NEXT_CHARACTER(CH);
- while (CH /= '"') and
- (INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN <
- INPUT_FILES(FILE_LEVEL).CURRENT_LINE.LENGTH)
- loop
- NEXT_CHARACTER(CH);
- end loop;
- end if;
- if ((CH = ''') and
- (INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN + 2 <=
- INPUT_FILES(FILE_LEVEL).CURRENT_LINE.LENGTH)) and then
- INPUT_FILES(FILE_LEVEL).CURRENT_LINE.
- LINE(INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN + 2) = '''
- then
- NEXT_CHARACTER(CH); -- skip character constant
- NEXT_CHARACTER(CH); -- skip end of constant delimiter
- end if;
- end loop;
- if INPUT_FILES(FILE_LEVEL).CURRENT_LINE.LENGTH = -1 then
- LENGTH := 0; -- end of file encountered
- else
- if INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN =
- INPUT_FILES(FILE_LEVEL).CURRENT_LINE.LENGTH
- then -- last character on line
- IDENTIFIER(1) := CH;
- LENGTH := 1;
- REFERENCE_LINE_NUMBER := LINE_NUMBER;
- else
- REFERENCE_LINE_NUMBER := LINE_NUMBER;
- INDEX := 0;
- while (INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN <
- INPUT_FILES(FILE_LEVEL).CURRENT_LINE.LENGTH)
- and (((CH >= 'A') and (CH <= 'Z')) or (CH = '_') or
- ((CH >= '0') and (CH <= '9'))) loop
- INDEX := INDEX + 1;
- IDENTIFIER(INDEX) := CH;
- NEXT_CHARACTER(CH);
- if (INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN =
- INPUT_FILES(FILE_LEVEL).CURRENT_LINE.LENGTH)
- and (((CH >= 'A') and (CH <= 'Z')) OR
- ((CH >= '0') and (CH <= '9')) or (CH = '_')) then
- INDEX := INDEX + 1;
- IDENTIFIER(INDEX) := CH;
- end if;
- end loop;
- if INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN /=
- INPUT_FILES(FILE_LEVEL).CURRENT_LINE.LENGTH
- then
- INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN :=
- INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN - 1;
- end if;
- if INDEX > ID_LENGTH then
- LENGTH := ID_LENGTH;
- else
- LENGTH := INDEX;
- end if;
- end if;
- end if;
- ----------------------------------------------------------------------
- --A call to a proscribed package
- ----------------------------------------------------------------------
- TEXT_IO.PUT(CURRENT_EXCEPTION.NAME);
- ----------------------------------------------------------------------
- end NEXT_IDENTIFIER;
-
- ----------------------------------------------------------------------
- pragma MAIN;
- ----------------------------------------------------------------------
- ::::::::::
- test5.flw
- ::::::::::
- with CURRENT_EXCEPTION;
- This package is on the list of packages to be warned against.
-
- for MEDIUM'SIZE use 2*BYTE;
- This may be a non-transportable statement (Representation Specification).
-
- for COLOR use (RED => 5,BLUE => 10,YELLOW => 15);
- This may be a non-transportable statement (Representation Specification).
-
- pragma LIST(OFF);
- This line is not indented enough!
-
- pragma LIST(OFF);
- Transportability Note: Pragma.
-
- pragma LIST(ON);
- This line is not indented enough!
-
- pragma LIST(ON);
- Transportability Note: Pragma.
-
- pragma OPTIMIZE(SPACE);
- This line is not indented enough!
-
- pragma OPTIMIZE(SPACE);
- Transportability Note: Pragma.
-
- pragma PAGE;
- This line is not indented enough!
-
- pragma PAGE;
- Transportability Note: Pragma.
-
- WHILE not ((CH >= 'A') and (CH <= 'Z'))
- Reserve word WHILE should be in lower case
-
- if CH = '-' then -- look for comment indicator
- This structure should have preceeding blank lines to set it off.
-
- if CH = '-' then -- look for comment indicator
- This structure should have following blank lines to set it off.
-
- ----------------------------------------------------------------------------
- This line exceeds maximum line length
-
- --This is a long line to allow for the maximum parameter of the StyleChecker
- This line exceeds maximum line length
-
- ----------------------------------------------------------------------------
- This line exceeds maximum line length
-
- while ((CH >= '0' and CH <= '9') or (CH = 'E') OR (CH = '_')) and
- Reserve word OR should be in lower case
-
- WHILE (CH /= '#') and
- Reserve word WHILE should be in lower case
-
- if (CH = '#') then -- skip over based literals
- This structure should have preceeding blank lines to set it off.
-
- if (CH = '#') then -- skip over based literals
- This structure should have following blank lines to set it off.
-
- while ((CH >= '0' and CH <= '9') or (CH = 'E') OR (CH = '_')) and
- This structure should have preceeding blank lines to set it off.
-
- while ((CH >= '0' and CH <= '9') or (CH = 'E') OR (CH = '_')) and
- This structure should have following blank lines to set it off.
-
- while ((CH >= '0' and CH <= '9') or (CH = 'E') OR (CH = '_')) and
- This structure is large enough that it should have a loop-name!
-
- if (CH >= '0' and CH <= '9') then -- skip over literals
- This structure should have following blank lines to set it off.
-
- WHILE not ((CH >= 'A') and (CH <= 'Z'))
- This structure should have following blank lines to set it off.
-
- WHILE not ((CH >= 'A') and (CH <= 'Z'))
- This structure is large enough that it should have a loop-name!
-
- and (((CH >= 'A') and (CH <= 'Z')) OR
- Reserve word OR should be in lower case
-
- while (INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN <
- This structure should have preceeding blank lines to set it off.
-
- while (INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN <
- This structure should have following blank lines to set it off.
-
- while (INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN <
- This structure is large enough that it should have a loop-name!
-
- pragma MAIN;
- Transportability Note: Non-Standard Pragma!
-
- -----------------------------------------------------------------------
- Finish checking started in above statement. Total statements: 81
- ::::::::::
- test5.sty
- ::::::::::
- STYLE Report
- :USER1:POWERS:NOSC:NEWTEST5.ADA
-
- Naming Conventions
- --------------------------------------------------------------------------
- Invalid Case for an Object Identifier 0 Errors
- * Invalid Case for a Keyword 4 Errors
- Name Segment Size (Separated Desired <5 Characters
- * by Underscores) Actual 5.5 Characters
- Average Name Size Desired >5 Characters
- Actual 7.7 Characters
- --------------------------------------------------------------------------
-
- Physical Layout
- --------------------------------------------------------------------------
- Occurrences of More Than One Statement/Line 0 Errors
- * Inconsistant Indentation 4 Errors
- * Missing Blank Lines to Set Off a Block 9 Errors
- * Loops Without Names 3
- --------------------------------------------------------------------------
-
- Information Hiding, Abstraction, Data Use
- --------------------------------------------------------------------------
- Percent of Literals In Body Desired < 30.0%
- * Actual 84.0%
- Percent of Universal Types Desired < 40.0%
- Actual 20.0%
- ! Data Structuring Types NOT Used
- Array Types
- Record Types
- ! Ada-Specific Features NOT used
- OR ELSE
- EXITS
- XOR
- ELSIF
- EXCEPTION
- IN OUT parameters
- PRIVATEs
- --------------------------------------------------------------------------
-
- Modularity
- --------------------------------------------------------------------------
- Average Number of Parameters Range 0..4 Parameters
- Instances of parameters below minimum 0
- Instances of parameters above maximum 0
- Average Subprogram Size Range 10..200 Statements
- Instances of size below minimum 0
- Instances of size above maximum 0
- Loops with too many exit statements 0 Instances
- Control Structure Nesting Maximum 8
- Exceeded 0 Instances
- Package Nesting Maximum 2
- Exceeded 0 Instances
- Subprogram Nesting Maximum 4
- Exceeded 0 Instances
- --------------------------------------------------------------------------
-
- Comment Usage
- --------------------------------------------------------------------------
- Number of Comments 67 Comments
- Average Comment Size Desired >15 Characters
- Actual 47.1 Characters
- --------------------------------------------------------------------------
-
- Transportability
- --------------------------------------------------------------------------
- * Number of Lines Exceeding Line Length 3
- Address Clauses 0
- * Representation Specifications 2
- PRAGMA'S used:
- LIST
- LIST
- OPTIMIZE
- PAGE
- Non-Standard PRAGMA's Used
- MAIN
- Packages/Procedures WITHed
- CURRENT_EXCEPTION
- --------------------------------------------------------------------------
-
- * => Style Flaw ! => Note: Potential for improvement
-
- Keyword Usage
- Used Keyword Allowed Restriction Occurrences Percentage
- --------------------------------------------------------------------------
- IF yes 0.0% 22 17.6%
- IN yes 0.0% 1 0.8%
- IS yes 0.0% 3 2.4%
- OR yes 0.0% 6 4.8%
- AND yes 0.0% 16 12.8%
- END yes 0.0% 19 15.2%
- FOR yes 0.0% 3 2.4%
- NOT yes 0.0% 1 0.8%
- OUT yes 0.0% 3 2.4%
- USE yes 20.0% 2 1.6%
- ELSE yes 0.0% 3 2.4%
- LOOP yes 0.0% 14 11.2%
- THEN yes 0.0% 12 9.6%
- TYPE yes 0.0% 2 1.6%
- WITH yes 0.0% 2 1.6%
- BEGIN yes 0.0% 1 0.8%
- RANGE yes 0.0% 2 1.6%
- WHILE yes 0.0% 6 4.8%
- PRAGMA yes 0.0% 5 4.0%
- CONSTANT yes 0.0% 1 0.8%
- PROCEDURE yes 0.0% 1 0.8%
- --------------------------------------------------------------------------
- ::::::::::
- test6.ada
- ::::::::::
- -------------------------PROLOGUE---------------------------------------
- -- -*
- -- Unit name : push_file
- -- Author : Richard D. Powers
- -- Date created : 7-29-83
- -- Last update : 1-31-84
- -- -*
- ------------------------------------------------------------------------
- -- -*
- -- Abstract : This procedure handles the pragma include, opening
- ----------------: the include file and pointing current input to it.
- -- -*
- ------------------------------------------------------------------------
- -- -*
- -- Inputs : INPUT_FILES - global file record
- -- Outputs : INPUT_FILES - global file record
- -- Procedures called : NEXT_CHARACTER, FILE_IO.OPEN_INPUT_FILE,
- -- TEXT_IO.NEW_LINE, TEXT_IO.PUT
- -- Exceptions :
- -- -*
- ------------------------------------------------------------------------
- --
- -- Mnemonic :
- -- Name :
- -- Release date :
- ------------------ Revision history ------------------------------------
- --
- -- DATE AUTHOR HISTORY
- -- 1-31-84 R. Powers Open routines moved to own package
- --
- --
- --------------------END-PROLOGUE----------------------------------------
-
- procedure PUSH_FILE is
- CH : CHARACTER; -- read a character at a time
- FILE_NAME : STRING(1..MAX_LINE_LENGTH); -- name of new input file
- FILE_NAME_LENGTH : INTEGER range 0..MAX_LINE_LENGTH := 0;
- -- length of name
- OPENED : BOOLEAN; -- parameter to open_input_file
- begin
- for I in 1..FILE_NAME'LAST loop
- FILE_NAME(I) := ' ';
- end loop;
- NEXT_CHARACTER(CH);
- WHILE CH = ' ' loop
- NEXT_CHARACTER(CH);
- end loop;
- if CH /= '(' then
- TEXT_IO.PUT("ERROR IN PARSING PRAGMA INCLUDE - MISSING '('");
- TEXT_IO.NEW_LINE;
- else
- NEXT_CHARACTER(CH);
- while CH = ' ' loop
- NEXT_CHARACTER(CH);
- end loop;
- if (CH /= '"') then
- TEXT_IO.PUT("ERROR IN PARSING PRAGMA INCLUDE - MISSING '""'");
- TEXT_IO.NEW_LINE;
- else
- NEXT_CHARACTER(CH);
- while (CH /= '"') and
- (INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN <
- INPUT_FILES(FILE_LEVEL).CURRENT_LINE.LENGTH)
- loop
- FILE_NAME_LENGTH := FILE_NAME_LENGTH + 1;
- FILE_NAME(FILE_NAME_LENGTH) := CH;
- NEXT_CHARACTER(CH);
- end loop;
- -- include pragma appends file type of TXT if a period is not at end
- -- of file name, but open fails if we put the period on there!
- if FILE_NAME(FILE_NAME_LENGTH) = '.' then
- FILE_NAME_LENGTH := FILE_NAME_LENGTH - 1;
- end if;
- FILE_IO.OPEN_INPUT_FILE(INPUT_FILES(FILE_LEVEL + 1).FILE,
- OPENED, FILE_NAME, FILE_NAME_LENGTH);
- if not OPENED then
- TEXT_IO.PUT("ERROR IN OPENING INCLUDE FILE");
- TEXT_IO.NEW_LINE;
- else
- FILE_LEVEL := FILE_LEVEL + 1;
- INPUT_FILES(FILE_LEVEL).CURRENT_LINE.LENGTH := 0;
- INPUT_FILES(FILE_LEVEL).CURRENT_LINE.COLUMN := 0;
- end if;
- end if;
- end if;
- end PUSH_FILE;
- ::::::::::
- test6.flw
- ::::::::::
- WHILE CH = ' ' loop
- Reserve word WHILE should be in lower case
-
- if not OPENED then
- This structure should have preceeding blank lines to set it off.
-
- if not OPENED then
- This structure should have following blank lines to set it off.
-
- if (CH /= '"') then
- This structure should have preceeding blank lines to set it off.
-
- if (CH /= '"') then
- This structure should have following blank lines to set it off.
-
- if CH /= '(' then
- This structure should have preceeding blank lines to set it off.
-
- if CH /= '(' then
- This structure should have following blank lines to set it off.
-
- procedure PUSH_FILE is
- This structure should have following blank lines to set it off.
-
- -------------------------PROLOGUE---------------------------------------
- Finish checking started in above statement. Total statements: 43
- ::::::::::
- test6.sty
- ::::::::::
- STYLE Report
- :USER1:POWERS:NOSC:TEST6.ADA
-
- Naming Conventions
- --------------------------------------------------------------------------
- Invalid Case for an Object Identifier 0 Errors
- * Invalid Case for a Keyword 1 Error
- Name Segment Size (Separated Desired <5 Characters
- by Underscores) Actual 4.7 Characters
- Average Name Size Desired >5 Characters
- Actual 8.1 Characters
- --------------------------------------------------------------------------
-
- Physical Layout
- --------------------------------------------------------------------------
- Occurrences of More Than One Statement/Line 0 Errors
- Inconsistant Indentation 0 Errors
- * Missing Blank Lines to Set Off a Block 4 Errors
- Loops Without Names 0
- --------------------------------------------------------------------------
-
- Information Hiding, Abstraction, Data Use
- --------------------------------------------------------------------------
- Percent of Literals In Body Desired < 30.0%
- * Actual 85.7%
- Percent of Universal Types Desired < 40.0%
- Actual 25.0%
- ! Data Structuring Types NOT Used
- Array Types
- Enumeration Types
- Record Types
- ! Ada-Specific Features NOT used
- AND THEN
- OR ELSE
- EXITS
- XOR
- ELSIF
- EXCEPTION
- OUT parameters
- IN OUT parameters
- PRIVATEs
- --------------------------------------------------------------------------
-
- Modularity
- --------------------------------------------------------------------------
- Average Number of Parameters Range 0..4 Parameters
- Instances of parameters below minimum 0
- Instances of parameters above maximum 0
- Average Subprogram Size Range 10..200 Statements
- Instances of size below minimum 0
- Instances of size above maximum 0
- Loops with too many exit statements 0 Instances
- Control Structure Nesting Maximum 8
- Exceeded 0 Instances
- Package Nesting Maximum 2
- Exceeded 0 Instances
- Subprogram Nesting Maximum 4
- Exceeded 0 Instances
- --------------------------------------------------------------------------
-
- Comment Usage
- --------------------------------------------------------------------------
- Number of Comments 38 Comments
- Average Comment Size Desired >15 Characters
- Actual 44.9 Characters
- --------------------------------------------------------------------------
-
- Transportability
- --------------------------------------------------------------------------
- Number of Lines Exceeding Line Length 0
- Address Clauses 0
- Representation Specifications 0
- PRAGMA'S used:
- Non-Standard PRAGMA's Used
- Packages/Procedures WITHed
- --------------------------------------------------------------------------
-
- * => Style Flaw ! => Note: Potential for improvement
-
- Keyword Usage
- Used Keyword Allowed Restriction Occurrences Percentage
- --------------------------------------------------------------------------
- IF yes 0.0% 8 18.6%
- IN yes 0.0% 1 2.3%
- IS yes 0.0% 1 2.3%
- AND yes 0.0% 1 2.3%
- END yes 0.0% 9 20.9%
- FOR yes 0.0% 1 2.3%
- NOT yes 0.0% 1 2.3%
- ELSE yes 0.0% 3 7.0%
- LOOP yes 0.0% 8 18.6%
- THEN yes 0.0% 4 9.3%
- BEGIN yes 0.0% 1 2.3%
- RANGE yes 0.0% 1 2.3%
- WHILE yes 0.0% 3 7.0%
- PROCEDURE yes 0.0% 1 2.3%
- --------------------------------------------------------------------------
- ::::::::::
- test7.ada
- ::::::::::
- -- Ada Style Checker Test program
- with TEXT_IO; use TEXT_IO;
- with SYSTEM;
- with UNCHECKED_DEALLOCATION;
- PRAGMA OPTIMIZE;
- pragma STUPID_PRAGMA;
-
- PROcedure ADATEST is
- type X is record
- dum1 : integer;
- DUM2 : positive;
- end record;
- ~ %
- begIn
- PUT("Test Program"); -- try some
- NEW_LINE; -- trailing
- X := CALL; -- lkjkljlk
- x := "Line too little indented!"; -- kjljkl
- LONGVARIABLENAMEWITHOUTUNDERCORES := "Line too far indented.";
- END ADATEST;
- ::::::::::
- test7.flw
- ::::::::::
- with TEXT_IO; use TEXT_IO;
- There are more than one statements on this line!
-
- with SYSTEM;
- This package is on the list of packages to be warned against.
-
- with UNCHECKED_DEALLOCATION;
- This package is on the list of packages to be warned against.
-
- PRAGMA OPTIMIZE;
- Reserve word PRAGMA should be in lower case
-
- PRAGMA OPTIMIZE;
- Transportability Note: Pragma.
-
- pragma STUPID_PRAGMA;
- Transportability Note: Non-Standard Pragma!
-
- PROcedure ADATEST is
- Reserve word PROcedure should be in lower case
-
- PROcedure ADATEST is
- The number of parameters is BELOW the set limit!
-
- dum1 : integer;
- Object name dum1 should be in upper case
-
- dum1 : integer;
- Object name integer should be in upper case
-
- DUM2 : positive;
- Object name positive should be in upper case
-
- ~ %
- Illegal character in this line
-
- ~ %
- Illegal character in this line
-
- begIn
- Reserve word begIn should be in lower case
-
- x := "Line too little indented!"; -- kjljkl
- This line is not indented enough!
-
- x := "Line too little indented!"; -- kjljkl
- Object name x should be in upper case
-
- LONGVARIABLENAMEWITHOUTUNDERCORES := "Line too far indented.";
- This line should be indented to column: 5
-
- END ADATEST;
- Reserve word END should be in lower case
-
- PROcedure ADATEST is
- This loop should have preceeding blank lines to set it off.
-
- PROcedure ADATEST is
- This loop should have following blank lines to set it off.
-
- -- Ada Style Checker Test program
- Finish checking started in above statement. Total statements: 18
- ::::::::::
- test7.sty
- ::::::::::
- STYLE Report
- NAME????????
-
- Naming Conventions
- --------------------------------------------------------------------------
- * Invalid Case for an Object Identifier 4 Errors
- * Invalid Case for a Keyword 4 Errors
- Name Segment Size (Separated Desired <5 Characters
- by Underscores) Actual 5.0 Characters
- Average Name Size Desired >5 Characters
- Actual 9.0 Characters
- --------------------------------------------------------------------------
-
- Physical Layout
- --------------------------------------------------------------------------
- * Occurrences of More Than One Statement/Line 1 Error
- * Inconsistant Indentation 2 Errors
- * Missing Blank Lines to Set Off a Block 1 Error
- Loops Without Names 0
- --------------------------------------------------------------------------
-
- Information Hiding, Abstraction, Data Use
- --------------------------------------------------------------------------
- Percent of Literals In Body Desired < 10.0%
- * Actual 100.0%
- Percent of Universal Types Desired < 40.0%
- * Actual 66.7%
- ! Data Structuring Types NOT Used
- Array Types
- Enumeration Types
- ! No Attributes are Used
- --------------------------------------------------------------------------
-
- Modularity
- --------------------------------------------------------------------------
- Average Number of Parameters Range 1..8 Parameters
- * Instances of parameters below minimum 1
- Instances of parameters above maximum 0
- Average Subprogram Size Range 10..200 Statements
- Instances of size below minimum 0
- Instances of size above maximum 0
- Loops with too many exit statements 0 Instances
- Control Structure Nesting Maximum 8
- Exceeded 0 Instances
- Package Nesting Maximum 2
- Exceeded 0 Instances
- Subprogram Nesting Maximum 4
- Exceeded 0 Instances
- --------------------------------------------------------------------------
-
- Comment Usage
- --------------------------------------------------------------------------
- Number of Comments 5 Comments
- Average Comment Size Desired >15 Characters
- * Actual 14.0 Characters
- --------------------------------------------------------------------------
-
- Transportability
- --------------------------------------------------------------------------
- Number of Lines Exceeding Line Length 0
- Address Clauses 0
- Representation Specifications 0
- PRAGMA'S used:
- OPTIMIZE
- Non-Standard PRAGMA's Used
- STUPID_PRAGMA
- Packages/Procedures WITHed
- SYSTEM
- UNCHECKED_DEALLOCATION
- --------------------------------------------------------------------------
-
- * => Style Flaw ! => Note: Potential for improvement
-
- Keyword Usage
- Used Keyword Allowed Restriction Occurrences Percentage
- --------------------------------------------------------------------------
- AT yes 0.0% 0 0.0%
- DO yes 0.0% 0 0.0%
- IF yes 0.0% 0 0.0%
- IN yes 0.0% 0 0.0%
- IS yes 0.0% 2 13.3%
- OF yes 0.0% 0 0.0%
- OR yes 0.0% 0 0.0%
- ABS yes 0.0% 0 0.0%
- ALL yes 0.0% 0 0.0%
- AND yes 0.0% 0 0.0%
- END yes 0.0% 2 13.3%
- FOR yes 0.0% 0 0.0%
- MOD yes 0.0% 0 0.0%
- NEW yes 0.0% 0 0.0%
- NOT yes 0.0% 0 0.0%
- OUT yes 0.0% 0 0.0%
- REM yes 0.0% 0 0.0%
- USE yes 20.0% 1 6.7%
- XOR yes 0.0% 0 0.0%
- BODY yes 0.0% 0 0.0%
- CASE yes 0.0% 0 0.0%
- ELSE yes 0.0% 0 0.0%
- EXIT yes 0.0% 0 0.0%
- GOTO yes 5.0% 0 0.0%
- LOOP yes 0.0% 0 0.0%
- NULL yes 0.0% 0 0.0%
- TASK yes 0.0% 0 0.0%
- THEN yes 0.0% 0 0.0%
- TYPE yes 0.0% 1 6.7%
- WHEN yes 0.0% 0 0.0%
- WITH yes 0.0% 3 20.0%
- ABORT yes 0.0% 0 0.0%
- ARRAY yes 0.0% 0 0.0%
- BEGIN yes 0.0% 1 6.7%
- DELAY yes 0.0% 0 0.0%
- DELTA yes 0.0% 0 0.0%
- ELSIF yes 0.0% 0 0.0%
- ENTRY yes 0.0% 0 0.0%
- RAISE yes 0.0% 0 0.0%
- RANGE yes 0.0% 0 0.0%
- WHILE yes 0.0% 0 0.0%
- ACCEPT yes 0.0% 0 0.0%
- ACCESS yes 0.0% 0 0.0%
- DIGITS yes 0.0% 0 0.0%
- OTHERS yes 0.0% 0 0.0%
- PRAGMA yes 0.0% 2 13.3%
- RECORD yes 0.0% 2 13.3%
- RETURN yes 0.0% 0 0.0%
- SELECT yes 0.0% 0 0.0%
- DECLARE yes 0.0% 0 0.0%
- GENERIC yes 0.0% 0 0.0%
- LIMITED yes 0.0% 0 0.0%
- PACKAGE yes 0.0% 0 0.0%
- PRIVATE yes 0.0% 0 0.0%
- RENAMES yes 0.0% 0 0.0%
- REVERSE yes 0.0% 0 0.0%
- SUBTYPE yes 0.0% 0 0.0%
- CONSTANT yes 0.0% 0 0.0%
- FUNCTION yes 0.0% 0 0.0%
- SEPARATE yes 0.0% 0 0.0%
- EXCEPTION yes 0.0% 0 0.0%
- PROCEDURE yes 0.0% 1 6.7%
- TERMINATE yes 0.0% 0 0.0%
- --------------------------------------------------------------------------
-
- ::::::::::
- testplan.doc
- ::::::::::
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- CHAPTER 1
-
-
-
- INTRODUCTION
-
-
-
-
-
-
-
- 1.1 PURPOSE
-
-
-
- This Computer Program Test Plan describes the test activities for the
-
- Coding Style Standards Checker computer program. This research and
-
- development is being done for the Naval Ocean Systems Center (NOSC)
-
- under contract N66001-84-R-0030. The Coding Standards Checker is a
-
- general-purpose Ada Coding Style Standards checker that operates on an
-
- existing Ada source file to check software for conformance to the coding
-
- standard.
-
-
-
- The Style Checker Computer Program Test Plan (SCCPTP) has been
-
- prepared in accordance with [NAV78A].
-
-
-
- 1.2 SCOPE
-
-
-
- SCCPTP describes the testing activities that will be conducted during
-
- the development phase of style checker.
-
-
-
- 1.3 SUMMARY
-
-
-
- The objective of the SCCPTP is to successfully define all the testing
-
- activities that are necessary to ensure that the developing standard
-
- checker program meets the requirements of the Proposal to Design and
-
- Implement a Standards Checker in Ada [TI84A]. Testing will be conducted
-
- in two independent and sequential activities:
-
-
-
- 1. Unit Testing - Execution of a series of tests on individual
-
- modules or groups of modules.
-
-
-
- 2. Program Testing - Execution of a series of defined tests on the
-
- integrated version of the standards checker to validate its
-
- performance against the requirements defined in the Proposal
-
- [TI84A].
-
-
-
- When all unit testing is successfully completed, program testing will be
-
- conducted to complete the testing activity.
-
- INTRODUCTION Page 1-2
-
-
-
-
-
- 1.4 SCHEDULE
-
-
-
- Unit testing will be performed as an integral part of implementation and
-
- is therefore dependent upon that schedule. Program testing will be
-
- performed after implementation.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- CHAPTER 2
-
-
-
- APPLICABLE DOCUMENTS
-
-
-
-
-
-
-
- 2.1 GOVERNMENT DOCUMENTS
-
-
-
- The following documents of the exact issue shown form a part of this
-
- specification to the extent specified herein. In the event of conflict
-
- between the documents referenced and the contents of this specification,
-
- the contents of this specification will be considered a superceding
-
- requirement.
-
-
-
-
-
- [NAV78A] Navy, "Data Item Description, Computer Program Test
-
- Plan", Navy DI-T-2142, 29 November 1978.
-
-
-
- [NAV78B] Navy, "Data Item Description, Computer Program Test
-
- Report", Navy DI-T-2156, 29 November 1978.
-
-
-
- [TI84A ] Texas Instruments, " Proposal to Design and Implement
-
- an Ada Style Standards Checking Tool", Prepared for
-
- Naval Ocean Systems Center (NOSC) under contract
-
- #N66001-84-R-0030, 13 January 1984.
-
-
-
- [TI84B ] Texas Instruments, " Software Development Plan for an
-
- Interactive Spelling Checker in Ada", Prepared for
-
- Naval Ocean Systems Center (NOSC) under contract
-
- #N66001-84-R-0030, 21 August 1984.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- CHAPTER 3
-
-
-
- TESTING REQUIREMENTS
-
-
-
-
-
-
-
- 3.1 GENERAL
-
-
-
- The style checker will be tested as an integral part of the software
-
- development process by first testing the individual parts in unit
-
- testing and then testing the integrated whole in program testing. The
-
- software development process to follow in implementation is described
-
- below :
-
-
-
- 1. Engineer fetches a local copy of the module that they are to
-
- develop from the master TxtLib directory.
-
-
-
- 2. Engineer fetches a local copy of the modules needed to develop
-
- a test harness for the module under development.
-
-
-
- 3. Engineer develops the module and test harnesses.
-
-
-
- 4. Code walk through and review.
-
-
-
- 5. The corrections and comments are incorporated from review and
-
- walk through. Steps 4 and 5 are repeated as necessary.
-
-
-
- 6. Module source goes into master TxtLib directory.
-
-
-
- 7. Test harness modules are placed in the test harness TxtLib
-
- directory with a new variant name.
-
-
-
- 8. Documentation changes are noted in detail and sent to the
-
- engineer responsible for logging.
-
-
-
- Where a test harness is defined as a module (package, task, procedure,
-
- etc) used to test another package, task, procedure, etc. Typically
-
- these take the form of stubbed procedures, functions, tasks, etc.
-
- within existing packages.
-
-
-
- There are three types of TxtLib directories:
-
-
-
- 1. the engineer's local TxtLib directory,
-
- TESTING REQUIREMENTS Page 3-2
-
-
-
-
-
- 2. the master source TxtLib directory, and
-
-
-
- 3. the test harness TxtLib directory.
-
-
-
- Each engineer has a local TxtLib directory used to develop packages,
-
- procedures, etc. and to keep notes in. Eligible information for the
-
- engineer's local TxtLib directory include:
-
-
-
- 1. modules under development (and completed)
-
-
-
- 2. test harnesses under development (and completed), and
-
-
-
- 3. notes including:
-
-
-
- 1. test harness procedures,
-
-
-
- 2. documentation changes, and
-
-
-
- 3. integration information.
-
-
-
-
-
- The master source TxtLib directory contains the Style Checker source in
-
- its debugged form. Each debugged module is inserted into a revision
-
- with a name according to the naming conventions below. This name
-
- matches the revision name of the revision that the test harness modules
-
- are placed into in the test harness TxtLib directory.
-
-
-
- The test harness TxtLib directory contains the test harnesses used
-
- to test the modules contained in the master source TxtLib directory.
-
- The modules inserted into this directory should be placed into a
-
- revision whose name matches the name of the revision that the debugged
-
- module in the master source TxtLib directory has.
-
-
-
- When inserting modules into the master TxtLib directory and the
-
- test harness TxtLib directory, the revision names will be formed using
-
- the revision name format "major.minor" where major and minor are
-
- integers between 0 and 999. "0.1" is the initial revision name,
-
- followed by "0.2", "0.3", etc. until the time of release when the
-
- revision name will be formed as "1.0".
-
-
-
- The test activities described below are designed to ensure that
-
- Spell satisfies the requirements identified in the Proposal [TI84A ].
-
- Unit testing will be conducted by the software engineer responsible for
-
- each unit's implementation. Upon completion of unit testing, program
-
- testing will be conducted by the engineer. During program testing, each
-
- requirement of the Proposal [TI84A] will be demonstrated as being met.
-
-
-
- 3.2 UNIT TESTING
-
-
-
- Unit testing will be performed to ensure that the details of the Style
-
- Checker are implemented according to the Style Checker design. A unit
-
- test is the demonstration of the performance of a segment of code.
-
- TESTING REQUIREMENTS Page 3-3
-
-
-
-
-
- 3.3 PROGRAM TESTING
-
-
-
- Program testing will be performed to validate the performance of the
-
- Style Checker against the Proposal [TI84A ]. Program testing treats the
-
- Style Checker as a black box and thereby complements unit testing which
-
- tests the detailed internals of the black box. Unit testing will be
-
- completed before program testing begins.
-
-
-
- Each requirement, as referenced in the Software Development Plan
-
- [TI84B ], will be tested by at least one program test procedure. A test
-
- matrix with one column for each requirement and one row for each program
-
- test procedure, will be maintained to show progress and completeness in
-
- testing.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- CHAPTER 4
-
-
-
- PERSONNEL REQUIREMENTS
-
-
-
-
-
-
-
- The testing of the Style Checker will be the responsibility of the Style
-
- Checker development team. The team is composed of two software
-
- engineers and personnel from Quality Assurance and Software
-
- Configuration Management organizations.
-
-
-
- The responsibilities of the software engineers are to:
-
-
-
- 1. prepare and conduct the unit tests,
-
-
-
- 2. prepare and conduct the program tests,
-
-
-
- 3. maintain a program test matrix, and
-
-
-
- 4. write an internal test report.
-
-
-
-
-
- The responsibilities of the Quality Assurance and Configuration
-
- Management personnel are to:
-
-
-
- 1. verify that the execution of each test is in accordance with
-
- the test procedures, that the test data satisfy the acceptance
-
- criteria, and that the documentation of each test is complete,
-
- and
-
-
-
- 2. maintain configuration control of all software undergoing test.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- CHAPTER 5
-
-
-
- TEST REPORT
-
-
-
-
-
-
-
- Internal documentation of the results of test activities will be
-
- maintained at TI. This internal Test Report will use [NAV78B] as a
-
- guide.
-
-