<commit_before><?php


class jjwg_AreasTest extends PHPUnit_Framework_TestCase {

 
    public function testjjwg_Areas() {

    	//execute the contructor and check for the Object type and  attributes
    	$jjwgAreas = new jjwg_Areas();
    	
    	$this->assertInstanceOf('jjwg_Areas',$jjwgAreas);
    	$this->assertInstanceOf('Basic',$jjwgAreas);
    	$this->assertInstanceOf('SugarBean',$jjwgAreas);
    	 
    	$this->assertAttributeEquals('jjwg_Areas', 'module_dir', $jjwgAreas);
    	$this->assertAttributeEquals('jjwg_Areas', 'object_name', $jjwgAreas);
    	$this->assertAttributeEquals('jjwg_areas', 'table_name', $jjwgAreas);
    	 
    	$this->assertAttributeEquals(true, 'new_schema', $jjwgAreas);
    	$this->assertAttributeEquals(true, 'importable', $jjwgAreas);
    	$this->assertAttributeEquals(true, 'disable_row_level_security', $jjwgAreas);
    	
    	$this->assertAttributeEquals(null, 'polygon', $jjwgAreas);
    	$this->assertAttributeEquals(true, 'point_on_vertex', $jjwgAreas);
    	$this->assertAttributeEquals(0, 'area', $jjwgAreas);
    	$this->assertAttributeEquals(null, 'centroid', $jjwgAreas);
    	
    	
    }


    public function testconfiguration() {

    	error_reporting(E_ERROR | E_PARSE);
    	
    	$jjwgAreas = new jjwg_Areas();
    	$jjwgAreas->configuration();
    	
    	$this->assertInstanceOf('jjwg_Maps',$jjwgAreas->jjwg_Maps);
    	$this->assertTrue(is_array($jjwgAreas->settings));
    	$this->assertGreaterThan(0,count($jjwgAreas->settings));
    	
    }


    public function testretrieve() {

    	$jjwgAreas = new jjwg_Areas();
    	
    	
    	//test without pre settting attributes
    	$jjwgAreas->retrieve();
    	$this->assertEquals(false ,$jjwgAreas->polygon);
    	$this->assertEquals(0,$jjwgAreas->area);
    	$this->assertEquals(null,$jjwgAreas->centroid);
    	
    	
    	//test with required attributes preset
    	$jjwgAreas->coordinates= "100,80,10\r\n101,81,11\r\n102,82,12";
    	
    	$expected_polygon = array (
    			array ('lng' => '100', 'lat' => '80','elv' => '10' ),
    			array ('lng' => '101', 'lat' => '81', 'elv' => '11'),
    			array ('lng' => '102', 'lat' => '82', 'elv' => '12' )
    	);
    	$expected_centroid = array("lng"=>67.3333333333333285963817615993320941925048828125, "lat" =>54.0, "elv"=>0);
    	
    	$jjwgAreas->retrieve();
    	
    	$this->assertSame($expected_polygon ,$jjwgAreas->polygon);
    	$this->assertEquals(20,$jjwgAreas->area);
    	$this->assertSame($expected_centroid,$jjwgAreas->centroid);
    	     	
    }


    public function testdefine_polygon() {

    	$jjwgAreas = new jjwg_Areas();

    	//test without pre settting attributes
    	$actual = $jjwgAreas->define_polygon();
    	$this->assertEquals(false, $actual);
    	
    	
    	//test with required attributes preset
    	$jjwgAreas->coordinates= "100,80,10\r\n101,81,11\r\n102,82,12";
    	$expected = array (
					  array ('lng' => '100', 'lat' => '80','elv' => '10' ),
					  array ('lng' => '101', 'lat' => '81', 'elv' => '11'),
					  array ('lng' => '102', 'lat' => '82', 'elv' => '12' )
				);
    	$actual = $jjwgAreas->define_polygon();
		$this->assertSame($actual, $expected);
    	
    }


