FOSSology  4.7.1
Open Source License Compliance by Open Source Software
scannerTestSuite Class Reference
Inheritance diagram for scannerTestSuite:
Inheritance graph
Collaboration diagram for scannerTestSuite:
Collaboration graph

Protected Member Functions

void copyscannerTest ()
 Test copyright scanner. More...
 
void copyscannerDotPrefixedNameTest ()
 Test copyright scanner with dot-prefixed names like .NET Foundation. More...
 
void copyscannerBareKeywordDiscardTest ()
 Test that bare copyright keywords produce no matches. More...
 
void copyscannerCopyrightedStatementTest ()
 Regression: "copyrighted" statements and names like "Tom" must not be falsely deactivated by REG_EXCEPTION_COPY. More...
 
void copyscannerBinaryNoiseTest ()
 Regression: binary-file content with a short ASCII prefix before non-ASCII bytes must not be reported as active copyright statements. More...
 
void copyscannerSpdxArrayTest ()
 Regression: SPDX-FileCopyrightText = [...] TOML array format must yield one active match per quoted element, not a single merged string. More...
 
void copyscannerSpdxFullLineTest ()
 Regression: SPDX-FileCopyrightText entries must be detected as individual single-line statements and their match range must cover the full line in the original content. More...
 
void copyscannerProseExceptionTest ()
 Regression: license-prose strings that contain "copyright" as a common noun must be deactivated, not stored as active findings. More...
 
void regAuthorTest ()
 Test copyright scanner for author. More...
 
void regIpraTest ()
 Test Ipra scanner. More...
 
void regEccTest ()
 Test ECC scanner. More...
 
void regUrlTest ()
 Test copyright scanner for URL. More...
 
void regEmailTest ()
 Test copyright scanner for email. More...
 
void regKeywordTest ()
 Test copyright scanner for keywords. More...
 
void cleanEntries ()
 Test cleanMatch() to remove non-UTF8 text and extra spaces. More...
 
void spdxContentTest ()
 Test ojo on content with SPDX license. More...
 
void nonSpdxContentTest ()
 Test ojo on content without SPDX license. More...
 
void multiSpdxContentTest ()
 Test ojo on content with multiple SPDX license. More...
 

Private Member Functions

 CPPUNIT_TEST_SUITE (scannerTestSuite)
 
 CPPUNIT_TEST (copyscannerTest)
 
 CPPUNIT_TEST (copyscannerDotPrefixedNameTest)
 
 CPPUNIT_TEST (copyscannerBareKeywordDiscardTest)
 
 CPPUNIT_TEST (copyscannerCopyrightedStatementTest)
 
 CPPUNIT_TEST (copyscannerBinaryNoiseTest)
 
 CPPUNIT_TEST (copyscannerSpdxFullLineTest)
 
 CPPUNIT_TEST (copyscannerSpdxArrayTest)
 
 CPPUNIT_TEST (copyscannerProseExceptionTest)
 
 CPPUNIT_TEST (regAuthorTest)
 
 CPPUNIT_TEST (regIpraTest)
 
 CPPUNIT_TEST (regEccTest)
 
 CPPUNIT_TEST (regUrlTest)
 
 CPPUNIT_TEST (regEmailTest)
 
 CPPUNIT_TEST (regKeywordTest)
 
 CPPUNIT_TEST (cleanEntries)
 
 CPPUNIT_TEST_SUITE_END ()
 
void scannerTest (const scanner &sc, const char *content, const string &type, list< const char * > expectedStrings)
 Runs scanner on content and check matches against expectedStrings. More...
 
 CPPUNIT_TEST_SUITE (scannerTestSuite)
 
 CPPUNIT_TEST (spdxContentTest)
 
 CPPUNIT_TEST (nonSpdxContentTest)
 
 CPPUNIT_TEST (multiSpdxContentTest)
 
 CPPUNIT_TEST_SUITE_END ()
 
void scannerTest (const string &content, vector< string > expectedStrings)
 Runs a scan on content and check matches against expectedStrings. More...
 

Detailed Description

Definition at line 58 of file test_scanners.cc.

Member Function Documentation

◆ cleanEntries()

void scannerTestSuite::cleanEntries ( )
inlineprotected

Test cleanMatch() to remove non-UTF8 text and extra spaces.

Test:
  1. Load test data and expected data
  2. Generate matches to clean each line in the file
  3. Call cleanMatch() to clean each line
  4. Check if cleaned test data matches expected data

Definition at line 510 of file test_scanners.cc.

◆ copyscannerBareKeywordDiscardTest()

void scannerTestSuite::copyscannerBareKeywordDiscardTest ( )
inlineprotected

Test that bare copyright keywords produce no matches.

Test:

Definition at line 154 of file test_scanners.cc.

◆ copyscannerBinaryNoiseTest()

void scannerTestSuite::copyscannerBinaryNoiseTest ( )
inlineprotected

Regression: binary-file content with a short ASCII prefix before non-ASCII bytes must not be reported as active copyright statements.

Test:

Definition at line 230 of file test_scanners.cc.

◆ copyscannerCopyrightedStatementTest()

void scannerTestSuite::copyscannerCopyrightedStatementTest ( )
inlineprotected

Regression: "copyrighted" statements and names like "Tom" must not be falsely deactivated by REG_EXCEPTION_COPY.

Test:

Definition at line 197 of file test_scanners.cc.

◆ copyscannerDotPrefixedNameTest()

void scannerTestSuite::copyscannerDotPrefixedNameTest ( )
inlineprotected

Test copyright scanner with dot-prefixed names like .NET Foundation.

Test:

Definition at line 131 of file test_scanners.cc.

◆ copyscannerProseExceptionTest()

void scannerTestSuite::copyscannerProseExceptionTest ( )
inlineprotected

Regression: license-prose strings that contain "copyright" as a common noun must be deactivated, not stored as active findings.

Test:
Covers five false-positive categories found in the atarashi test corpus:
  • "copyrights appearing in" (verb-follow — appear\w* fix)
  • "COPYRIGHT TO DETECT" (new keyword: to)
  • "copyright work" (new keyword: work)
  • "copyright protection" (new keyword: protection)
  • "copyrighted interfaces" (new keyword: interfaces?)
  • "copyright in/of/on X" (new keywords: in, of, on) Legitimate copyright statements with year or symbol must still be KEPT.

Definition at line 377 of file test_scanners.cc.

◆ copyscannerSpdxArrayTest()

void scannerTestSuite::copyscannerSpdxArrayTest ( )
inlineprotected

Regression: SPDX-FileCopyrightText = [...] TOML array format must yield one active match per quoted element, not a single merged string.

Test:

Definition at line 267 of file test_scanners.cc.

◆ copyscannerSpdxFullLineTest()

void scannerTestSuite::copyscannerSpdxFullLineTest ( )
inlineprotected

Regression: SPDX-FileCopyrightText entries must be detected as individual single-line statements and their match range must cover the full line in the original content.

Test:

Definition at line 323 of file test_scanners.cc.

◆ copyscannerTest()

void scannerTestSuite::copyscannerTest ( )
inlineprotected

Test copyright scanner.

Test:
  1. Create a copyright scanner
  2. Load test data and expected data
  3. Test using scannerTest()

Definition at line 113 of file test_scanners.cc.

◆ multiSpdxContentTest()

void scannerTestSuite::multiSpdxContentTest ( )
inlineprotected

Test ojo on content with multiple SPDX license.

Test:
  1. Create an OjoAgent object
  2. Load test data with multiple SPDX license and expected data
  3. Test using scannerTest()

Definition at line 160 of file test_scanners.cc.

◆ nonSpdxContentTest()

void scannerTestSuite::nonSpdxContentTest ( )
inlineprotected

Test ojo on content without SPDX license.

Test:
  1. Create an OjoAgent object
  2. Load test data without SPDX license and expected data
  3. Test using scannerTest()

Definition at line 148 of file test_scanners.cc.

◆ regAuthorTest()

void scannerTestSuite::regAuthorTest ( )
inlineprotected

Test copyright scanner for author.

Test:
  1. Create a author scanner
  2. Load test data and expected data
  3. Test using scannerTest()

Definition at line 429 of file test_scanners.cc.

◆ regEccTest()

void scannerTestSuite::regEccTest ( )
inlineprotected

Test ECC scanner.

Test:
  1. Create a ECC scanner
  2. Load test data and expected data
  3. Test using scannerTest()

Definition at line 461 of file test_scanners.cc.

◆ regEmailTest()

void scannerTestSuite::regEmailTest ( )
inlineprotected

Test copyright scanner for email.

Test:
  1. Create a email scanner
  2. Load test data and expected data
  3. Test using scannerTest()

Definition at line 485 of file test_scanners.cc.

◆ regIpraTest()

void scannerTestSuite::regIpraTest ( )
inlineprotected

Test Ipra scanner.

Test:
  1. Create a Ipra scanner
  2. Load test data and expected data
  3. Test using scannerTest()

Definition at line 449 of file test_scanners.cc.

◆ regKeywordTest()

void scannerTestSuite::regKeywordTest ( )
inlineprotected

Test copyright scanner for keywords.

Test:
  1. Create a keyword scanner
  2. Load test data and expected data
  3. Test using scannerTest()

Definition at line 497 of file test_scanners.cc.

◆ regUrlTest()

void scannerTestSuite::regUrlTest ( )
inlineprotected

Test copyright scanner for URL.

Test:
  1. Create a URL scanner
  2. Load test data and expected data
  3. Test using scannerTest()

Definition at line 473 of file test_scanners.cc.

◆ scannerTest() [1/2]

void scannerTestSuite::scannerTest ( const scanner sc,
const char *  content,
const string &  type,
list< const char * >  expectedStrings 
)
inlineprivate

Runs scanner on content and check matches against expectedStrings.

Parameters
scScanner to use
contentContent to scan
typeMatch type
expectedStringsExpected strings from scanner result

Definition at line 86 of file test_scanners.cc.

◆ scannerTest() [2/2]

void scannerTestSuite::scannerTest ( const string &  content,
vector< string >  expectedStrings 
)
inlineprivate

Runs a scan on content and check matches against expectedStrings.

Parameters
contentContent to scan
expectedStringsExpected strings from scanner result

Definition at line 104 of file test_scanners.cc.

◆ spdxContentTest()

void scannerTestSuite::spdxContentTest ( )
inlineprotected

Test ojo on content with SPDX license.

Test:
  1. Create an OjoAgent object
  2. Load test data and expected data
  3. Test using scannerTest()

Definition at line 136 of file test_scanners.cc.


The documentation for this class was generated from the following file: