This file is indexed.

/usr/include/ept/popcon/local.test.h is in libept-dev 1.0.6~exp1ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
// -*- mode: c++; tab-width: 4; indent-tabs-mode: t -*-
/*
 * popcon/local test
 *
 * Copyright (C) 2007  Enrico Zini <enrico@debian.org>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include <ept/popcon/local.h>
#include <ept/popcon/popcon.h>
#include <ept/popcon/maint/path.h>

#include <ept/test.h>

using namespace std;
using namespace ept;
using namespace ept::popcon;

struct TestPopconLocal
{
	Path::OverridePopconSourceDir odsd;
	Path::OverridePopconIndexDir odid;
	Path::OverridePopconUserSourceDir odusd;
	Path::OverridePopconUserIndexDir oduid;

	Popcon popcon;
	Local local;

	TestPopconLocal()
		: odsd( TEST_ENV_DIR "popcon" ),
		  odid( TEST_ENV_DIR "popcon" ),
		  odusd( TEST_ENV_DIR "popcon" ),
		  oduid( TEST_ENV_DIR "popcon" ),
		  local( TEST_ENV_DIR "popcon/popularity-contest" )
	{}

    // Very basic access
	Test basicAccess()
	{
		assert(local.score("apt") > 0);
		assert(local.tfidf(popcon, "apt") > 0);
	}

#if 0 // mornfall: apparently left out by enrico, leaving as it is
// Check that every valid index is accessible
template<> template<>
void to::test< 2 >()
{
	for (size_t i = 0; i < popcon.size(); ++i)
	{
		//cerr << popcon.name(i) << " " << popcon.score(i) << endl;
		assert(popcon.score(i) > 0);
	}
}

// Check that we can get a score for every package
template<> template<>
void to::test< 3 >()
{
	int has = 0;
	for (Apt::iterator i = apt.begin(); i != apt.end(); ++i)
	{
		float score = popcon.score(*i);
		if (score > 0)
			++has;
	}
	// At least 1000 packages should have a score
	assert(has > 1000);
}

// Check that scores are meaningful
template<> template<>
void to::test< 4 >()
{
	assert(popcon["apt"] > popcon["libapt-pkg-dev"]);
}

// If there is no data, Popcon should work as if all scores were 0
template<> template<>
void to::test<5>()
{
	Path::OverridePopconSourceDir odsd("./empty");
	Path::OverridePopconIndexDir odid("./empty");
	Path::OverridePopconUserSourceDir odusd("./empty");
	Path::OverridePopconUserIndexDir oduid("./empty");
	Popcon empty;

	assert_eq(empty.timestamp(), 0);
	assert(!empty.hasData());

	assert(empty.size() == 0);
	assert(empty.score("apt") == 0.0);
}
#endif

};

// vim:set ts=4 sw=4: