100+ results for 'php assert'

Not the results you expected?

DependencyGraphBuilder.cpp (https://gitlab.com/x33n/phantomjs) C++ · 227 lines

123 // After traversing the left subtree of this assignment, we should have found a real

124 // leftmost symbol, and the leftmost symbol should not be a placeholder.

125 ASSERT(leftmostSymbol != &mLeftSubtree);

126 ASSERT(leftmostSymbol != &mRightSubtree);

222 for (TParentNodeSet::const_iterator iter = nodes->begin(); iter != nodes->end(); ++iter)

223 {

224 TGraphParentNode* currentNode = *iter;

225 currentNode->addDependentNode(node);

226 }

ParameterBagTest.php (https://gitlab.com/Pasantias/pasantiasASLG) PHP · 224 lines

1 <?php

2

3 /*

14 use Symfony\Component\HttpFoundation\ParameterBag;

15

16 class ParameterBagTest extends \PHPUnit_Framework_TestCase

17 {

18 public function testConstructor()

24 {

25 $bag = new ParameterBag(array('foo' => 'bar'));

26 $this->assertEquals(array('foo' => 'bar'), $bag->all(), '->all() gets all the input');

27 }

28

30 {

31 $bag = new ParameterBag(array('foo' => 'bar'));

32 $this->assertEquals(array('foo'), $bag->keys());

33 }

34

TagTest.php (https://gitlab.com/judielsm/Handora) PHP · 313 lines

1 <?php

2 /**

3 * phpDocumentor Var Tag Test

4 *

5 * PHP version 5.3

6 *

7 * @author Daniel O'Connor <daniel.oconnor@gmail.com>

8 * @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)

9 * @license http://www.opensource.org/licenses/mit-license.php MIT

10 * @link http://phpdoc.org

11 */

12

13 namespace phpDocumentor\Reflection\DocBlock;

14

15 use phpDocumentor\Reflection\DocBlock;

TestCase.php (https://github.com/quimateur/SIFO.git) PHP · 250 lines

55 * @since Class available since Release 1.0.0

56 */

57 abstract class PHPUnit_Extensions_Database_TestCase extends PHPUnit_Framework_TestCase

58 {

59

228 * @param string $message

229 */

230 public static function assertTablesEqual(PHPUnit_Extensions_Database_DataSet_ITable $expected, PHPUnit_Extensions_Database_DataSet_ITable $actual, $message = '')

231 {

232 $constraint = new PHPUnit_Extensions_Database_Constraint_TableIsEqual($expected);

242 * @param string $message

243 */

244 public static function assertDataSetsEqual(PHPUnit_Extensions_Database_DataSet_IDataSet $expected, PHPUnit_Extensions_Database_DataSet_IDataSet $actual, $message = '')

245 {

246 $constraint = new PHPUnit_Extensions_Database_Constraint_DataSetIsEqual($expected);

MimePartTest.php (https://github.com/nattaphat/hgis.git) PHP · 252 lines

1 <?php

2

3 require_once 'Swift/Mime/MimeEntity.php';

4 require_once 'Swift/Mime/MimePart.php';

5 require_once 'Swift/Mime/AbstractMimeEntityTest.php';

6 require_once 'Swift/Mime/Grammar.php';

7

8 class Swift_Mime_MimePartTest extends Swift_Mime_AbstractMimeEntityTest

13 $this->_createEncoder(), $this->_createCache()

14 );

15 $this->assertEqual(

16 Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE, $part->getNestingLevel()

17 );

node_iterator3.cpp (http://hadesmem.googlecode.com/svn/trunk/) text · 0 lines

9 #include <algorithm>

10 #include <boost/mem_fn.hpp>

11 #include <cassert>

12

13 int main()

18

19 // Check interoperability

20 assert(node_iterator(nodes.get()) == node_const_iterator(nodes.get()));

21 assert(node_const_iterator(nodes.get()) == node_iterator(nodes.get()));

22

23 assert(node_iterator(nodes.get()) != node_const_iterator());

24 assert(node_const_iterator(nodes.get()) != node_iterator());

test_block.rb (https://github.com/kosaki/ruby.git) Ruby · 599 lines

1 assert_equal %q{1}, %q{

2 1.times{

3 begin

8 }

9 }

10 assert_equal %q{2}, %q{

11 [1,2,3].find{|x| x == 2}

12 }

13 assert_equal %q{2}, %q{

14 class E

15 include Enumerable

20 E.new.find {|x| x == 2 }

21 }

22 assert_equal %q{6}, %q{

23 sum = 0

24 for x in [1, 2, 3]

InfoTest.php (https://gitlab.com/yousafsyed/easternglamor) PHP · 255 lines

1 <?php

2 /**

3 * Copyright © 2016 Magento. All rights reserved.

10 use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;

11

12 class InfoTest extends \PHPUnit_Framework_TestCase

13 {

14 /** @var \Magento\Payment\Model\InfoInterface */

18 protected $objectManagerHelper;

19

20 /** @var \Magento\Framework\Model\Context|\PHPUnit_Framework_MockObject_MockObject */

21 protected $contextMock;

22

23 /** @var \Magento\Framework\Registry|\PHPUnit_Framework_MockObject_MockObject */

24 protected $registryMock;

25

MediaValidationTest.php (https://github.com/bmcclure/CakePHP-Media-Plugin.git) PHP · 305 lines

1 <?php

2 /**

3 * Media Validation Test Case File

8 * Redistributions of files must retain the above copyright notice.

9 *

10 * PHP 5

11 * CakePHP 2

14 * @link http://github.com/davidpersson/media

15 * @package Media.Test.Case.Lib

16 * @license http://www.opensource.org/licenses/mit-license.php The MIT License

17 */

18

19 App::uses('MediaValidation', 'Media.Lib');

20

21 require_once dirname(dirname(__FILE__)) . DS . 'constants.php';

22 require_once dirname(dirname(dirname(__FILE__))) . DS . 'Fixture' . DS . 'TestData.php';

shapes_test.php (https://github.com/vadimonus/moodle.git) PHP · 165 lines

1 <?php

2 // This file is part of Moodle - http://moodle.org/

3 //

28 global $CFG;

29

30 require_once($CFG->dirroot . '/question/type/ddmarker/shapes.php');

31

32

41 public function test_polygon_valdiation_test_ok() {

42 $shape = new qtype_ddmarker_shape_polygon('10, 10; 20, 10; 20, 20; 10, 20');

43 $this->assertFalse($shape->get_coords_interpreter_error()); // No errors.

44 }

45

46 public function test_polygon_valdiation_test_only_two_points() {

47 $shape = new qtype_ddmarker_shape_polygon('10, 10; 20, 10');

48 $this->assertEquals(get_string('formerror_polygonmusthaveatleastthreepoints', 'qtype_ddmarker',

49 array('shape' => 'polygon', 'coordsstring' => get_string('shape_polygon_coords', 'qtype_ddmarker'))),

50 $shape->get_coords_interpreter_error());

DateTimeOffsetConverterTests.cs (https://github.com/QuickJack/mono.git) C# · 241 lines

51 public void CanConvertFrom ()

52 {

53 Assert.IsTrue (converter.CanConvertFrom (typeof (string)), "#A1");

54 Assert.IsFalse (converter.CanConvertFrom (typeof (DateTime)), "#A2");

55 Assert.IsFalse (converter.CanConvertFrom (typeof (DateTimeOffset)), "#A3");

56 Assert.IsFalse (converter.CanConvertFrom (typeof (object)), "#A4");

57 Assert.IsTrue (converter.CanConvertFrom (typeof (InstanceDescriptor)), "#A5");

58 }

59

61 public void CanConvertTo ()

62 {

63 Assert.IsTrue (converter.CanConvertTo (typeof (string)), "#A1");

64 Assert.IsFalse (converter.CanConvertTo (typeof (object)), "#A2");

ModelTest.java (https://github.com/will-moore/openmicroscopy.git) Java · 254 lines

56 IceMapper mapper = new IceMapper();

57 ExperimenterI ei = (ExperimenterI) mapper.map(e);

58 assertEquals(new Integer(1), new Integer(ei

59 .sizeOfGroupExperimenterMap()));

60

71 // This may not hold without being called from the top level mapper

72 // method

73 // assertEquals(new Integer(1), new

74 // Integer(ei.sizeOfGroupExperimenterMap()));

75

88 ei.linkExperimenterGroup(new ExperimenterGroupI());

89 Experimenter e = (Experimenter) ei.fillObject(new IceMapper());

90 assertEquals(new Integer(1),

91 new Integer(e.sizeOfGroupExperimenterMap()));

92

FieldsFilterTest.php (https://gitlab.com/crazybutterfly815/magento2) PHP · 233 lines

1 <?php

2 /**

3 * Copyright © 2016 Magento. All rights reserved.

12 * Unit test for FieldsFilter

13 */

14 class FieldsFilterTest extends \PHPUnit_Framework_TestCase

15 {

16 /**

24 protected $sampleResponseValue;

25

26 /** @var \Magento\Framework\Webapi\Rest\Request|\PHPUnit_Framework_MockObject_MockObject */

27 protected $requestMock;

28

110 $filteredResponse = $this->processor->filter($this->sampleResponseValue);

111

112 $this->assertEquals($expected, $filteredResponse);

113 }

114

JSessionTest.php (https://github.com/Paladin/joomla-platform.git) PHP · 393 lines

1 <?php

2 /**

3 * @package Joomla.UnitTest

9 /**

10 * Test class for JSession.

11 * Generated by PHPUnit on 2011-10-26 at 19:33:07.

12 *

13 * @package Joomla.UnitTest

106

107 // The properties and values should be identical to each other.

108 $this->assertThat(

109 $oldSession,

110 $this->identicalTo($newSession)

112

113 // They should be the same object.

114 $this->assertSame($oldSession, $newSession);

115 }

116

custom_completion_test.php (https://github.com/sbourget/moodle.git) PHP · 239 lines

1 <?php

2 // This file is part of Moodle - http://moodle.org/

3 //

36

37 global $CFG;

38 require_once($CFG->libdir . '/completionlib.php');

39 require_once($CFG->dirroot . '/mod/assign/tests/generator.php');

102

103 $customcompletion = new custom_completion($cm, (int)$student->id);

104 $this->assertEquals($status, $customcompletion->get_state($rule));

105 }

106

136

137 $customcompletion = new custom_completion($cm, (int)$student->id);

138 $this->assertEquals($status, $customcompletion->get_state($rule));

139 }

140

ExtractTest.php (https://bitbucket.org/rchlmrtn/chiari.git) PHP · 154 lines

72 $entry = $this->extractor->entry_from_call( array( 'name' => '__', 'args' => array('baba'), 'line' => 10 ), 'baba.php' );

73 $this->assertEquals( $entry, new Translation_Entry( array( 'singular' => 'baba', 'references' => array('baba.php:10') ) ) );

74 }

75

124

125 function test_find_function_calls_1_arg_bad_function_call() {

126 $this->assertEquals( array( array( 'name' => 'f', 'args' => array( null ), 'line' => 1 ) ), $this->extractor->find_function_calls( array('f'), '<?php f( g( "baba" ) ); ' ) );

127 }

128

129 function test_find_function_calls_2_arg_literal_bad() {

130 $this->assertEquals( array( array( 'name' => 'f', 'args' => array( "baba", null ), 'line' => 1 ) ), $this->extractor->find_function_calls( array('f'), '<?php f( "baba", null ); ' ) );

131 }

132

133 function test_find_function_calls_2_arg_bad_with_parens_literal() {

134 $this->assertEquals( array( array( 'name' => 'f', 'args' => array( null, "baba" ), 'line' => 1 ) ), $this->extractor->find_function_calls( array('f'), '<?php f( g( "dyado", "chicho", "lelya "), "baba" ); ' ) );

135 }

136

DispatcherFilterTest.php (https://github.com/LubosRemplik/cakephp.git) PHP · 245 lines

1 <?php

2 /**

3 * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)

4 * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)

5 *

9 *

10 * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)

11 * @link https://cakephp.org CakePHP(tm) Project

12 * @since 3.0.0

13 * @license https://opensource.org/licenses/mit-license.php MIT License

95 $request = new ServerRequest(['url' => '/blog/articles']);

96 $event = new Event('Dispatcher.beforeDispatch', $this, compact('request'));

97 $this->assertFalse($filter->matches($event), 'Does not start with /articles');

98

99 $request = new ServerRequest(['url' => '/articles/edit/1']);

AbstractMultiSelectonTest.js (https://github.com/Wkasel/qooxdoo.git) JavaScript · 250 lines

10 License:

11 LGPL: http://www.gnu.org/licenses/lgpl.html

12 EPL: http://www.eclipse.org/org/documents/epl-v10.php

13 See the LICENSE file in the project's top-level directory for details.

14

66 // Tests the result from "getSelection"

67 var result = this._widget.getSelection();

68 this._assertArrayEquals(expected, result, "Selection is wrong");

69

70 // Test setSelection(), with one element from the selection before

73 result = this._widget.getSelection();

74 expected = [this._selection[0]];

75 this._assertArrayEquals(expected, result, "Selection is wrong");

76 this.flush();

77 },

RowTest.php (https://github.com/nehxby/db_type.git) PHP · 228 lines

1 <?php

2 class DB_Type_Pgsql_Test_RowTest extends DB_Type_Test_Util_TypeTestCase

3 {

208 array('b'=>'("5","ddd")', 'a'=>'2'),

209 ),

210 /* Failed asserting in testInputOutputInput

211 because output truncates `not_in_items` field.

212 Usage example see in examples/itemsInput.php

AclVoteManagerTest.php (https://github.com/outlawscumbag/CommentBundle.git) PHP · 256 lines

1 <?php

2

3 /**

22 * @author Tim Nagel <tim@nagel.com.au>

23 */

24 class AclVoteManagerTest extends \PHPUnit_Framework_TestCase

25 {

26 protected $realManager;

77 $result = $manager->findVoteById($id);

78

79 $this->assertEquals($expectedResult, $result);

80 }

81

120 $result = $manager->findVoteBy($conditions);

121

122 $this->assertEquals($expectedResult, $result);

123 }

124

FormRegistryTest.php (https://github.com/societies/SOCIETIES-Platform.git) PHP · 263 lines

1 <?php

2

3 /*

22 * @author Bernhard Schussek <bschussek@gmail.com>

23 */

24 class FormRegistryTest extends \PHPUnit_Framework_TestCase

25 {

26 /**

30

31 /**

32 * @var \PHPUnit_Framework_MockObject_MockObject

33 */

34 private $resolvedTypeFactory;

35

36 /**

37 * @var \PHPUnit_Framework_MockObject_MockObject

38 */

39 private $guesser1;

MailTest.php (https://github.com/nbcutech/o3drupal.git) PHP · 220 lines

1 <?php

2 /**

3 * Zend Framework

21 */

22

23 if (!defined('PHPUnit_MAIN_METHOD')) {

24 define('PHPUnit_MAIN_METHOD', 'Zend_Application_Resource_MailTest::main');

28 * Zend_Loader_Autoloader

29 */

30 require_once 'Zend/Loader/Autoloader.php';

31

32 /**

38 * @group Zend_Application

39 */

40 class Zend_Application_Resource_MailTest extends PHPUnit_Framework_TestCase

41 {

42 public static function main()

BuildLogRegexContentTest.java (https://github.com/kbracey/email-ext-plugin.git) Java · 227 lines

10 import java.util.Map;

11

12 import static org.junit.Assert.assertEquals;

13

14 public class BuildLogRegexContentTest

34 final String result = buildLogRegexContent.getContent( reader, args );

35

36 assertEquals( "", result );

37 }

38

47 final String result = buildLogRegexContent.getContent( reader, args );

48

49 assertEquals( "6 ERROR\n9 ERROR\n18 ERROR\n", result );

50 }

51

CookieJarTest.php (https://bitbucket.org/AdriVanHoudt/school.git) PHP · 191 lines

94 $fooCookie = $cookieJar->get('foo', '/', '.symfony.com');

95 $barCookie = $cookieJar->get('bar', '/', '.blog.symfony.com');

96 $phpCookie = $cookieJar->get('PHPSESSID');

97

98 $this->assertInstanceOf('Symfony\Component\BrowserKit\Cookie', $fooCookie);

99 $this->assertInstanceOf('Symfony\Component\BrowserKit\Cookie', $barCookie);

100 $this->assertInstanceOf('Symfony\Component\BrowserKit\Cookie', $phpCookie);

101 $this->assertEquals('foo', $fooCookie->getValue());

102 $this->assertEquals('bar', $barCookie->getValue());

103 $this->assertEquals('id', $phpCookie->getValue());

104 $this->assertEquals($timestamp, $fooCookie->getExpiresTime());

105 $this->assertNull($barCookie->getExpiresTime());

106 $this->assertEquals($timestamp, $phpCookie->getExpiresTime());

107 }

108

address_utils.h (https://gitlab.com/shinvdu/shadowsocks-android) C Header · 280 lines

49 static int ncd_read_baddr (NCDValRef val, BAddr *out)

50 {

51 ASSERT(!NCDVal_IsInvalid(val))

52 ASSERT(NCDVal_HasOnlyContinuousStrings(val))

53 ASSERT(out)

54

55 if (!NCDVal_IsList(val)) {

133 static NCDValRef ncd_make_baddr (BAddr addr, NCDValMem *mem)

134 {

135 BAddr_Assert(&addr);

136 ASSERT(mem)

236 static int ncd_read_bconnection_addr (NCDValRef val, struct BConnection_addr *out_addr)

237 {

238 ASSERT(!NCDVal_IsInvalid(val))

239 ASSERT(NCDVal_HasOnlyContinuousStrings(val))

TestMethodExpressionImpl.java (https://gitlab.com/essere.lab.public/qualitas.class-corpus) Java · 329 lines

85 new Class<?>[] { String.class });

86

87 assertFalse(me1.isParmetersProvided());

88 assertTrue(me2.isParmetersProvided());

105 new Class<?>[] { String.class });

106

107 assertEquals("B", me1.invoke(context, null));

108 assertEquals("Hello JUnit from B", me2.invoke(context, null));

109 assertEquals("Hello JUnit from B",

110 me2.invoke(context, new Object[] { "JUnit2" }));

111 assertEquals("Hello JUnit2 from B",

112 me3.invoke(context, new Object[] { "JUnit2" }));

113 assertEquals("Hello JUnit from B",

114 me2.invoke(context, new Object[] { null }));

115 assertEquals("Hello null from B",

gobex-packet.c (https://github.com/syamsidhardhan/obexd.git) C · 409 lines

171 }

172

173 g_assert_not_reached();

174 }

175

FilesSizeTest.php (https://github.com/WebTricks/WebTricks-CMS.git) PHP · 235 lines

1 <?php

2 /**

3 * Zend Framework

18 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)

19 * @license http://framework.zend.com/license/new-bsd New BSD License

20 * @version $Id: FilesSizeTest.php 20454 2010-01-20 22:50:59Z thomas $

21 */

22

23 // Call Zend_Validate_File_FilesSizeTest::main() if this source file is executed directly.

24 if (!defined("PHPUnit_MAIN_METHOD")) {

25 define("PHPUnit_MAIN_METHOD", "Zend_Validate_File_FilesSizeTest::main");

29 * Test helper

30 */

31 require_once dirname(__FILE__) . '/../../../TestHelper.php';

32

33 /**

BlobStorageSharedAccessTest.php (https://github.com/WebTricks/WebTricks-CMS.git) PHP · 208 lines

1 <?php

2 /**

3 * Zend Framework

24 * Test helpers

25 */

26 require_once dirname(__FILE__) . '/../../../TestHelper.php';

27

28 /** Zend_Service_WindowsAzure_Storage_Blob */

29 require_once 'Zend/Service/WindowsAzure/Storage/Blob.php';

30

31 /** Zend_Service_WindowsAzure_Credentials_SharedAccessSignature */

32 require_once 'Zend/Service/WindowsAzure/Credentials/SharedAccessSignature.php';

33

34 /**

Code25interleavedTest.php (https://github.com/cgmartin/zf2.git) PHP · 230 lines

1 <?php

2 /**

3 * Zend Framework (http://framework.zend.com/)

24 public function testType()

25 {

26 $this->assertSame('code25interleaved', $this->object->getType());

27 }

28

30 {

31 $this->object->setWithBearerBars(1);

32 $this->assertSame(true, $this->object->getWithBearerBars());

33 $this->object->setWithBearerBars(true);

34 $this->assertSame(true, $this->object->getWithBearerBars());

37 public function testChecksum()

38 {

39 $this->assertSame(5, $this->object->getChecksum('0123456789'));

40 }

41

rsComponent.cpp (https://github.com/anryl/android_frameworks_base.git) C++ · 337 lines

37 mNormalized = norm;

38 mVectorSize = vecSize;

39 rsAssert(vecSize <= 4);

40

41 mBits = 0;

49 case RS_KIND_PIXEL_A:

50 mIsPixel = true;

51 rsAssert(mVectorSize == 1);

52 rsAssert(mNormalized == true);

54 case RS_KIND_PIXEL_LA:

55 mIsPixel = true;

56 rsAssert(mVectorSize == 2);

57 rsAssert(mNormalized == true);

59 case RS_KIND_PIXEL_RGB:

60 mIsPixel = true;

61 rsAssert(mVectorSize == 3);

62 rsAssert(mNormalized == true);

ExampleTests.cs (https://github.com/bertvan/CruiseControl.NET.git) C# · 334 lines

22 AssemblyHelper.RetrieveExampleFile("SingleProject"));

23

24 Assert.IsNotNull(configuration);

25 Assert.AreEqual("2.0", configuration.Version.ToString(2));

44 AssemblyHelper.RetrieveExampleFile("SimpleSourceControlExample"));

45

46 Assert.IsNotNull(configuration);

47 Assert.AreEqual("2.0", configuration.Version.ToString(2));

57 AssemblyHelper.RetrieveExampleFile("ScmProject"));

58

59 Assert.IsNotNull(configuration);

60 Assert.AreEqual("2.0", configuration.Version.ToString(2));

70 AssemblyHelper.RetrieveExampleFile("ComplexSourceControlExample"));

71

72 Assert.IsNotNull(configuration);

73 Assert.AreEqual("2.0", configuration.Version.ToString(2));

JSRealtimeAnalyserNode.cpp (https://bitbucket.org/ultra_iter/qt-vtl.git) C++ · 317 lines

37 namespace WebCore {

38

39 ASSERT_CLASS_FITS_IN_CELL(JSRealtimeAnalyserNode);

40

41 /* Hash table */

93 : DOMConstructorObject(structure, globalObject)

94 {

95 ASSERT(inherits(&s_info));

96 putDirect(exec->globalData(), exec->propertyNames().prototype, JSRealtimeAnalyserNodePrototype::self(exec, globalObject), DontDelete | ReadOnly);

97 }

146 : JSAudioNode(structure, globalObject, impl)

147 {

148 ASSERT(inherits(&s_info));

149 }

150

JGithubPackageActivityEventsTest.php (https://github.com/pjwiseman/joomla-cms.git) PHP · 349 lines

1 <?php

2 /**

3 * @package Joomla.UnitTest

15 * @since 12.3

16 */

17 class JGithubPackageActivityEventsTest extends PHPUnit_Framework_TestCase

18 {

19 /**

116 ->will($this->returnValue($returnData));

117

118 $this->assertThat(

119 $this->object->getPublic(),

120 $this->equalTo(json_decode($returnData->body))

142 ->will($this->returnValue($returnData));

143

144 $this->assertThat(

145 $this->object->getRepository($this->owner, $this->repo),

146 $this->equalTo(json_decode($returnData->body))

b2Distance.js (https://github.com/coderchrismills/JSGameTest2D.git) JavaScript · 333 lines

131

132 // Should not be in vertex a or b region.

133 //b2Settings.b2Assert(sn > 0.0 || tn > 0.0);

134 //b2Settings.b2Assert(sd > 0.0 || un > 0.0);

140 //float32 vc = n * b2Cross(a, b);

141 var vc = n * (aX * bY - aY * bX);

142 //b2Settings.b2Assert(vc > 0.0 || sn > 0.0 || sd > 0.0);

143

144 // In edge bc region?

147 if (va <= 0.0 && un >= 0.0 && ud >= 0.0)

148 {

149 //b2Settings.b2Assert(un + ud > 0.0);

150

151 //float32 lambda = un / (un + ud);

171 if (vb <= 0.0 && tn >= 0.0 && td >= 0.0)

172 {

173 //b2Settings.b2Assert(tn + td > 0.0);

174

175 //float32 lambda = tn / (tn + td);

FlatTest.php (https://gitlab.com/yousafsyed/easternglamor) PHP · 391 lines

1 <?php

2 /**

3 * Copyright © 2016 Magento. All rights reserved.

6 namespace Magento\Catalog\Model\Indexer;

7

8 class FlatTest extends \PHPUnit_Framework_TestCase

9 {

10 /**

65

66 $result = $category->getCollection()->getAllIds();

67 $this->assertNotEmpty($result);

68 $this->assertTrue(is_array($result));

85 $indexer->load('catalog_category_flat');

86 $indexer->reindexAll();

87 $this->assertTrue($indexer->isValid());

88

89 /** @var \Magento\Catalog\Model\Category $category */

DefaultTrackingEntitiesTest.java (https://gitlab.com/essere.lab.public/qualitas.class-corpus) Java · 190 lines

79 Table table = tableIterator.next();

80 if ("REVCHANGES".equals(table.getName())) {

81 assert table.getColumnSpan() == 2;

82 assert table.getColumn(new Column("REV")) != null;

83 assert table.getColumn(new Column("ENTITYNAME")) != null;

84 return;

85 }

86 }

87 assert false;

88 }

89

93 StrIntTestEntity site = new StrIntTestEntity("y", 1, siteId);

94

95 assert TestTools.checkList(getCrossTypeRevisionChangesReader().findEntities(1), ste, site);

96 }

97

Validator.php (https://github.com/Ostilio/siga.git) PHP · 206 lines

1 <?php

2

3 /**

38 $this->interchange = $interchange;

39 $this->aliases = array();

40 // PHP is a bit lax with integer <=> string conversions in

41 // arrays, so we don't use the identical !== comparison

42 foreach ($interchange->directives as $i => $directive) {

63 ->assertNotEmpty()

64 ->assertIsString(); // implicit assertIsString handled by InterchangeBuilder

65 array_pop($this->context);

66 }

75

76 $this->with($d, 'description')

77 ->assertNotEmpty();

78

79 // BEGIN - handled by InterchangeBuilder

UtilTests.java (https://bitbucket.org/haris_peco/debrief.git) Java · 209 lines

11 *

12 * You can obtain a copy of the LGPL 2.1 license at

13 * http://www.opensource.org/licenses/lgpl-2.1.php

14 *

15 * You can obtain a copy of the CDDL 1.0 license at

16 * http://www.opensource.org/licenses/cddl1.php

17 *

18 * You can obtain a copy of the EPL 1.0 license at

19 * http://www.opensource.org/licenses/eclipse-1.0.php

20 *

21 * See the Licenses for the specific language governing permissions and

events_test.php (https://github.com/abgreeve/moodle.git) PHP · 204 lines

1 <?php

2 // This file is part of Moodle - http://moodle.org/

3 //

27

28 global $CFG;

29 require_once($CFG->dirroot . '/grade/lib.php');

30

31 /**

74

75 // Check that the event data is valid.

76 $this->assertInstanceOf('\core\event\grade_letter_created', $event);

77 $this->assertEquals(context_course::instance($this->course->id), $event->get_context());

98

99 // Check that the event data is valid.

100 $this->assertInstanceOf('\core\event\grade_letter_deleted', $event);

101 $this->assertEquals(context_course::instance($this->course->id), $event->get_context());

ManagerTest.php (https://gitlab.com/yousafsyed/easternglamor) PHP · 314 lines

1 <?php

2 /**

3 * Copyright © 2016 Magento. All rights reserved.

22 * Class ManagerTest

23 *

24 * @SuppressWarnings(PHPMD.CouplingBetweenObjects)

25 */

26 class ManagerTest extends \PHPUnit_Framework_TestCase

32

33 /**

34 * @var ComponentDefinition|\PHPUnit_Framework_MockObject_MockObject

35 */

36 protected $componentConfigProvider;

37

38 /**

39 * @var CacheInterface|\PHPUnit_Framework_MockObject_MockObject

40 */

41 protected $cacheConfig;

GalleryManagementTest.php (https://gitlab.com/yousafsyed/easternglamor) PHP · 290 lines

1 <?php

2 /**

3 *

10 namespace Magento\Catalog\Test\Unit\Model\Product\Gallery;

11

12 class GalleryManagementTest extends \PHPUnit_Framework_TestCase

13 {

14 /**

18

19 /**

20 * @var \PHPUnit_Framework_MockObject_MockObject

21 */

22 protected $productRepositoryMock;

23

24 /**

25 * @var \PHPUnit_Framework_MockObject_MockObject

26 */

27 protected $contentValidatorMock;

test_dir_m17n.rb (https://gitlab.com/essere.lab.public/qualitas.class-corpus) Ruby · 239 lines

16 def test_filename_extutf8

17 with_tmpdir {|d|

18 assert_ruby_status(%w[-EUTF-8], <<-'EOS', nil, :chdir=>d)

19 filename = "\u3042"

20 File.open(filename, "w") {}

28 def test_filename_extutf8_invalid

29 with_tmpdir {|d|

30 assert_ruby_status(%w[-EASCII-8BIT], <<-'EOS', nil, :chdir=>d)

31 filename = "\xff".force_encoding("ASCII-8BIT") # invalid byte sequence as UTF-8

32 File.open(filename, "w") {}

35 exit ents.include?(filename) || ((RUBY_PLATFORM =~ /darwin/) != nil && ents.include?("%FF"))

36 EOS

37 assert_ruby_status(%w[-EUTF-8], <<-'EOS', nil, :chdir=>d)

38 filename = "\xff".force_encoding("UTF-8") # invalid byte sequence as UTF-8

39 File.open(filename, "w") {}

AssociatedMetadataProviderTest.cs (https://bitbucket.org/mdavid/aspnetwebstack.git) C# · 309 lines

5 using Microsoft.TestCommon;

6 using Xunit;

7 using Assert = Microsoft.TestCommon.AssertEx;

8

9 namespace System.Web.Http.Metadata.Providers

19 TestableAssociatedMetadataProvider provider = new TestableAssociatedMetadataProvider();

20

21 // Act & Assert

22 Assert.ThrowsArgumentNull(

35 provider.GetMetadataForProperties(model, typeof(PropertyModel)).ToList(); // Call ToList() to force the lazy evaluation to evaluate

36

37 // Assert

38 CreateMetadataParams local =

39 provider.CreateMetadataLog.Single(m => m.ContainerType == typeof(PropertyModel) &&

40 m.PropertyName == "LocalAttributes");

41 Assert.Equal(typeof(int), local.ModelType);

42 Assert.Equal(42, local.Model);

vector_c.rst (http://hadesmem.googlecode.com/svn/trunk/) ReStructuredText · 0 lines ✨ Summary

This documentation explains the vector_c class, a wrapper for the vector class that uses integral constants to specify its content. It describes the class’s model and expression semantics, providing examples of how to use it and how it relates to other Boost classes. The documentation also includes copyright information and references to related classes.

72 typedef push_back<fibonacci,int_<55> >::type fibonacci2;

73

74 BOOST_MPL_ASSERT_RELATION( front<fibonacci2>::type::value, ==, 1 );

75 BOOST_MPL_ASSERT_RELATION( back<fibonacci2>::type::value, ==, 55 );

SecondLevelCacheTest.php (https://github.com/adrienbrault/doctrine2.git) PHP · 283 lines

1 <?php

2

3 declare(strict_types=1);

54 $this->findEntity($em, __FUNCTION__);

55

56 self::assertEquals(6002, $this->countQuery($em));

57 }

58

65 $this->findEntity($em, __FUNCTION__);

66

67 self::assertEquals(502, $this->countQuery($em));

68 }

69

74 $this->findAllEntity($em, __FUNCTION__);

75

76 self::assertEquals(153, $this->countQuery($em));

77 }

78

mscorlib_System_Collections_Generic_Dictionary_2_E2686065286MethodDeclarations.h (https://gitlab.com/DUCOM/hiv-minigame-01) C Header · 67 lines

10

11 #include <stdint.h>

12 #include <assert.h>

13 #include <exception>

14

CookieTest.php (https://gitlab.com/xolotsoft/pumasruiz) PHP · 179 lines

1 <?php

2

3 /*

14 use Symfony\Component\BrowserKit\Cookie;

15

16 class CookieTest extends \PHPUnit_Framework_TestCase

17 {

18 /**

21 public function testToFromString($cookie, $url = null)

22 {

23 $this->assertEquals($cookie, (string) Cookie::fromString($cookie, $url));

24 }

25

40 public function testFromStringIgnoreSecureFlag()

41 {

42 $this->assertFalse(Cookie::fromString('foo=bar; secure')->isSecure());

43 $this->assertFalse(Cookie::fromString('foo=bar; secure', 'http://example.com/')->isSecure());

DeleteTest.php (https://gitlab.com/yousafsyed/easternglamor) PHP · 241 lines

1 <?php

2 /**

3 * Copyright © 2016 Magento. All rights reserved.

10 use Magento\Framework\Exception\LocalizedException;

11

12 class DeleteTest extends \PHPUnit_Framework_TestCase

13 {

14 /**

105

106 /**

107 * Executes the controller action and asserts non exception logic

108 */

109 public function testExecute()

149 );

150

151 $this->assertSame($this->resultPage, $notification->execute());

152 }

153

ReadTest.php (https://gitlab.com/yousafsyed/easternglamor) PHP · 312 lines

1 <?php

2 /**

3 * Test for \Magento\Framework\Filesystem\File\Read

10 use Magento\TestFramework\Helper\Bootstrap;

11

12 class ReadTest extends \PHPUnit_Framework_TestCase

13 {

14 /**

18 {

19 $file = $this->getFileInstance('popup.csv');

20 $this->assertTrue($file instanceof ReadInterface);

21 }

22

23 /**

24 * Test for assertValid method

25 * Expected exception for file that does not exist and file without access

26 *

DynamicPageCacheIntegrationTest.php (https://gitlab.com/reasonat/test8) PHP · 126 lines

1 <?php

2

3 namespace Drupal\dynamic_page_cache\Tests;

52 $url = Url::fromUri('route:dynamic_page_cache_test.response');

53 $this->drupalGet($url);

54 $this->assertFalse($this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER), 'Response object returned: Dynamic Page Cache is ignoring.');

55

56 // Controllers returning CacheableResponseInterface (cacheable response)

58 $url = Url::fromUri('route:dynamic_page_cache_test.cacheable_response');

59 $this->drupalGet($url);

60 $this->assertEqual('MISS', $this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER), 'Cacheable response object returned: Dynamic Page Cache is active, Dynamic Page Cache MISS.');

61 $this->drupalGet($url);

62 $this->assertEqual('HIT', $this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER), 'Cacheable response object returned: Dynamic Page Cache is active, Dynamic Page Cache HIT.');

66 $url = Url::fromUri('route:dynamic_page_cache_test.html');

67 $this->drupalGet($url);

68 $this->assertEqual('MISS', $this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER), 'Render array returned, rendered as HTML response: Dynamic Page Cache is active, Dynamic Page Cache MISS.');

69 $this->drupalGet($url);

70 $this->assertEqual('HIT', $this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER), 'Render array returned, rendered as HTML response: Dynamic Page Cache is active, Dynamic Page Cache HIT.');

SequenceTest.php (https://bitbucket.org/mkjpryor/lazy-sequence.git) PHP · 369 lines

1 <?php

2

3 namespace Lazy\Test;

14

15

16 class SequenceTest extends \PHPUnit_Framework_TestCase {

17

18 /**

60 public function testHead() {

61 // Test that head returns correctly for a non-empty sequence

62 $this->assertEquals(5, S::head(S::create(5, 6, 7, 8)));

63

64 // Test that head returns correctly for an empty sequence

65 $this->assertNull(S::head(S::create()));

66 }

67

Location.js (https://github.com/stephaneerard/qooxdoo.git) JavaScript · 406 lines

10 License:

11 LGPL: http://www.gnu.org/licenses/lgpl.html

12 EPL: http://www.eclipse.org/org/documents/epl-v10.php

13 See the LICENSE file in the project's top-level directory for details.

14

71 // check the defaults

72 var pos = qx.bom.element.Location.get(document.body);

73 this.assertEquals(0, pos.left);

74 this.assertEquals(0, pos.top);

82

83 var pos = qx.bom.element.Location.get(document.body);

84 this.assertEquals(10, pos.left);

85 this.assertEquals(20, pos.top);

91

92 var pos = qx.bom.element.Location.get(document.body);

93 this.assertEquals(0, pos.left);

94 this.assertEquals(0, pos.top);

prg.test.php (https://github.com/manubamba/cakephp-search-plugin-v1.1.git) PHP · 373 lines

1 <?php

2 /**

3 * Copyright 2009-2010, Cake Development Corporation (http://cakedc.com)

7 *

8 * @copyright Copyright 2009-2010, Cake Development Corporation (http://cakedc.com)

9 * @license MIT License (http://www.opensource.org/licenses/mit-license.php)

10 */

11

168 'lookup' => 1,

169 'lookup_input' => 'First Post'));

170 $this->assertEqual($this->Controller->data, $expected);

171 }

172

194 'Post' => array(

195 'views' => '0'));

196 $this->assertEqual($this->Controller->data, $expected);

197 }

198

AbstractTokenTest.php (https://gitlab.com/fabian.morales/marlon_becerra) PHP · 285 lines

1 <?php

2

3 /*

56 }

57

58 class AbstractTokenTest extends \PHPUnit_Framework_TestCase

59 {

60 public function testGetUsername()

62 $token = $this->getToken(array('ROLE_FOO'));

63 $token->setUser('fabien');

64 $this->assertEquals('fabien', $token->getUsername());

65

66 $token->setUser(new TestUser('fabien'));

67 $this->assertEquals('fabien', $token->getUsername());

68

69 $user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');

VCardTest.php (https://gitlab.com/deichbrise/vcard-viewhelper) PHP · 355 lines

1 <?php

2

3 namespace JeroenDesloovere\VCard\tests;

4

5 // required to load

6 require_once __DIR__ . '/../vendor/autoload.php';

7

8 /*

9 * This file is part of the VCard PHP Class from Jeroen Desloovere.

10 *

11 * For the full copyright and license information, please view the license

16

17 /**

18 * This class will test our VCard PHP Class which can generate VCards.

19 *

20 * @author Jeroen Desloovere <info@jeroendesloovere.be>

AutoParagraphTest.php (https://gitlab.com/Griffolion/Game-Embargo-Tracker) PHP · 577 lines

1 <?php

2

3 class HTMLPurifier_Injector_AutoParagraphTest extends HTMLPurifier_InjectorHarness

12 public function testSingleParagraph()

13 {

14 $this->assertResult(

15 'Foobar',

16 '<p>Foobar</p>'

20 public function testSingleMultiLineParagraph()

21 {

22 $this->assertResult(

23 'Par 1

24 Par 1 still',

30 public function testTwoParagraphs()

31 {

32 $this->assertResult(

33 'Par1

34

CurlResultTest.php (https://github.com/friendica/friendica.git) PHP · 214 lines

1 <?php

2 /**

3 * @copyright Copyright (C) 2010-2022, the Friendica project

26 use Friendica\Network\HTTPClient\Response\CurlResult;

27 use Mockery\MockInterface;

28 use PHPUnit\Framework\TestCase;

29 use Psr\Log\LoggerInterface;

30 use Psr\Log\NullLogger;

38 /** @var Dice|MockInterface $dice */

39 $dice = \Mockery::mock(Dice::class)->makePartial();

40 $dice = $dice->addRules(include __DIR__ . '/../../../../../static/dependencies.config.php');

41

42 $logger = new NullLogger();

54 {

55 $header = file_get_contents(__DIR__ . '/../../../../datasets/curl/about.head');

56 $headerArray = include(__DIR__ . '/../../../../datasets/curl/about.head.php');

57 $body = file_get_contents(__DIR__ . '/../../../../datasets/curl/about.body');

58

AssertionsTest.class.php (https://github.com/treuter/xp-framework.git) PHP · 617 lines

1 <?php

2 /* This class is part of the XP framework

3 *

8

9 /**

10 * Test assertion methods

11 *

12 * @purpose Unit Test

13 */

14 class AssertionsTest extends TestCase {

15

16 /**

96

97 /**

98 * Test assertEquals() and assertNotEquals() invoke equals() methods

99 * on objects.

100 *

OrderInvoiceTest.php (https://gitlab.com/crazybutterfly815/magento2) PHP · 393 lines

1 <?php

2 /**

3 * Copyright © 2016 Magento. All rights reserved.

26 /**

27 * Class OrderInvoiceTest

28 * @SuppressWarnings(PHPMD.TooManyFields)

29 * @SuppressWarnings(PHPMD.CouplingBetweenObjects)

30 */

31 class OrderInvoiceTest extends \PHPUnit_Framework_TestCase

32 {

33 /**

34 * @var ResourceConnection|\PHPUnit_Framework_MockObject_MockObject

35 */

36 private $resourceConnectionMock;

vhdl.xml (https://jedit.svn.sourceforge.net/svnroot/jedit) XML · 196 lines

49 <KEYWORD1>architecture</KEYWORD1>

50 <KEYWORD1>alias</KEYWORD1>

51 <KEYWORD1>assert</KEYWORD1>

52 <KEYWORD1>entity</KEYWORD1>

53 <KEYWORD1>process</KEYWORD1>

permutation_iterator_test.cpp (http://hadesmem.googlecode.com/svn/trunk/) C++ · 0 lines ✨ Summary

This C++ code tests the interoperability of permutation iterators with different data types and container classes, ensuring they can be used together seamlessly. It checks for convertibility between similar permutation iterators, verifying that they work correctly with various elements and indices, including reverse iteration. The test verifies the functionality of the boost::permutation_iterator class.

9

10 #include <boost/iterator/permutation_iterator.hpp>

11 #include <boost/static_assert.hpp>

12 #include <boost/iterator/iterator_concepts.hpp>

13 #include <boost/concept/assert.hpp>

29 typedef boost::permutation_iterator< double const*, int const* > permutation_const_type;

30

31 BOOST_CONCEPT_ASSERT((

32 boost_concepts::InteroperableIteratorConcept<

33 permutation_type

45 const int index_size = 7;

46

47 BOOST_STATIC_ASSERT(index_size <= element_range_size);

48 element_range_type elements( element_range_size );

49 for( element_range_type::iterator el_it = elements.begin(); el_it != elements.end(); ++el_it )

contract.scm (https://swig.svn.sourceforge.net/svnroot/swig) Lisp · 15 lines ✨ Summary

The code tests various assertion functions in a contract system. It attempts to assert values with invalid types, resulting in an error. The assertions are tested with different combinations of pre-assertion, post-assertion, and pre-post-assertion, demonstrating the failure cases for each scenario. The expected output is an ‘swig-contract-assertion-failed’ exception being thrown for all invalid assertion attempts.

1 (test-preassert 1 2)

2 (expect-throw 'swig-contract-assertion-failed

3 (test-preassert -1 2))

4 (test-postassert 3)

5 (expect-throw 'swig-contract-assertion-failed

6 (test-postassert -3))

7 (test-prepost 2 3)

8 (test-prepost 5 -4)

9 (expect-throw 'swig-contract-assertion-failed

10 (test-prepost -3 4))

11 (expect-throw 'swig-contract-assertion-failed

StyleTest.rb (http://rorptm.googlecode.com/svn/trunk/) Ruby · 23 lines ✨ Summary

This Ruby code defines a unit test class StyleTest that tests the functionality of the Style class from the rtf gem. It creates an instance of Style, checks its properties, and verifies that certain methods return expected results. The test is designed to ensure the Style class behaves as expected in basic scenarios.

12 style = Style.new

13

14 assert(style.is_character_style? == false)

15 assert(style.is_document_style? == false)

16 assert(style.is_paragraph_style? == false)

17 assert(style.is_table_style? == false)

18

19 assert(style.prefix(nil, nil) == nil)

20 assert(style.suffix(nil, nil) == nil)

SmartListTest.java (https://bitbucket.org/nbargnesi/idea.git) Java · 136 lines

28 public class SmartListTest extends TestCase {

29 public void testEmpty() {

30 assertEquals(0, new SmartList<Integer>().size());

31 }

32

34 List<Integer> l = new SmartList<Integer>();

35 l.add(new Integer(1));

36 assertEquals(1, l.size());

37 assertEquals(1, l.get(0).intValue());

42 l.add(new Integer(1));

43 l.add(new Integer(2));

44 assertEquals(2, l.size());

45 assertEquals(1, l.get(0).intValue());

46 assertEquals(2, l.get(1).intValue());

47 }

48

qabstractprintdialog.cpp (https://bitbucket.org/ultra_iter/qt-vtl.git) C++ · 497 lines

265 {

266 Q_D(QAbstractPrintDialog);

267 Q_ASSERT_X(min <= max, "QAbstractPrintDialog::setMinMax",

268 "'min' must be less than or equal to 'max'");

269 d->pd->minPage = min;

299 {

300 Q_D(QAbstractPrintDialog);

301 Q_ASSERT_X(from <= to, "QAbstractPrintDialog::setFromTo",

302 "'from' must be less than or equal to 'to'");

303 d->pd->fromPage = from;

NavigableDateSelector.java (https://jedit.svn.sourceforge.net/svnroot/jedit) Java · 188 lines ✨ Summary

This Java class, NavigableDateSelector, wraps an existing DateSelector component to add a navigation bar with buttons for moving forward and backward in time. It handles clicks on these buttons by calling methods on the wrapped DateSelector. The navigation bar’s appearance can be customized through its background color.

142 }

143 else {

144 assert false: "Unexpected direction"

145 ;

146 }

bootstrap.js (http://enginey.googlecode.com/svn/trunk/) JavaScript · 87 lines ✨ Summary

This JavaScript code defines a test suite for the dojo.getObject and dojo.exists functions, as well as the dojo.eval function. It tests various scenarios, including retrieving objects from different scopes, checking if an object exists, and evaluating expressions. The tests are designed to ensure that these functions behave correctly in different situations.

10 t.assertTrue("assert" in console);

11 t.assertEqual("function", typeof console.assert);

12 },

13

33 var globalVar = dojo.getObject("globalValue");

34 t.is("object", (typeof globalVar));

35 t.assertEqual("blue", globalVar.color);

36 t.assertEqual(20, globalVar.size);

37 t.assertEqual("blue", dojo.getObject("globalValue.color"));

38

39 //Test for non-existent object using global as root path.

44 //Test for existing object using another object as root path.

45 var scopedVar = dojo.getObject("foo.bar", false, this);

46 t.assertTrue(typeof(scopedVar) == "object");

47 t.assertEqual("red", scopedVar.color);

octrun.swg (https://swig.svn.sourceforge.net/svnroot/swig) Unknown · 1433 lines

219 if (!module)

220 module = SWIG_GetModule(0);

221 assert(module);

222 c->base[j] = SWIG_MangledTypeQueryModule(module, module, c->base_names[j]);

223 }

246 if (!base) {

247 for (unsigned int j = 0; j < types.size(); ++j) {

248 assert(types[j].first->clientdata);

249 swig_octave_class *cj = (swig_octave_class *) types[j].first->clientdata;

250 if (cj->name == name)

253 return 0;

254 }

255 assert(base->clientdata);

256 swig_octave_class *c = (swig_octave_class *) base->clientdata;

257 for (int j = 0; c->base_names[j]; ++j) {

JSClientRectList.cpp (https://bitbucket.org/ultra_iter/qt-vtl.git) C++ · 259 lines

35 namespace WebCore {

36

37 ASSERT_CLASS_FITS_IN_CELL(JSClientRectList);

38

39 /* Hash table */

87 : DOMConstructorObject(structure, globalObject)

88 {

89 ASSERT(inherits(&s_info));

90 putDirect(exec->globalData(), exec->propertyNames().prototype, JSClientRectListPrototype::self(exec, globalObject), DontDelete | ReadOnly);

91 }

139 , m_impl(impl)

140 {

141 ASSERT(inherits(&s_info));

142 }

143

qmaintainingreader.cpp (https://bitbucket.org/ultra_iter/qt-vtl.git) C++ · 274 lines

58 , m_standardAttributes(standardAttributes)

59 {

60 Q_ASSERT(m_context);

61 Q_ASSERT(!m_elementDescriptions.isEmpty());

144 void MaintainingReader<TokenLookupClass, LookupKey>::validateElement(const LookupKey elementName) const

145 {

146 Q_ASSERT(tokenType() == QXmlStreamReader::StartElement);

147

148 if(m_elementDescriptions.contains(elementName))

248 const QString &localName) const

249 {

250 Q_ASSERT(tokenType() == QXmlStreamReader::StartElement);

251 return m_currentAttributes.hasAttribute(namespaceURI, localName);

252 }

264 const QString &namespaceURI) const

265 {

266 Q_ASSERT(tokenType() == QXmlStreamReader::StartElement);

267

268 Q_ASSERT_X(m_currentAttributes.hasAttribute(namespaceURI, localName),

TemplateSettings.java (https://bitbucket.org/nbargnesi/idea.git) Java · 747 lines

272

273 ExportableTemplateSettings exportableSettings = ServiceManager.getService(ExportableTemplateSettings.class);

274 assert exportableSettings != null : "Can't find required ExportablTemplateSettings service.";

275 exportableSettings.setParentSettings(this);

276 if (exportableSettings.isLoaded()) {

ntl_concept_check.cpp (http://hadesmem.googlecode.com/svn/trunk/) C++ · 0 lines ✨ Summary

This C++ code tests the boost::math::ntl::RR type, which is a rational number type from the NTL library. It checks that boost::math::ntl::RR meets the requirements for being a real number and can be instantiated with various distributions and special functions. The test also disables certain warnings related to unused formal parameters.

16 #endif

17

18 #define BOOST_MATH_ASSERT_UNDEFINED_POLICY false

19

20 #include <boost/math/bindings/rr.hpp>

29 int main()

30 {

31 BOOST_CONCEPT_ASSERT((boost::math::concepts::RealTypeConcept<boost::math::ntl::RR>));

32 }

33

StackBounds.cpp (https://bitbucket.org/ultra_iter/qt-vtl.git) C++ · 287 lines

107 stackBase = reinterpret_cast<void*>(threadInfo.stkbase);

108 stackSize = threadInfo.stksize;

109 ASSERT(stackBase);

110

111 m_bound = stackBase;

174 int rc = pthread_attr_getstack(&sattr, &stackBase, &stackSize);

175 (void)rc; // FIXME: Deal with error code somehow? Seems fatal.

176 ASSERT(stackBase);

177 pthread_attr_destroy(&sattr);

178 m_bound = stackBase;

q3textedit_extrainfo.cpp (https://bitbucket.org/ultra_iter/qt-vtl.git) C++ · 117 lines

84

85 Q3TextEdit *textEdit = qobject_cast<Q3TextEdit*>(widget());

86 Q_ASSERT(textEdit != 0);

87 Q_UNUSED(textEdit);

88 return true;

94

95 Q3TextEdit *textEdit = qobject_cast<Q3TextEdit*>(widget());

96 Q_ASSERT(textEdit != 0);

97 Q_UNUSED(textEdit);

98 return true;

g_i_l_0243.html (http://hadesmem.googlecode.com/svn/trunk/) HTML · 0 lines ✨ Summary

This is an HTML documentation page for a C++ library, specifically the Generic Image Library (GIL). It displays information about the library’s functions and classes, including function templates, member functions, and constants. The output provides a detailed overview of the library’s functionality, making it easier to understand and use the library in code.

48

49 <p>

50 <code>#include &lt;cassert&gt;</code><br>

51 <code>#include &lt;iterator&gt;</code><br>

52 <code>#include &quot;<a class="el" href="g_i_l_0093.html">gil_config.hpp</a>&quot;</code><br>

FileThread.cpp (https://bitbucket.org/ultra_iter/qt-vtl.git) C++ · 119 lines

48 FileThread::~FileThread()

49 {

50 ASSERT(m_queue.killed());

51 }

52

operator_overload_runme.2.d (https://swig.svn.sourceforge.net/svnroot/swig) D · 91 lines ✨ Summary

This D code tests various operator overloads for a class Op that represents an operation on integers. It checks equality, comparison, arithmetic operations, unary operators, indexing, function calls, and prefix/postfix increment/decrement operators to ensure correct behavior. The test cases cover different scenarios to verify the correctness of the overloaded operators.

14

15 // test equality

16 assert(a != b);

17 assert(b == c);

18 assert(a != d);

19 assert(d == dd);

20

21 // test <

22 assert(a < b);

23 assert(a <= b);

24 assert(b <= c);

25 assert(b >= c);

26 assert(b > d);

27 assert(b >= d);

abstractvideoplayer.cpp (https://bitbucket.org/ultra_iter/qt-vtl.git) C++ · 518 lines

255 TRACE_ENTRY("state %d error %d", state(), aError);

256

257 __ASSERT_ALWAYS(LoadingState == state() ||

258 progressiveDownloadStalled() && BufferingState == state(),

259 Utils::panic(InvalidStatePanic));

272 TRACE_ENTRY("state %d error %d", state(), aError);

273

274 __ASSERT_ALWAYS(LoadingState == state() ||

275 progressiveDownloadStalled() && BufferingState == state(),

276 Utils::panic(InvalidStatePanic));

380 void MMF::AbstractVideoPlayer::initVideoOutput()

381 {

382 Q_ASSERT(m_videoOutput);

383

384 bool connected = connect(

cpp_basic_runme.lua (https://swig.svn.sourceforge.net/svnroot/swig) Lua · 65 lines ✨ Summary

This Lua code tests a C++ module’s functionality by importing and using its functions, variables, and member function pointers. It creates objects from the imported module, assigns them to other objects, and calls their methods to verify that the values are correctly propagated between objects. The test cases cover various scenarios, including assignment, copying, and referencing of objects.

7

8 f=cb.Foo(4)

9 assert(f.num==4)

10 f.num=-17

11 assert(f.num==-17)

14

15 b.fptr=f

16 assert(b.fptr.num==-17)

17 assert(b:test(-3,b.fptr)==-5)

18 f.num=12

19 assert(b.fptr.num==12)

20

21 assert(b.fref.num==-4)

22 assert(b:test(12,b.fref)==23)

23

24 -- references don't take ownership, so if we didn't define this here it might get garbage collected

journal.c (http://omnia2droid.googlecode.com/svn/trunk/) C · 2456 lines ✨ Summary

This C code initializes and manages a journaling system for Linux file systems, specifically ext4. It sets up various data structures, caches, and modules to handle journaling operations, including logging, caching, and device name mapping. The code also handles module initialization and cleanup, as well as error handling and debugging features.

309 * decided to launch a writepage() against this buffer.

310 */

311 J_ASSERT_BH(bh_in, buffer_jbddirty(bh_in));

312

313 new_bh = alloc_buffer_head(GFP_NOFS|__GFP_NOFAIL);

314 /* keep subsequent assertions sane */

315 new_bh->b_state = 0;

316 init_buffer(new_bh, NULL, NULL);

439 int left = journal->j_free;

440

441 assert_spin_locked(&journal->j_state_lock);

442

443 /*

PlayState.as (http://flowplayer-core.googlecode.com/svn/) ActionScript · 319 lines ✨ Summary

This is a PlayReady media player implementation in ActionScript, specifically designed for playing video content on a web page. It manages the playback of clips within a playlist, handling events such as clip completion, midroll, and next/previous navigation. The code also includes error checking and state management to ensure smooth playback.

34 import org.flowplayer.model.State;

35 import org.flowplayer.model.Status;

36 import org.flowplayer.util.Assert;

37 import org.flowplayer.util.Log;

38 import org.flowplayer.view.PlayerEventDispatcher;

190 protected function dispatchBeforeEvent(eventType:ClipEventType, params:Array = null, beforeEventInfo:Object = null):Boolean {

191 log.debug("dispatchBeforeEvent() " + eventType.name + ", current clip " + playList.current);

192 Assert.notNull(eventType, "eventType must be non-null");

193 if (playList.current.isNullClip) return false;

194

FTGlyph-Test.cpp (http://angel-engine.googlecode.com/svn/trunk/) C++ · 110 lines ✨ Summary

This C++ code defines a unit test suite for testing the FTGL library’s glyph functionality. It creates a test class FTGlyphTest that uses CppUnit to verify the behavior of the TestGlyph class, which inherits from FTGL’s FTGlyph. The tests cover constructors, rendering, and error handling, ensuring the glyph is correctly initialized and rendered.

1 #include <assert.h>

2

3 #include <cppunit/extensions/HelperMacros.h>

42 TestGlyph testGlyph(0);

43

44 CPPUNIT_ASSERT(0.0 == testGlyph.Advance());

45

46 CPPUNIT_ASSERT_DOUBLES_EQUAL(0, testGlyph.BBox().Upper().Y(), 0.01);

47

48 CPPUNIT_ASSERT_EQUAL(testGlyph.Error(), 0);

49 }

50

57 float testPoint = 47.0;

58 float nextPoint = testGlyph.Advance();

59 CPPUNIT_ASSERT_DOUBLES_EQUAL(testPoint, nextPoint, 0.0001);

60

61 CPPUNIT_ASSERT_DOUBLES_EQUAL(51.39, testGlyph.BBox().Upper().Y(), 0.01);

c_runtime.cpp (https://bitbucket.org/ultra_iter/qt-vtl.git) C++ · 85 lines

50 bool result;

51 {

52 JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly);

53 result = obj->_class->getProperty(obj, _fieldIdentifier, &property);

54 CInstance::moveGlobalExceptionToExecState(exec);

72

73 {

74 JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly);

75 obj->_class->setProperty(obj, _fieldIdentifier, &variant);

76 CInstance::moveGlobalExceptionToExecState(exec);

python.xml (https://jedit.svn.sourceforge.net/svnroot/jedit) XML · 399 lines

84 <KEYWORD1>and</KEYWORD1>

85 <KEYWORD1>as</KEYWORD1>

86 <KEYWORD1>assert</KEYWORD1>

87 <KEYWORD1>break</KEYWORD1>

88 <KEYWORD1>class</KEYWORD1>

190 <!-- exceptions -->

191 <KEYWORD3>ArithmeticError</KEYWORD3>

192 <KEYWORD3>AssertionError</KEYWORD3>

193 <KEYWORD3>AttributeError</KEYWORD3>

194 <KEYWORD3>DeprecationWarning</KEYWORD3>

expint.hpp (http://hadesmem.googlecode.com/svn/trunk/) C++ Header · 0 lines ✨ Summary

This C++ header file implements the exponential integral function expint for various data types and precision levels, including floating-point numbers, integers, and long double. It provides a generic implementation that can be used with different policies and precision settings, allowing for flexible and efficient computation of the exponential integral.

32 {

33 // this function is never actually called

34 BOOST_ASSERT(0);

35 return z;

36 }

concepts.hpp (http://hadesmem.googlecode.com/svn/trunk/) C++ Header · 0 lines ✨ Summary

This C++ header file defines a class BoostRegexConcept that provides a test framework for Boost Regex. It includes various functions and classes to test different aspects of Boost Regex, such as pattern matching, replacement, and iteration. The code is designed to be used in conjunction with the Boost Regex library to verify its functionality.

24 #include <boost/type_traits/is_enum.hpp>

25 #include <boost/type_traits/is_base_and_derived.hpp>

26 #include <boost/static_assert.hpp>

27 #ifndef BOOST_TEST_TR1_REGEX

28 #include <boost/regex.hpp>

331 ignore_unused_variable_warning(mopts);

332

333 BOOST_STATIC_ASSERT((::boost::is_enum<global_regex_namespace::regex_constants::error_type>::value));

334 global_regex_namespace::regex_constants::error_type e1 = global_regex_namespace::regex_constants::error_collate;

335 ignore_unused_variable_warning(e1);

359 ignore_unused_variable_warning(e1);

360

361 BOOST_STATIC_ASSERT((::boost::is_base_and_derived<std::runtime_error, global_regex_namespace::regex_error>::value ));

362 const global_regex_namespace::regex_error except(e1);

363 e1 = except.code();

TextAdapter.js (http://enginey.googlecode.com/svn/trunk/) JavaScript · 26 lines ✨ Summary

This JavaScript code defines a test suite for the dojox.wire.TextAdapter class, which is used to extract values from an object based on specified properties and segments. The tests verify that the adapter correctly extracts values with and without a delimiter. It checks if the adapter returns the expected output for different scenarios, ensuring its functionality.

11 var segments = [{property: "a"}, {property: "b"}, {property: "c"}];

12 var value = new dojox.wire.TextAdapter({object: source, segments: segments}).getValue();

13 t.assertEqual("abc", value);

14 },

15

18 var segments = [{property: "a"}, {property: "b"}, {property: "c"}];

19 var value = new dojox.wire.TextAdapter({object: source, segments: segments, delimiter: "/"}).getValue();

20 t.assertEqual("a/b/c", value);

21 }

22

testnullinvocation.bsh (http://beanshell2.googlecode.com/svn/trunk/) Unknown · 49 lines

36 String [] strings = { null, null };

37 s=strings[0];

38 assert( s == null );

39 try {

40 s.foo();

44 }

45

46 assert( flag() == 4 );

47

48 complete();

Deque.h (https://bitbucket.org/ultra_iter/qt-vtl.git) C Header · 688 lines

75 const_reverse_iterator rend() const { return const_reverse_iterator(this, m_start); }

76

77 T& first() { ASSERT(m_start != m_end); return m_buffer.buffer()[m_start]; }

78 const T& first() const { ASSERT(m_start != m_end); return m_buffer.buffer()[m_start]; }

264 // In this implementation a capacity of 1 would confuse append() and

265 // other places that assume the index after capacity - 1 is 0.

266 ASSERT(m_buffer.capacity() != 1);

267

268 if (!m_buffer.capacity()) {

269 ASSERT(!m_start);

270 ASSERT(!m_end);

271 } else {

272 ASSERT(m_start < m_buffer.capacity());

273 ASSERT(m_end < m_buffer.capacity());

JSSpeechInputResult.cpp (https://bitbucket.org/ultra_iter/qt-vtl.git) C++ · 191 lines

34 namespace WebCore {

35

36 ASSERT_CLASS_FITS_IN_CELL(JSSpeechInputResult);

37

38 /* Hash table */

87 : DOMConstructorObject(structure, globalObject)

88 {

89 ASSERT(inherits(&s_info));

90 putDirect(exec->globalData(), exec->propertyNames().prototype, JSSpeechInputResultPrototype::self(exec, globalObject), DontDelete | ReadOnly);

91 }

128 , m_impl(impl)

129 {

130 ASSERT(inherits(&s_info));

131 }

132

InlineBox.cpp (https://bitbucket.org/ultra_iter/qt-vtl.git) C++ · 382 lines

73 void InlineBox::operator delete(void* ptr, size_t sz)

74 {

75 ASSERT(inInlineBoxDetach);

76

77 // Stash size where destroy can find it.

133 return isHorizontal() ? toRenderBox(m_renderer)->height() : toRenderBox(m_renderer)->width();

134

135 ASSERT(isInlineFlowBox());

136 RenderBoxModelObject* flowObject = boxModelObject();

137 const FontMetrics& fontMetrics = renderer()->style(m_firstLine)->fontMetrics();

234 if (m_parent)

235 return m_parent->root();

236 ASSERT(isRootInlineBox());

237 return static_cast<const RootInlineBox*>(this);

238 }

InlineBox.h (https://bitbucket.org/ultra_iter/qt-vtl.git) C Header · 397 lines

171 virtual int virtualLogicalHeight() const

172 {

173 ASSERT_NOT_REACHED();

174 return 0;

175 }

180 virtual IntRect calculateBoundaries() const

181 {

182 ASSERT_NOT_REACHED();

183 return IntRect();

184 }

198 void setNextOnLine(InlineBox* next)

199 {

200 ASSERT(m_parent || !next);

201 m_next = next;

202 }

StringImplBase.h (https://bitbucket.org/ultra_iter/qt-vtl.git) C Header · 100 lines

53 , m_length(length)

54 {

55 ASSERT(isStringImpl());

56 }

57

61 , m_length(length)

62 {

63 ASSERT(isStringImpl());

64 }

65

71 , m_length(0)

72 {

73 ASSERT(!isStringImpl());

74 }

75

JSWebGLUniformLocation.cpp (https://bitbucket.org/ultra_iter/qt-vtl.git) C++ · 167 lines

32 namespace WebCore {

33

34 ASSERT_CLASS_FITS_IN_CELL(JSWebGLUniformLocation);

35

36 /* Hash table */

83 : DOMConstructorObject(structure, globalObject)

84 {

85 ASSERT(inherits(&s_info));

86 putDirect(exec->globalData(), exec->propertyNames().prototype, JSWebGLUniformLocationPrototype::self(exec, globalObject), DontDelete | ReadOnly);

87 }

124 , m_impl(impl)

125 {

126 ASSERT(inherits(&s_info));

127 }

128

mbcache.c (http://omnia2droid.googlecode.com/svn/trunk/) C · 680 lines ✨ Summary

This C code implements a cache management system for Linux. It provides functions to find and retrieve cached data based on various criteria, such as device and key. The cache is designed to be thread-safe and can be used in multiple reader scenarios. The code also includes initialization and exit routines for the module.

44 printk("\n"); \

45 } while (0)

46 #define mb_assert(c) do { if (!(c)) \

47 printk(KERN_ERR "assertion " #c " failed\n"); \

49 #else

50 # define mb_debug(f...) do { } while(0)

51 # define mb_assert(c) do { } while(0)

52 #endif

53 #define mb_error(f...) do { \

148 struct mb_cache *cache = ce->e_cache;

149

150 mb_assert(!(ce->e_used || ce->e_queued));

151 if (cache->c_op.free && cache->c_op.free(ce, gfp_mask)) {

152 /* free failed -- put back on the lru list

175 if (!__mb_cache_entry_is_hashed(ce))

176 goto forget;

177 mb_assert(list_empty(&ce->e_lru_list));

178 list_add_tail(&ce->e_lru_list, &mb_cache_lru_list);

179 }

template_type_namespace_runme.m (https://swig.svn.sourceforge.net/svnroot/swig) Objective C · 6 lines

1 template_type_namespace

2

3 assert(strcmp(foo()(1),"foo"));

4

5

zone.hh (git://github.com/ticking/self.git) C++ Header · 270 lines ✨ Summary

This C++ header file defines a memory management system for a compiler, specifically for handling nmethods (optimized methods). It provides classes and functions for managing memory allocation, deallocation, and usage tracking, as well as features like LRU caching and frame chaining. The code is designed to be used in a compiler environment, with various zones (memory regions) and objects (nmethods) that interact with each other.

102 // frame chaining: see FrameChainer below

103 void chainFrames() {

104 assert(frame_chain_nesting >= 0, "frame_chain_nesting should be nonnegative");

105 if (frame_chain_nesting++ == 0) doChainFrames();

106 }

107 void unchainFrames() {

108 assert(frame_chain_nesting > 0, "frame_chain_nesting should be positive");

109 if (--frame_chain_nesting == 0) doUnchainFrames();

110 }

XMLHttpRequest.cpp (https://bitbucket.org/ultra_iter/qt-vtl.git) C++ · 1131 lines

202 Document* XMLHttpRequest::document() const

203 {

204 ASSERT(scriptExecutionContext()->isDocument());

205 return static_cast<Document*>(scriptExecutionContext());

206 }

404 clearRequest();

405

406 ASSERT(m_state == UNSENT);

407

408 if (!isValidToken(method)) {

431 m_async = async;

432

433 ASSERT(!m_loader);

434

435 // Check previous state to avoid dispatching readyState event

nodeGen.cpp (git://github.com/ticking/self.git) C++ · 469 lines ✨ Summary

This C++ code is part of a compiler implementation, specifically responsible for generating branch instructions (if-else statements) in machine code. It creates nodes and merges them to represent conditional branches, allowing the compiler to decide which path to take based on the program’s logic. The generated code is optimized for performance and minimizes unnecessary operations.

36 void NodeGen::enterScope(SSelfScope* s) { scopeStack->push(s); }

37 void NodeGen::exitScope (SSelfScope* s) {

38 assert(currentScope() == s, "exiting wrong scope");

39 scopeStack->pop();

40 }

42 void NodeGen::prologue(bool needToFlushRegWindow, bool isAccessMethod,

43 fint nargs) {

44 assert(current == NULL, "prologue must be first");

45 current = start = new PrologueNode(needToFlushRegWindow, isAccessMethod,

46 nargs, L);

71

72 void NodeGen::loadSaved(PReg* frame, nmethod* nm, NameDesc* nd, PReg* dest, oop name) {

73 assert(!nd || !nd->isValue(), "should have a location");

74 APPEND(new LoadStackNode(frame, nm, nd, dest, name));

75 }

ReplaceForEachLoopWithIndexedForLoopIntention.java (https://bitbucket.org/nbargnesi/idea.git) Java · 272 lines

227 final Project project = context.getProject();

228 final PsiType iteratedValueType = iteratedValue.getType();

229 assert iteratedValueType != null;

230 final PsiElementFactory elementFactory =

231 JavaPsiFacade.getElementFactory(project);