FOSSology  4.4.0
Open Source License Compliance by Open Source Software
OneShot-bsd.php
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2012 Hewlett-Packard Development Company, L.P.
4  SPDX-FileCopyrightText: © 2015 Siemens AG
5 
6  SPDX-License-Identifier: GPL-2.0-only
7 */
8 require_once ('CommonCliTest.php');
9 
15 {
20  public $bsd;
21 
29  function testOneShotBsd()
30  {
31  $this->bsd = dirname(dirname(dirname(dirname(__FILE__)))).'/testing/dataFiles/TestData/licenses/BSD_style_d.txt';
32  $this->assertFileExists($this->bsd,"OneShotbsdTest FAILURE! $this->bsd not found\n");
33  list($output,) = $this->runNomos("",array($this->bsd));
34  $bsdlic = "BSD-3-Clause";
35  list(,$fname,,,$license) = explode(' ', $output);
36  $this->assertEquals($fname, 'BSD_style_d.txt', "Error filename $fname does not equal BSD_style_d.txt");
37  $this->assertEquals(trim($license), $bsdlic);
38  }
39 
48  {
49  $this->bsd = dirname(dirname(dirname(dirname(__FILE__)))).'/testing/dataFiles/TestData/licenses/DNSDigest.c';
50  $this->assertFileExists($this->bsd,"OneShotbsdTest FAILURE! $this->bsd not found\n");
51  list($output,) = $this->runNomos("",array($this->bsd));
52  $bsdlic = "Apache-2.0,BSD-style,GPL";
53  list(,$fname,,,$license) = explode(' ', $output);
54  $this->assertEquals($fname, 'DNSDigest.c', "Error filename $fname does not equal DNSDigest.c");
55  $this->assertEquals(trim($license), $bsdlic);
56  }
57 }
Tests for common CLI operations.
runNomos($args="", $files=array())
Run nomos using the arguments passed.
Perform a one-shot license analysis on a file (include bsd license)
Definition: OneShot-bsd.php:15
testOneShotBsd()
Run NOMOS on BSD style license.
Definition: OneShot-bsd.php:29
testOneShotDnsdigest()
Run NOMOS on DNS digest.
Definition: OneShot-bsd.php:47
char * trim(char *ptext)
Trimming whitespace.
Definition: fossconfig.c:690
list_t type structure used to keep various lists. (e.g. there are multiple lists).
Definition: nomos.h:308