    public function testdefine_area_loc() {

    	$jjwgAreas = new jjwg_Areas();
    	
		//test without pre settting attributes 
    	$result = $jjwgAreas->define_area_loc();    	
    	$this->assertEquals("N/A", $result['name']);
    	$this->assertTrue(is_numeric($result['lat']));
    	$this->assertTrue(is_numeric($result['lng']));
    	
    	
    	//test with required attributes preset
    	$jjwgAreas->name = "test";
    	$jjwgAreas->centroid = array("lng"=> 100 , "lat"=> 50);
    	
    	$expected = array("name"=>"test", "lat"=>50, "lng"=>100);
    	$result = $jjwgAreas->define_area_loc();
		$this->assertSame($expected, $result);
    			
    }


    public function testdefine_centroid() {
        
    	$jjwgAreas = new jjwg_Areas();
    	
    	//test without setting up coordinates
    	$result = $jjwgAreas->define_centroid();
    	$this->assertEquals(null, $result);
    	
    	
    	//test with coordinates setup 
    	$jjwgAreas->coordinates= "100,80,10\r\n101,81,11\r\n102,82,12";
    	$expected = array("lng"=>67.3333333333333285963817615993320941925048828125, "lat" =>54.0, "elv"=>0);
    	
    	$result = $jjwgAreas->define_centroid();
    	$this->assertSame($expected,$result);
    
    }
    

    public function testdefine_area() {

    	$jjwgAreas = new jjwg_Areas();
    	 
    	//test without setting up coordinates
    	$result = $jjwgAreas->define_area();
    	$this->assertEquals(0, $result);
    	
    	
    	//test with coordinates setup
    	$jjwgAreas->coordinates= "100,80,10\r\n101,81,11\r\n102,82,12";
  	 
    	$result = $jjwgAreas->define_area();
    	$this->assertEquals(20,$result);    	
    	
    }<commit_msg>Skip the area tests pending feedback.<commit_after><?php


class jjwg_AreasTest extends PHPUnit_Framework_TestCase {

 
    public function testjjwg_Areas() {

    	//execute the contructor and check for the Object type and  attributes
    	$jjwgAreas = new jjwg_Areas();
    	
    	$this->assertInstanceOf('jjwg_Areas',$jjwgAreas);
    	$this->assertInstanceOf('Basic',$jjwgAreas);
    	$this->assertInstanceOf('SugarBean',$jjwgAreas);
    	 
    	$this->assertAttributeEquals('jjwg_Areas', 'module_dir', $jjwgAreas);
    	$this->assertAttributeEquals('jjwg_Areas', 'object_name', $jjwgAreas);
    	$this->assertAttributeEquals('jjwg_areas', 'table_name', $jjwgAreas);
    	 
    	$this->assertAttributeEquals(true, 'new_schema', $jjwgAreas);
    	$this->assertAttributeEquals(true, 'importable', $jjwgAreas);
    	$this->assertAttributeEquals(true, 'disable_row_level_security', $jjwgAreas);
    	
    	$this->assertAttributeEquals(null, 'polygon', $jjwgAreas);
    	$this->assertAttributeEquals(true, 'point_on_vertex', $jjwgAreas);
    	$this->assertAttributeEquals(0, 'area', $jjwgAreas);
    	$this->assertAttributeEquals(null, 'centroid', $jjwgAreas);
    	
    	
    }


    public function testconfiguration() {

    	error_reporting(E_ERROR | E_PARSE);
    	
    	$jjwgAreas = new jjwg_Areas();
    	$jjwgAreas->configuration();
    	
    	$this->assertInstanceOf('jjwg_Maps',$jjwgAreas->jjwg_Maps);
    	$this->assertTrue(is_array($jjwgAreas->settings));
    	$this->assertGreaterThan(0,count($jjwgAreas->settings));
    	
    }


