FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
OneShot-bsd.php
Go to the documentation of this file.
1 <?php
2 /***********************************************************
3  Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
4  Copyright (C) 2015 Siemens AG
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License
8  version 2 as published by the Free Software Foundation.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License along
16  with this program; if not, write to the Free Software Foundation, Inc.,
17  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  ***********************************************************/
23 require_once ('CommonCliTest.php');
24 
30 {
35  public $bsd;
36 
44  function testOneShotBsd()
45  {
46  $this->bsd = dirname(dirname(dirname(dirname(__FILE__)))).'/testing/dataFiles/TestData/licenses/BSD_style_d.txt';
47  $this->assertFileExists($this->bsd,"OneShotbsdTest FAILURE! $this->bsd not found\n");
48  list($output,) = $this->runNomos("",array($this->bsd));
49  $bsdlic = "BSD-3-Clause";
50  list(,$fname,,,$license) = explode(' ', $output);
51  $this->assertEquals($fname, 'BSD_style_d.txt', "Error filename $fname does not equal BSD_style_d.txt");
52  $this->assertEquals(trim($license), $bsdlic);
53  }
54 
63  {
64  $this->bsd = dirname(dirname(dirname(dirname(__FILE__)))).'/testing/dataFiles/TestData/licenses/DNSDigest.c';
65  $this->assertFileExists($this->bsd,"OneShotbsdTest FAILURE! $this->bsd not found\n");
66  list($output,) = $this->runNomos("",array($this->bsd));
67  $bsdlic = "Apache-2.0,BSD-style,GPL";
68  list(,$fname,,,$license) = explode(' ', $output);
69  $this->assertEquals($fname, 'DNSDigest.c', "Error filename $fname does not equal DNSDigest.c");
70  $this->assertEquals(trim($license), $bsdlic);
71  }
72 }
Perform a one-shot license analysis on a file (include bsd license)
Definition: OneShot-bsd.php:29
testOneShotBsd()
Run NOMOS on BSD style license.
Definition: OneShot-bsd.php:44
runNomos($args="", $files=array())
Run nomos using the arguments passed.
Tests for common CLI operations.
testOneShotDnsdigest()
Run NOMOS on DNS digest.
Definition: OneShot-bsd.php:62
list_t type structure used to keep various lists. (e.g. there are multiple lists).
Definition: nomos.h:321
char * trim(char *ptext)
Trimming whitespace.
Definition: fossconfig.c:695