    public function testretrieve() {
        $this->markTestSkipped("Skipped pending feedback on the area behaviour.");
    	$jjwgAreas = new jjwg_Areas();
    	
    	
    	//test without pre settting attributes
    	$jjwgAreas->retrieve();
    	$this->assertEquals(false ,$jjwgAreas->polygon);
    	$this->assertEquals(0,$jjwgAreas->area);
    	$this->assertEquals(null,$jjwgAreas->centroid);
    	
    	
    	//test with required attributes preset
    	$jjwgAreas->coordinates= "100,80,10\r\n101,81,11\r\n102,82,12";
    	
    	$expected_polygon = array (
    			array ('lng' => '100', 'lat' => '80','elv' => '10' ),
    			array ('lng' => '101', 'lat' => '81', 'elv' => '11'),
    			array ('lng' => '102', 'lat' => '82', 'elv' => '12' )
    	);
    	$expected_centroid = array("lng"=>67.3333333333333285963817615993320941925048828125, "lat" =>54.0, "elv"=>0);
    	
    	$jjwgAreas->retrieve();
    	
    	$this->assertSame($expected_polygon ,$jjwgAreas->polygon);
    	$this->assertEquals(20,$jjwgAreas->area);
    	$this->assertSame($expected_centroid,$jjwgAreas->centroid);
    	     	
    }


    public function testdefine_polygon() {

    	$jjwgAreas = new jjwg_Areas();

    	//test without pre settting attributes
    	$actual = $jjwgAreas->define_polygon();
    	$this->assertEquals(false, $actual);
    	
    	
    	//test with required attributes preset
    	$jjwgAreas->coordinates= "100,80,10\r\n101,81,11\r\n102,82,12";
    	$expected = array (
					  array ('lng' => '100', 'lat' => '80','elv' => '10' ),
					  array ('lng' => '101', 'lat' => '81', 'elv' => '11'),
					  array ('lng' => '102', 'lat' => '82', 'elv' => '12' )
				);
    	$actual = $jjwgAreas->define_polygon();
		$this->assertSame($actual, $expected);
    	
    }


    public function testdefine_area_loc() {

    	$jjwgAreas = new jjwg_Areas();
    	
		//test without pre settting attributes 
    	$result = $jjwgAreas->define_area_loc();    	
    	$this->assertEquals("N/A", $result['name']);
    	$this->assertTrue(is_numeric($result['lat']));
    	$this->assertTrue(is_numeric($result['lng']));
    	
    	
    	//test with required attributes preset
    	$jjwgAreas->name = "test";
    	$jjwgAreas->centroid = array("lng"=> 100 , "lat"=> 50);
    	
    	$expected = array("name"=>"test", "lat"=>50, "lng"=>100);
    	$result = $jjwgAreas->define_area_loc();
		$this->assertSame($expected, $result);
    			
    }


    public function testdefine_centroid() {
        $this->markTestSkipped("Skipped pending feedback on the area behaviour.");
    	$jjwgAreas = new jjwg_Areas();
    	
    	//test without setting up coordinates
    	$result = $jjwgAreas->define_centroid();
    	$this->assertEquals(null, $result);
    	
    	
    	//test with coordinates setup 
    	$jjwgAreas->coordinates= "100,80,10\r\n101,81,11\r\n102,82,12";
    	$expected = array("lng"=>67.3333333333333285963817615993320941925048828125, "lat" =>54.0, "elv"=>0);
    	
    	$result = $jjwgAreas->define_centroid();
    	$this->assertSame($expected,$result);
    
    }
    

    public function testdefine_area() {
        $this->markTestSkipped("Skipped pending feedback on the area behaviour.");
    	$jjwgAreas = new jjwg_Areas();
    	 
    	//test without setting up coordinates
    	$result = $jjwgAreas->define_area();
    	$this->assertEquals(0, $result);
    	
    	
    	//test with coordinates setup
    	$jjwgAreas->coordinates= "100,80,10\r\n101,81,11\r\n102,82,12";
  	 
    	$result = $jjwgAreas->define_area();
    	$this->assertEquals(20,$result);    	
    	
    }
{'fraction_non_alphanumeric': 0.16817906836055657, 'fraction_numerical': 0.05001008267795927, 'mean_word_length': 3.201185938161796, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 180, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2134870', 'n_tokens_mistral': 4153, 'n_tokens_neox': 3649, 'n_words': 546}