text:
//
//  FilterVC.m
//  MyChat
//
//  Created by Mac on 15/9/11.
//  Copyright © 2015年 Zeng. All rights reserved.
//

#import "QRCodeVC.h"
#import "UIImage+QRCodeImage.h"
#import "Account.h"
@interface QRCodeVC ()
@property (weak, nonatomic) IBOutlet UIImageView *QRCodeImageView;

@end

@implementation QRCodeVC

- (void)viewDidLoad {
    [super viewDidLoad];
    _QRCodeImageView.image = [UIImage createQRForString:[Account shareInstance].loginUser];
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    [self.navigationController popViewControllerAnimated:YES];
}

/**
 * 分享
 */
- (IBAction)Reply:(id)sender {

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)dealloc{
    NSLog(@"QRCodeVC 销毁");
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end


text:
package org.gradle.api.internal.tasks.compile.incremental.analyzer.annotations;

public class UsesAnnotationInField {
    @SomeRuntimeAnnotation int x;
}

redpajama_set_name: RedPajamaGithub


text:
package org.apache.cassandra.service;

import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.Map;

import org.apache.cassandra.db.ColumnFamily;
import org.apache.cassandra.db.ReadResponse;
import org.apache.cassandra.db.Row;
import org.apache.cassandra.net.Message;

public class RowDigestResolver extends AbstractRowResolver
{
    public RowDigestResolver(String table, ByteBuffer key)
    {
        super(key, table);
    }

    public Row getData() throws IOException
    {
        for (Map.Entry<Message, ReadResponse> entry : replies.entrySet())
        {
            ReadResponse result = entry.getValue();
            if (!result.isDigestQuery())
                return result.row();
        }

        throw new AssertionError("getData should not be invoked when no data is present");
    }

    /*
     * This method handles two different scenarios:
     *
     * a) we're handling the initial read, of data from the closest replica + digests
     *    from the rest.  In this case we check the digests against each other,
     *    throw an exception if there is a mismatch, otherwise return the data row.
     *
     * b) we're checking additional digests that arrived after the minimum to handle
     *    the requested ConsistencyLevel, i.e. asynchronous read repair check
     */
    public Row resolve() throws DigestMismatchException, IOException
    {
        if (logger.isDebugEnabled())
            logger.debug("resolving " + replies.size() + " responses");

        long startTime = System.currentTimeMillis();
		ColumnFamily data = null;

        // validate digests against each other; throw immediately on mismatch.
        // also, collects data results into versions/endpoints lists.
        //
        // results are cleared as we process them, to avoid unnecessary duplication of work
        // when resolve() is called a second time for read repair on responses that were not
        // necessary to satisfy ConsistencyLevel.
        ByteBuffer digest = null;
        for (Map.Entry<Message, ReadResponse> entry : replies.entrySet())
        {
            ReadResponse response = entry.getValue();
            if (response.isDigestQuery())
            {
                if (digest == null)
                {
                    digest = response.digest();
                }
                else
                {
                    ByteBuffer digest2 = response.digest();
                    if (!digest.equals(digest2))
                        throw new DigestMismatchException(key, digest, digest2);
                }
            }
            else
            {
                data = response.row().cf;
            }
        }

		// Compare digest (only one, since we threw earlier if there were different replies)
        // with the data response. If there is a mismatch then throw an exception so that read repair can happen.
        //
        // It's important to note that we do not consider the possibility of multiple data responses --
        // that can only happen when we're doing the repair post-mismatch, and will be handled by RowRepairResolver.
        if (digest != null)
        {
            ByteBuffer digest2 = ColumnFamily.digest(data);
            if (!digest.equals(digest2))
                throw new DigestMismatchException(key, digest, digest2);
            if (logger.isDebugEnabled())
                logger.debug("digests verified");
        }

        if (logger.isDebugEnabled())
            logger.debug("resolve: " + (System.currentTimeMillis() - startTime) + " ms.");
		return new Row(key, data);
	}

    public boolean isDataPresent()
	{
        for (ReadResponse result : replies.values())
        {
            if (!result.isDigestQuery())
                return true;
        }
        return false;
    }
}


text:
package api

import (
	"fmt"
	"strings"
	"testing"
)

func TestDeploymentAPINotImplemented(t *testing.T) {
	yaml := `
apiVersion: apps/v1222
kind: Deployment
metadata:
  name: my-nginx
spec:
  replicas: 4
  template:
    metadata:
      labels:
        run: my-nginx
    spec:
      containers:
      - name: my-nginx
        image: nginx
        ports:
          - containerPort: 80
        resources:
          requests:
            memory: "64Mi"
            cpu: "250m"
          limits:
            memory: "64M"
            cpu: 1`

	_, err := decodeDeployment([]byte(yaml), CostimatorConfig{})
	if err == nil || !strings.HasPrefix(err.Error(), "Error Decoding.") {
		t.Error(fmt.Errorf("Should have return an APIVersion error, but returned '%+v'", err))
	}
}

func TestDeploymentBasicV1(t *testing.T) {
	yaml := `
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-nginx
spec:
  replicas: 4
  template:
    metadata:
      labels:
        run: my-nginx
    spec:
      containers:
      - name: my-nginx
        image: nginx
        ports:
          - containerPort: 80
        resources:
          requests:
            memory: "64Mi"
            cpu: "250m"
          limits:
            memory: "64M"
            cpu: 1`

	deploy, err := decodeDeployment([]byte(yaml), CostimatorConfig{})
	if err != nil {
		t.Error(err)
		return
	}

	expectedAPIVersionKindName := "apps/v1|Deployment|default|my-nginx"
	if got := deploy.APIVersionKindName; got != expectedAPIVersionKindName {
		t.Errorf("Expected APIVersionKindName %+v, got %+v", expectedAPIVersionKindName, got)
	}

	expectedKindName := "|Deployment|default|my-nginx"
	if got := deploy.getKindName(); got != expectedKindName {
		t.Errorf("Expected KindName %+v, got %+v", expectedKindName, got)
	}

	expected := int32(4)
	if got := deploy.Replicas; got != expected {
		t.Errorf("Expected Replicas %+v, got %+v", expected, got)
	}

	expectedRequestsCPU := int64(250)
	expectedRequestsMemory := int64(67108864)
	container := deploy.Containers[0]
	requests := container.Requests
	if requests.CPU != expectedRequestsCPU {
		t.Errorf("Expected Requests CPU %+v, got %+v", expectedRequestsCPU, requests.CPU)
	}
	if requests.Memory != expectedRequestsMemory {
		t.Errorf("Expected Requests Memory %+v, got %+v", expectedRequestsMemory, requests.Memory)
	}

	expectedLimitsCPU := int64(1000)
	expectedLimitsMemory := int64(64000000)
	limits := container.Limits
	if limits.CPU != expectedLimitsCPU {
		t.Errorf("Expected Limits CPU %+v, got %+v", expectedLimitsCPU, limits.CPU)
	}
	if limits.Memory != expectedLimitsMemory {
		t.Errorf("Expected Limits Memory %+v, got %+v", expectedLimitsMemory, limits.Memory)
	}

}

func TestDeploymentBasicV1beta1(t *testing.T) {
	yaml := `
apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: my-nginx
spec:
  replicas: 4
  template:
    metadata:
      labels:
        run: my-nginx
    spec:
      containers:
      - name: my-nginx
        image: nginx
        ports:
          - containerPort: 80
        resources:
          requests:
            memory: "64Mi"
            cpu: "250m"
          limits:
            memory: "64M"
            cpu: 1`

	deploy, err := decodeDeployment([]byte(yaml), CostimatorConfig{})
	if err != nil {
		t.Error(err)
		return
	}

	expectedAPIVersionKindName := "apps/v1beta1|Deployment|default|my-nginx"
	if got := deploy.APIVersionKindName; got != expectedAPIVersionKindName {
		t.Errorf("Expected APIVersionKindName %+v, got %+v", expectedAPIVersionKindName, got)
	}

	expectedKindName := "|Deployment|default|my-nginx"
	if got := deploy.getKindName(); got != expectedKindName {
		t.Errorf("Expected KindName %+v, got %+v", expectedKindName, got)
	}

	expected := int32(4)
	if got := deploy.Replicas; got != expected {
		t.Errorf("Expected Replicas %+v, got %+v", expected, got)
	}

	expectedRequestsCPU := int64(250)
	expectedRequestsMemory := int64(67108864)
	container := deploy.Containers[0]
	requests := container.Requests
	if requests.CPU != expectedRequestsCPU {
		t.Errorf("Expected Requests CPU %+v, got %+v", expectedRequestsCPU, requests.CPU)
	}
	if requests.Memory != expectedRequestsMemory {
		t.Errorf("Expected Requests Memory %+v, got %+v", expectedRequestsMemory, requests.Memory)
	}

	expectedLimitsCPU := int64(1000)
	expectedLimitsMemory := int64(64000000)
	limits := container.Limits
	if limits.CPU != expectedLimitsCPU {
		t.Errorf("Expected Limits CPU %+v, got %+v", expectedLimitsCPU, limits.CPU)
	}
	if limits.Memory != expectedLimitsMemory {
		t.Errorf("Expected Limits Memory %+v, got %+v", expectedLimitsMemory, limits.Memory)
	}

}

func TestDeploymentBasicV1beta2(t *testing.T) {
	yaml := `
apiVersion: apps/v1beta2
kind: Deployment
metadata:
  name: my-nginx
spec:
  replicas: 4
  template:
    metadata:
      labels:
        run: my-nginx
    spec:
      containers:
      - name: my-nginx
        image: nginx
        ports:
          - containerPort: 80
        resources:
          requests:
            memory: "64Mi"
            cpu: "250m"
          limits:
            memory: "64M"
            cpu: 1`

	deploy, err := decodeDeployment([]byte(yaml), CostimatorConfig{})
	if err != nil {
		t.Error(err)
		return
	}

	expectedAPIVersionKindName := "apps/v1beta2|Deployment|default|my-nginx"
	if got := deploy.APIVersionKindName; got != expectedAPIVersionKindName {
		t.Errorf("Expected APIVersionKindName %+v, got %+v", expectedAPIVersionKindName, got)
	}

	expectedKindName := "|Deployment|default|my-nginx"
	if got := deploy.getKindName(); got != expectedKindName {
		t.Errorf("Expected KindName %+v, got %+v", expectedKindName, got)
	}

	expected := int32(4)
	if got := deploy.Replicas; got != expected {
		t.Errorf("Expected Replicas %+v, got %+v", expected, got)
	}

	expectedRequestsCPU := int64(250)
	expectedRequestsMemory := int64(67108864)
	container := deploy.Containers[0]
	requests := container.Requests
	if requests.CPU != expectedRequestsCPU {
		t.Errorf("Expected Requests CPU %+v, got %+v", expectedRequestsCPU, requests.CPU)
	}
	if requests.Memory != expectedRequestsMemory {
		t.Errorf("Expected Requests Memory %+v, got %+v", expectedRequestsMemory, requests.Memory)
	}

	expectedLimitsCPU := int64(1000)
	expectedLimitsMemory := int64(64000000)
	limits := container.Limits
	if limits.CPU != expectedLimitsCPU {
		t.Errorf("Expected Limits CPU %+v, got %+v", expectedLimitsCPU, limits.CPU)
	}
	if limits.Memory != expectedLimitsMemory {
		t.Errorf("Expected Limits Memory %+v, got %+v", expectedLimitsMemory, limits.Memory)
	}

}

func TestDeploymentNoReplicas(t *testing.T) {
	yaml := `
apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: my-nginx
spec:
  template:
    metadata:
      labels:
        run: my-nginx
    spec:
      containers:
      - name: my-nginx
      image: nginx
      ports:
        - containerPort: 80`

	deploy, err := decodeDeployment([]byte(yaml), CostimatorConfig{})
	if err != nil {
		t.Error(err)
		return
	}

	if got := deploy.Replicas; got != 1 {
		t.Errorf("Expected 1 Replicas, got %+v", got)
	}
}

func TestDeploymentNoResources(t *testing.T) {
	yaml := `
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-nginx
spec:
  replicas: 2
  template:
    metadata:
      labels:
        run: my-nginx
    spec:
      containers:
      - name: my-nginx
        image: nginx
        ports:
        - containerPort: 80`

	deploy, err := decodeDeployment([]byte(yaml), CostimatorConfig{})
	if err != nil {
		t.Error(err)
		return
	}

	expectedKey := "apps/v1|Deployment|default|my-nginx"
	if got := deploy.APIVersionKindName; got != expectedKey {
		t.Errorf("Expected Key %+v, got %+v", expectedKey, got)
	}

	expectedReplicas := int32(2)
	if got := deploy.Replicas; got != expectedReplicas {
		t.Errorf("Expected Replicas %+v, got %+v", expectedReplicas, got)
	}

	container := deploy.Containers[0]
	defaults := ConfigDefaults()

	expectedRequestsCPU := defaults.ResourceConf.DefaultCPUinMillis
	expectedRequestsMemory := defaults.ResourceConf.DefaultMemoryinBytes
	requests := container.Requests
	if requests.CPU != expectedRequestsCPU {
		t.Errorf("Expected Requests CPU %+v, got %+v", expectedRequestsCPU, requests.CPU)
	}
	if requests.Memory != expectedRequestsMemory {
		t.Errorf("Expected Requests Memory %+v, got %+v", expectedRequestsMemory, requests.Memory)
	}

	expectedLimitsCPU := defaults.ResourceConf.DefaultCPUinMillis * 3
	expectedLimitsMemory := defaults.ResourceConf.DefaultMemoryinBytes * 3
	limits := container.Limits
	if limits.CPU != expectedLimitsCPU {
		t.Errorf("Expected Limits CPU %+v, got %+v", expectedLimitsCPU, limits.CPU)
	}
	if limits.Memory != expectedLimitsMemory {
		t.Errorf("Expected Limits Memory %+v, got %+v", expectedLimitsMemory, limits.Memory)
	}
}

func TestDeploymentNoLimits(t *testing.T) {
	yaml := `
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-nginx
spec:
  replicas: 2
  template:
    metadata:
      labels:
        run: my-nginx
    spec:
      containers:
      - name: my-nginx
        image: nginx
        ports:
          - containerPort: 80
        resources:
          requests:
            memory: "64M"
            cpu: "500m"`

	deploy, err := decodeDeployment([]byte(yaml), CostimatorConfig{})
	if err != nil {
		t.Error(err)
		return
	}

	expectedKey := "apps/v1|Deployment|default|my-nginx"
	if got := deploy.APIVersionKindName; got != expectedKey {
		t.Errorf("Expected Key %+v, got %+v", expectedKey, got)
	}

	expectedReplicas := int32(2)
	if got := deploy.Replicas; got != expectedReplicas {
		t.Errorf("Expected Replicas %+v, got %+v", expectedReplicas, got)
	}

	container := deploy.Containers[0]

	expectedRequestsCPU := int64(500)
	expectedRequestsMemory := int64(64000000)
	requests := container.Requests
	if requests.CPU != expectedRequestsCPU {
		t.Errorf("Expected Requests CPU %+v, got %+v", expectedRequestsCPU, requests.CPU)
	}
	if requests.Memory != expectedRequestsMemory {
		t.Errorf("Expected Requests Memory %+v, got %+v", expectedRequestsMemory, requests.Memory)
	}

	expectedLimitsCPU := expectedRequestsCPU * 3
	expectedLimitsMemory := expectedRequestsMemory * 3
	limits := container.Limits
	if limits.CPU != expectedLimitsCPU {
		t.Errorf("Expected Limits CPU %+v, got %+v", expectedLimitsCPU, limits.CPU)
	}
	if limits.Memory != expectedLimitsMemory {
		t.Errorf("Expected Limits Memory %+v, got %+v", expectedLimitsMemory, limits.Memory)
	}
}

func TestDeploymentNoRequests(t *testing.T) {
	yaml := `
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-nginx
spec:
  replicas: 2
  template:
    metadata:
      labels:
        run: my-nginx
    spec:
      containers:
      - name: my-nginx
        image: nginx
        ports:
          - containerPort: 80
        resources:
          limits:
            memory: "64M"
            cpu: "500m"`

	deploy, err := decodeDeployment([]byte(yaml), CostimatorConfig{})
	if err != nil {
		t.Error(err)
		return
	}

	container := deploy.Containers[0]
	requests := container.Requests
	limits := container.Limits

	expectedLimitsCPU := int64(500)
	expectedLimitsMemory := int64(64000000)
	if requests.CPU != expectedLimitsCPU {
		t.Errorf("Expected Requests CPU %+v, got %+v", expectedLimitsCPU, requests.CPU)
	}
	if requests.Memory != expectedLimitsMemory {
		t.Errorf("Expected Requests Memory %+v, got %+v", expectedLimitsMemory, requests.Memory)
	}
	if limits.CPU != expectedLimitsCPU {
		t.Errorf("Expected Limits CPU %+v, got %+v", expectedLimitsCPU, limits.CPU)
	}
	if limits.Memory != expectedLimitsMemory {
		t.Errorf("Expected Limits Memory %+v, got %+v", expectedLimitsMemory, limits.Memory)
	}
}

func TestDeploymentManyContainers(t *testing.T) {
	yaml := `
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-nginx
spec:
  replicas: 2
  template:
    metadata:
      labels:
        run: my-nginx
    spec:
      containers:
      - name: my-nginx
        image: nginx
        resources:
          requests:
            memory: "64Mi"
            cpu: "250m"
      - name: busybox
        image: busybox
        resources:
          requests:
            memory: "64Mi"
            cpu: "250m"
      initContainers:
      - name: busybox
        image: busybox
        resources:
          requests:
            memory: "64Mi"
            cpu: "250m"`

	deploy, err := decodeDeployment([]byte(yaml), CostimatorConfig{})
	if err != nil {
		t.Error(err)
		return
	}

	if len(deploy.Containers) != 2 {
		t.Errorf("Should have ignored initContainers")
	}

	expectedRequestsCPU := float64(0.5)
	expectedRequestsMemory := float64(134217728)
	cpuReq, _, memReq, _ := totalContainers(deploy.Containers)
	if cpuReq != expectedRequestsCPU {
		t.Errorf("Expected Requests CPU %+v, got %+v", expectedRequestsCPU, cpuReq)
	}
	if memReq != expectedRequestsMemory {
		t.Errorf("Expected Requests Memory %+v, got %+v", expectedRequestsMemory, memReq)
	}
}


text:
class QAction;
class QPoint;

namespace eja
{
	class entity;
	class entity_table_view;
	class router_client_model;

	class router_client_widget final : public entity_widget
	{
	private:
		// Action
		QAction* m_update_action = nullptr;

		// Table
		entity_table_view* m_table = nullptr;
		router_client_model* m_model = nullptr;

	private:
		// Interface
		virtual void on_update() override;

	private slots:
		void show_menu(const QPoint& point);

	public:
		router_client_widget(const std::shared_ptr<entity> entity, QWidget* parent = 0);
	};
}

#endif


text:
* Update gemspec to specify versions of hydra-batch-edit and hydra-collections [Jim Coble]

## 3.3.0
* Fix authorities deprecations [Justin Coyne]
* Fix deprecation on MailboxController [Justin Coyne]
* blacklight 4.4.1/0 doesn't work with kaminari > 0.14.1 See projectblacklight/blacklight#614 [Justin Coyne]
* Allow acts_as_follower to be 0.2.0 for Rails 4 support [Justin Coyne]
* Don't run blacklight and hydra generator twice [Justin Coyne]
* Remove deprecation warning on Rails 4 [Justin Coyne]
* Updating CONTRIBUTING.md as per Hydra v6.0.0 [Jeremy Friesen]
* use cancan to authorize and validate single-use tokens. [Chris Beer]
* Add ImageMagick as a software requirement in the README. [Jessie Keck]
* split SingleUseLinkController into the authenticated controller that creates links, and a viewer that handles retrieving content for token-bearing users [Chris Beer]
* remove explicit GenericFile references, and replace them with Rails magic [Chris Beer]
* Refactor single-use links for style and clarity [Chris Beer]
* add more gems to the gemfile for running tests from the gem root [Chris Beer]
* add redis-server to the .travis.yml list of  services [Chris Beer]
* Fix typos in README.md [Jessie Keck]

## 3.2.1
* Updating gemspec to not limit on sufia-models [Jeremy Friesen]

## 3.2.0 - YANKED
* Including on sufia-models subdir in gemspec [Jeremy Friesen]
* Restoring the exception catching for migrations [Jeremy Friesen]
* Publicizing #visibility_changed? [Jeremy Friesen]
* Indicating attr_accessible is deprecated [Jeremy Friesen]
* Removing ActiveModel::Dirty [Jeremy Friesen]
* Upgrading ActiveFedora to latest 6.5 version [Adam Wead]

## 3.1.3
* Removed old PSU licence [Justin Coyne]

* Moved access rights from curate [Justin Coyne]

* Adding an operride path where to redirect for when a file gets destroyed.
[Carolyn Cole]

* Use the deprecation settings on the correct module [Justin Coyne]

## 3.1.2
* Track changes on visibility [Justin Coyne]

* Use an ideomatic setter for visibility [Justin Coyne]

* Upgrade mailboxer [Justin Coyne]

* Adding a partial for the header of the dashboard to make the wording easier to
override. [Carolyn Cole]

* Improving the better migration template [Jeremy Friesen]

## 3.1.1
* Extracting sufia generator behavior [Jeremy Friesen]

* Don't use Sufia::Engine in the generated initializer [Justin Coyne]

* Removed unused code [Justin Coyne]

* Changed from a tag to span. fixes #32 [Carolyn Cole]

## 3.1.0
* Make fits instructions more verbose [Carolyn Cole]

* Adding one location to define/ override where the upload redirects to after a
sucessfull upload [Carolyn Cole]

* Added license to the gemspec [Justin Coyne]

* fixed typo in require statement [Matt Zumwalt]

* requires active_resource more cleanly [Matt Zumwalt]

* updating facet views so that the blacklight helper_method will get called
[Carolyn Cole]

* Adds a spec for the ImportUrlJob [Michael J. Giarlo]

* Fixed expecations for travis tests for #169 [Justin Coyne]

* ModelMethods#apply_depositor_metadata should accept a user or a string like the
method it overrides in HydraHead.  See:
https://github.com/projecthydra/hydra-head/blob/9a5b2728be2046125d09376a6d78ad06d26548c3/hydra-core/lib/hydra/model_methods.rb#L12
[Justin Coyne]

* Remove expand_path jazz from remaining specs [Michael J. Giarlo]

* Codifying a pid based job [Jeremy Friesen]

* Removing characterization save unless new_object? [Jeremy Friesen]

* Adding $LOAD_PATH variable to dev rake task [Jeremy Friesen]

* Bump dependency on hydra-derivatives [Justin Coyne]

* Use add_file() rather than add_file_datastream() to ensure object label is set
[Michael J. Giarlo]

* Audio and video transcoding with hydra-derivatives [Justin Coyne]

* Use hydra-derivatives for generating thumbnails [Justin Coyne]

* ingest_local_file should ingest the file, not the filename [Justin Coyne]

* Including deposit agreement on local import page [Matt Zumwalt]

* UI for local ingest only appears in local ingest tab on upload page [Matt
Zumwalt]

* Putting test coverage for virus check into the right place [Matt Zumwalt]

* local file ingest runs virus check [Matt Zumwalt]

* testing outputs without relying on consistent array ordering [Matt Zumwalt]

* UI text changes for local ingest [Matt Zumwalt]

* removing unused fixtures [Matt Zumwalt]

* cleanup of tests and method names around local ingest [Matt Zumwalt]

* Display local ingest tab in Upload page when local import enabled [Matt
Zumwalt]

* Local ingest renders graceful error message if User does not define a directory
path [Matt Zumwalt]

* fixing scope of describe blocks in this test [Matt Zumwalt]

* LocalFileIngestBehavior for FilesController [Matt Zumwalt]

* The generator should create config/initializers/resque_config.rb [Justin Coyne]

* Reindex everything scopes to sufia's namespace [Jeremy Friesen]

* Remove css that doesn't appear to be used [Justin Coyne]

## 3.0.0
* Update README.md paths for Sufia assets application.css and application.js [Jim
Coble]

* Moving resque rake task to sufia-models [Jeremy Friesen]

* Resque should use the redis instance configured in redis.yml [Justin Coyne]

* Profile link should generate a valid route. Fixes #150 [Justin Coyne]

* Updating CONTRIBUTING.md as per Hydra v6.0.0 [Jeremy Friesen]

* Delete all needs a delete HTTP method [Justin Coyne]

* Put the specific version of kaminari we need into the test app [Justin Coyne]

* Removed deprecated use of mock() and stub() [Justin Coyne]

* Simpler rspec run [Justin Coyne]

* Fix routing spec [Justin Coyne]

* Replaced cucumber with feature specs [Justin Coyne]

* Use resourceful routes for users [Justin Coyne]

* Removed duplicate tasks [Justin Coyne]

* Switch require spec_helper to relative [Justin Coyne]

* Support rspec-rails 2.14 [Justin Coyne]

* Removed empty tests [Justin Coyne]

* Correct path for fonts [Justin Coyne]

* Use assets_path [Justin Coyne]

* Fix path to fixtures.rake [Justin Coyne]

* Add active_resource as a dependency [Justin Coyne]

* Distinct on notify_number is unnecessary [Justin Coyne]

* check all view, should supply the controller [Justin Coyne]

* Removed unused spec [Justin Coyne]

* Fixed path to rakefile [Justin Coyne]

* Fix test to work in an order independent manner [Justin Coyne]

* Single Use links should be randomly generated [Justin Coyne]

* Update paperclip gem [Justin Coyne]

* Handle attributes in a way that works with rails 3 or 4 [Justin Coyne]

* Fixed view spec [Justin Coyne]

* Devise is not required by sufia-models [Justin Coyne]

* Inherit the version of devise from blacklight [Justin Coyne]

* Move to a released version of blacklight_advanced_search [Justin Coyne]

* Rails 4 support [Justin Coyne]

* updating the readme based on mye experience running through it. [Carolyn Cole]

* The query for my uploads, should be me, not exclude me [Justin Coyne]

* Multiform should rename the fields correctly [Justin Coyne]

* more explicit editable docs test [Matt Zumwalt]

* Dashboard search results test more specific -- avoids pagination causing false
negatives [Matt Zumwalt]

* explicit handling of kaminari pagination bug, plus info in install docs [Matt
Zumwalt]

* Test to confirm that pagination works -- fails because dashboard/pages routes
are not properly inherited. [Matt Zumwalt]

* Handle the odd values in the hidden fields on the
generic_files/_permission.html.erb form.  These were added here:
https://github.com/psu-stewardship/scholarsphere/commit/2a58d0c920cc87cad9a815b451613e3d327747e3#L9R5
I have no idea why. [Justin Coyne]

* Add a comment in the generator about the Sufia route being the very last line
[Justin Coyne]

* Generated controller uses the search_layout method for determining layout
[Justin Coyne]

* Force a two column layout for dashboard [Justin Coyne]

* Use hydra-head 6.3.0 [Justin Coyne]

* Bump active-fedora version to 6.4.0.rc4 [Justin Coyne]

* allowing non-sufia controllers to inherit dashboard behaviors and helpers
smoothly [Matt Zumwalt]

* Set a permission value that actually exists (e.g. 'read') [Justin Coyne]

* Added attr_accessible [Justin Coyne]

* Fix the version in sufia-models.gemspec so you can bundle install [Justin
Coyne]

## 2.0.1
* Fix version of sufia-models

## 2.0.0
* Dropbox support
* Multiple layouts
* UnzipJob can handle directories
* Support for sufia and hydra-editor in the same app
* Subdividing the upload partial
* Lots of code cleanup

## 1.3.0
* Depends on Hydra::Controller::DownloadBehavior
* Upgraded to hydra-batch-edit 1.1 which includes session-less batches in hydra-collections
* Moved most of the Dashboard behavior into Sufia::DashboardBehavior to enable overriding
* Added Model to_s instead of using display_title
* Added after delivery hook to contact form controller
* Removed the version page
* various bug fixes

## 1.2.0
* DownloadController uses load_instance_from_solr for speed improvement
* Raise a AccessDenied error if a download is not allowed rather than show an image.
* Autoload the datastreams directory
* Set default variables (fits_path, id_namespace) in the engine config.

## 1.1.0
* Allows a user to deposit on behalf of another user
* Tweaks dashboard UI to be less busy: actions now in dropdown button
* Allows HTML tags in metadata helps to render
* Fixes notifications icon
* Raises routing errors in dev and test so they can be resolved
* Refactors users controller for easy re-use
* Adds JSON support to users controller
* Removes dependency on sitemap gem

## 1.0.0
* Initial API-stable release


text:
CSV::CSV(std::istream &in) : input(in) {}

// Reads the next row and puts it in the buffer
std::vector<std::string> CSV::nextRow()
{
    std::vector<std::string> result;
    std::string line;
    std::getline(input, line);

    std::stringstream line_stream(line);
    std::string cell;

    while (std::getline(line_stream, cell, ',')) {
        result.push_back(cell);
    }

    return result;
}


text:
layout: page
title: Sky King Tech Show
date: 2016-05-24
author: Kathleen Kennedy
tags: weekly links, java
status: published
summary: Maecenas porttitor rutrum ipsum eget pulvinar.
banner: images/banner/meeting-01.jpg
booking:
  startDate: 09/18/2019
  endDate: 09/19/2019
  ctyhocn: STLCFHX
  groupCode: SKTS
published: true
---
Praesent at molestie urna. Etiam egestas ligula et volutpat hendrerit. Aliquam non gravida elit. In feugiat mauris neque, vitae pretium enim hendrerit ut. Donec tempus dapibus ante, sed pharetra quam elementum ac. Nam vehicula, eros quis faucibus egestas, urna metus viverra dolor, non egestas elit felis sed metus. Duis aliquet quam orci, a dapibus purus dapibus in. Pellentesque dignissim nulla eget dignissim lobortis. Nullam eleifend vitae tellus quis iaculis. Maecenas varius gravida odio, sit amet tempor enim porttitor vel. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse potenti. Pellentesque lacinia mattis blandit. Mauris dictum velit lectus, et vulputate urna viverra et.

* Sed mattis purus ut ex dapibus, vehicula egestas justo rutrum
* Quisque iaculis nisi in eros porttitor, nec eleifend mauris tristique
* Quisque vitae diam dignissim, tristique urna vel, egestas ipsum
* Nulla ut est ut diam convallis malesuada
* Etiam vitae nunc accumsan, interdum risus ut, gravida arcu.

Nulla id accumsan odio. Aliquam sed luctus sapien. Cras lacinia ipsum in odio facilisis tempus. Etiam dapibus tortor in dui faucibus, at commodo est vulputate. Quisque nec dui quis ipsum aliquet condimentum. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed vitae gravida velit. Fusce vulputate eros at scelerisque pretium. Pellentesque volutpat enim in placerat suscipit. Etiam arcu nisi, lacinia sed magna ut, venenatis laoreet mi.


text:
package org.apereo.cas.configuration.model.support.memcached;

import org.apereo.cas.configuration.support.RequiredProperty;

import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;

/**
 * This is {@link BaseMemcachedProperties}.
 *
 * @author Misagh Moayyed
 * @since 5.0.0
 */
@Getter
@Setter
public class BaseMemcachedProperties implements Serializable {

    private static final long serialVersionUID = 514520518053691666L;

    /**
     * Set to false if the default operation optimization is not desirable.
     */
    private boolean shouldOptimize;

    /**
     * Set the daemon state of the IO thread (defaults to true).
     */
    private boolean daemon = true;

    /**
     * Set the maximum reconnect delay.
     */
    private long maxReconnectDelay = -1;

    /**
     * Set to true if you'd like to enable the Nagle algorithm.
     */
    private boolean useNagleAlgorithm;

    /**
     * The number of seconds to wait for connections to finish before shutting
     * down the client.
     */
    private long shutdownTimeoutSeconds = -1;

    /**
     * Set the maximum timeout exception threshold.
     */
    private int timeoutExceptionThreshold = 2;

    /**
     * Set the default operation timeout in milliseconds.
     */
    private long opTimeout = -1;

    /**
     * Indicate the transcoder type. Accepted values are {@code KRYO, SERIAL, WHALIN, WHALINV1}.
     * The default is {code KRYO}.
     */
    private String transcoder = "KRYO";

    /**
     * For transcoders other than kryo, determines the compression threshold.
     * Does not apply to kryo.
     */
    private int transcoderCompressionThreshold = 16384;

    /**
     * Comma-separated list of memcached servers.
     */
    @RequiredProperty
    private String servers = "localhost:11211";

    /**
     * Failure mode. Acceptable values are {@code Redistribute,Retry,Cancel}.
     */
    private String failureMode = "Redistribute";

    /**
     * Locator mode. Acceptable values are {@code ARRAY_MOD, CONSISTENT, VBUCKET}.
     */
    private String locatorType = "ARRAY_MOD";

    /**
     * Hash algorithm. Acceptable values are {@code NATIVE_HASH,CRC_HASH,FNV1_64_HASH,FNV1A_64_HASH,FNV1_32_HASH,FNV1A_32_HASH,KETAMA_HASH}.
     */
    private String hashAlgorithm = "FNV1_64_HASH";

    /**
     * Sets the cap on the number of objects that can be allocated by
     * the pool (checked out to clients, or idle awaiting checkout) at a given time. Use a negative value for no limit.
     */
    private int maxTotal = 20;

    /**
     * Set the value for the maxTotal configuration attribute for pools created with this configuration instance.
     */
    private int maxIdle = 8;

    /**
     * Get the value for the minIdle configuration attribute for pools created with this configuration instance.
     */
    private int minIdle;

    /**
     * If true, {@code reset} is called automatically after an entire object graph has been read or written. If
     * false, {@code reset} must be called manually, which allows unregistered class names, references, and other information to
     * span multiple object graphs.
     */
    private boolean kryoAutoReset;

    /**
     * If true, each appearance of an object in the graph after the first is stored as an integer ordinal. When set to true,
     * {@code MapReferenceResolver} is used. This enables references to the same object and cyclic graphs to be serialized, but
     * typically adds overhead of one byte per object.
     */
    private boolean kryoObjectsByReference;

    /**
     * If true, an exception is thrown when an unregistered class is encountered.
     * <p>
     * If false, when an unregistered class is encountered, its fully qualified class name will be serialized and the
     * default serializer for the class used to serialize the object. Subsequent
     * appearances of the class within the same object graph are serialized as an int id.
     * Registered classes are serialized as an int id, avoiding the overhead of serializing the class name, but have the drawback
     * of needing to know the classes to be serialized up front.  See {@code ComponentSerializationPlan} for help here.
     * </p>
     */
    private boolean kryoRegistrationRequired = true;
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

using NUnit.Framework;

using Hatfield.EnviroData.FileSystems;
using Hatfield.EnviroData.DataAcquisition.CSV;
using Hatfield.EnviroData.FileSystems.WindowsFileSystem;

namespace Hatfield.EnviroData.DataAcquisition.CSV.Test
{
    [TestFixture]
    public class CSVDataToImportTest
    {
        private string _csvDataFilePath;
        private string _datDataFilePath;

        [TestFixtureSetUp]
        public void Setup()
        {
            _csvDataFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DataFiles", "CSV_15min.csv");
            _datDataFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DataFiles", "DAT_15min.dat");
        }

        [Test]
        public void CSVDataToImportReadCSVFileTest()
        {
            var dataSource = new WindowsFileSystem(_csvDataFilePath);
            var dataFromFileSystem = dataSource.FetchData();

            var dataToImport = new CSVDataToImport(dataFromFileSystem);
            AssertData(Path.GetFileName(_csvDataFilePath), dataToImport);
        }

        [Test]
        public void CSVDataToImportReadDatFileTest()
        {
            var dataSource = new WindowsFileSystem(_datDataFilePath);
            var dataFromFileSystem = dataSource.FetchData();

            var dataToImport = new CSVDataToImport(dataFromFileSystem);

            AssertData(Path.GetFileName(_datDataFilePath), dataToImport);
        }

        private void AssertData(string fileName, CSVDataToImport csvDataToImport)
        {

            Assert.AreEqual(fileName, csvDataToImport.FileName);
            Assert.NotNull(csvDataToImport);
            var castedData = csvDataToImport.Data as string[][];
            Assert.NotNull(castedData);
            Assert.AreEqual(12, castedData.Count());
            Assert.AreEqual("TOA5", castedData[0][0]);
        }
    }
}


text:
(function (factory) {
    if (typeof module === 'object' && typeof module.exports === 'object') {
        var v = factory(require, exports); if (v !== undefined) module.exports = v;
    }
    else if (typeof define === 'function' && define.amd) {
        define(["require", "exports", '@angular/core', './activator', '../components/app/app', '../config/config', '../platform/dom-controller', '../gestures/gesture-controller', '../platform/platform', '../util/dom', './ripple', '../gestures/ui-event-manager'], factory);
    }
})(function (require, exports) {
    "use strict";
    var core_1 = require('@angular/core');
    var activator_1 = require('./activator');
    var app_1 = require('../components/app/app');
    var config_1 = require('../config/config');
    var dom_controller_1 = require('../platform/dom-controller');
    var gesture_controller_1 = require('../gestures/gesture-controller');
    var platform_1 = require('../platform/platform');
    var dom_1 = require('../util/dom');
    var ripple_1 = require('./ripple');
    var ui_event_manager_1 = require('../gestures/ui-event-manager');
    /**
     * @private
     */
    var TapClick = (function () {
        function TapClick(config, plt, dom, app, zone, gestureCtrl) {
            this.plt = plt;
            this.app = app;
            this.gestureCtrl = gestureCtrl;
            this.disableClick = 0;
            this.events = new ui_event_manager_1.UIEventManager(plt);
            var activator = config.get('activator');
            if (activator === 'ripple') {
                this.activator = new ripple_1.RippleActivator(app, config, dom);
            }
            else if (activator === 'highlight') {
                this.activator = new activator_1.Activator(app, config, dom);
            }
            this.usePolyfill = config.getBoolean('tapPolyfill');
            (void 0) /* console.debug */;
            var doc = plt.doc();
            this.events.listen(doc, 'click', this.click.bind(this), { passive: false, capture: true });
            this.pointerEvents = this.events.pointerEvents({
                element: doc,
                pointerDown: this.pointerStart.bind(this),
                pointerMove: this.pointerMove.bind(this),
                pointerUp: this.pointerEnd.bind(this),
                passive: true
            });
            this.pointerEvents.mouseWait = DISABLE_NATIVE_CLICK_AMOUNT;
        }
        TapClick.prototype.pointerStart = function (ev) {
            if (this.startCoord) {
                return false;
            }
            if (!this.app.isEnabled()) {
                return false;
            }
            this.lastTouchEnd = 0;
            this.dispatchClick = true;
            var activatableEle = getActivatableTarget(ev.target);
            if (!activatableEle) {
                this.startCoord = null;
                return false;
            }
            this.startCoord = dom_1.pointerCoord(ev);
            this.activator && this.activator.downAction(ev, activatableEle, this.startCoord);
            return true;
        };
        TapClick.prototype.pointerMove = function (ev) {
            if (this.startCoord && this.shouldCancelEvent(ev)) {
                this.pointerCancel(ev);
            }
        };
        TapClick.prototype.pointerEnd = function (ev, type) {
            if (!this.dispatchClick)
                return;
            (void 0) /* runInDev */;
            if (!this.startCoord) {
                return;
            }
            if (this.activator) {
                var activatableEle = getActivatableTarget(ev.target);
                if (activatableEle) {
                    this.activator.upAction(ev, activatableEle, this.startCoord);
                }
            }
            if (this.usePolyfill && type === 2 /* TOUCH */ && this.app.isEnabled()) {
                this.handleTapPolyfill(ev);
            }
            this.startCoord = null;
        };
        TapClick.prototype.pointerCancel = function (ev) {
            (void 0) /* console.debug */;
            this.startCoord = null;
            this.dispatchClick = false;
            this.activator && this.activator.clearState(false);
            this.pointerEvents.stop();
        };
        TapClick.prototype.shouldCancelEvent = function (ev) {
            return (this.app.isScrolling() ||
                this.gestureCtrl.isCaptured() ||
                dom_1.hasPointerMoved(POINTER_TOLERANCE, this.startCoord, dom_1.pointerCoord(ev)));
        };
        TapClick.prototype.click = function (ev) {
            if (this.shouldCancelClick(ev)) {
                ev.preventDefault();
                ev.stopPropagation();
                return;
            }
            if (this.activator) {
                // cool, a click is gonna happen, let's tell the activator
                // so the element can get the given "active" style
                var activatableEle = getActivatableTarget(ev.target);
                if (activatableEle) {
                    this.activator.clickAction(ev, activatableEle, this.startCoord);
                }
            }
            (void 0) /* runInDev */;
        };
        TapClick.prototype.shouldCancelClick = function (ev) {
            if (this.usePolyfill) {
                if (!ev.isIonicTap && this.isDisabledNativeClick()) {
                    (void 0) /* console.debug */;
                    return true;
                }
            }
            else if (!this.dispatchClick) {
                (void 0) /* console.debug */;
                return true;
            }
            if (!this.app.isEnabled()) {
                (void 0) /* console.debug */;
                return true;
            }
            if (this.gestureCtrl.isCaptured()) {
                (void 0) /* console.debug */;
                return true;
            }
            return false;
        };
        TapClick.prototype.profileClickDelay = function (ev) {
            if (this.lastTouchEnd) {
                var diff = Date.now() - this.lastTouchEnd;
                if (diff < 100) {
                    (void 0) /* console.debug */;
                }
                else {
                    console.warn("SLOW click dispatched. Delay(ms):", diff, ev);
                }
                this.lastTouchEnd = null;
            }
            else {
                (void 0) /* console.debug */;
            }
        };
        TapClick.prototype.handleTapPolyfill = function (ev) {
            (void 0) /* assert */;
            // only dispatch mouse click events from a touchend event
            // when tapPolyfill config is true, and the startCoordand endCoord
            // are not too far off from each other
            var endCoord = dom_1.pointerCoord(ev);
            if (dom_1.hasPointerMoved(POINTER_TOLERANCE, this.startCoord, endCoord)) {
                (void 0) /* console.debug */;
                return;
            }
            // prevent native mouse click events for XX amount of time
            this.disableClick = Date.now() + DISABLE_NATIVE_CLICK_AMOUNT;
            if (this.app.isScrolling()) {
                // do not fire off a click event while the app was scrolling
                (void 0) /* console.debug */;
            }
            else {
                // dispatch a mouse click event
                (void 0) /* console.debug */;
                var clickEvent = this.plt.doc().createEvent('MouseEvents');
                clickEvent.initMouseEvent('click', true, true, this.plt.win(), 1, 0, 0, endCoord.x, endCoord.y, false, false, false, false, 0, null);
                clickEvent.isIonicTap = true;
                ev.target.dispatchEvent(clickEvent);
            }
        };
        TapClick.prototype.isDisabledNativeClick = function () {
            return this.disableClick > Date.now();
        };
        TapClick.decorators = [
            { type: core_1.Injectable },
        ];
        /** @nocollapse */
        TapClick.ctorParameters = [
            { type: config_1.Config, },
            { type: platform_1.Platform, },
            { type: dom_controller_1.DomController, },
            { type: app_1.App, },
            { type: core_1.NgZone, },
            { type: gesture_controller_1.GestureController, },
        ];
        return TapClick;
    }());
    exports.TapClick = TapClick;
    function getActivatableTarget(ele) {
        var targetEle = ele;
        for (var x = 0; x < 10; x++) {
            if (!targetEle)
                break;
            if (exports.isActivatable(targetEle))
                return targetEle;
            targetEle = targetEle.parentElement;
        }
        return null;
    }
    /**
     * @private
     */
    exports.isActivatable = function (ele) {
        if (ACTIVATABLE_ELEMENTS.indexOf(ele.tagName) > -1) {
            return true;
        }
        for (var i = 0, l = ACTIVATABLE_ATTRIBUTES.length; i < l; i++) {
            if (ele.hasAttribute(ACTIVATABLE_ATTRIBUTES[i])) {
                return true;
            }
        }
        return false;
    };
    var ACTIVATABLE_ELEMENTS = ['A', 'BUTTON'];
    var ACTIVATABLE_ATTRIBUTES = ['tappable', 'ion-button'];
    var POINTER_TOLERANCE = 100;
    var DISABLE_NATIVE_CLICK_AMOUNT = 2500;
    /**
     * @private
     */
    function setupTapClick(config, plt, dom, app, zone, gestureCtrl) {
        return function () {
            return new TapClick(config, plt, dom, app, zone, gestureCtrl);
        };
    }
    exports.setupTapClick = setupTapClick;
});
//# sourceMappingURL=tap-click.js.map


text:
// -*- mode: java; c-basic-offset: 2; -*-
// Copyright 2009-2011 Google, All Rights reserved
// Copyright 2011-2019 MIT, All rights reserved
// Released under the Apache License, Version 2.0
// http://www.apache.org/licenses/LICENSE-2.0

package com.google.appinventor.buildserver;

import com.google.appinventor.common.testutils.TestUtils;
import com.google.appinventor.components.runtime.errors.YailRuntimeError;
import com.google.appinventor.components.runtime.util.YailDictionary;
import com.google.appinventor.components.runtime.util.YailList;
import gnu.kawa.functions.Arithmetic;
import gnu.math.DFloNum;
import gnu.math.IntNum;
import gnu.math.Numeric;
import junit.framework.TestCase;
import kawa.standard.Scheme;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

/**
 * Tests the evaluation of various YAIL code.
 *
 * TODO(markf): More tests needed!
 *
 * @author markf@google.com (Mark Friedman)
 */
public class YailEvalTest extends TestCase {
  private Scheme scheme;

  private static final String YAIL_SCHEME_TESTS =
      TestUtils.windowsToUnix(TestUtils.APP_INVENTOR_ROOT_DIR) +
      "/buildserver/tests/com/google/appinventor/buildserver/YailEvalTest.scm";

  @Override
  public void setUp() throws Exception {
    scheme = new Scheme();
    String yailRuntimeLibrary = Compiler.getResource(Compiler.YAIL_RUNTIME);
    yailRuntimeLibrary = TestUtils.windowsToUnix(yailRuntimeLibrary);
    try {
      scheme.eval("(load \"" + yailRuntimeLibrary + "\")");
      scheme.eval("(load \"" + YAIL_SCHEME_TESTS + "\")");
      scheme.eval("(set! *testing* #t)");
    } catch (Exception e) {
      throw e;
    } catch (Throwable throwable) {
      throw new RuntimeException(throwable);
    }
  }

  public void testBasicKawaEval() throws Throwable {
    Scheme scheme = new Scheme();
    assertEquals("foobar", scheme.eval("(string-append \"foo\" \"bar\")").toString());
  }

  public void testRandomIntegerSameArgs() throws Throwable {
    assertEquals(1, ((IntNum) scheme.eval("(random-integer 1 1)")).intValue());
  }

  public void testFormatAsDecimal() throws Throwable {
    assertEquals("1.234", (scheme.eval("(format-as-decimal 1.233875 3)")).toString());
  }

  public void testFormatAsDecimalError() throws Throwable {
    String schemeString =
        " (try-catch " +
        "  (format-as-decimal 1.234456 -4) " +
        " (exception com.google.appinventor.components.runtime.errors.YailRuntimeError " +
        " \"runtime-error calling format-as-decimal\" " +
        "))";
    assertEquals("runtime-error calling format-as-decimal",
                 scheme.eval(thunkify(schemeString)).toString());
  }

  /**
   * This is mostly here as a workaround for some strange behavior with top-level try-catch
   * expressions in Kawa.
   * Kawa seems to have changed the way that Scheme.eval() treats top-level try-catch expressions
   * between versions 1.9.3 and 1.11. If you look at gnu.exp.TryExp.apply() in 1.9.3 and 1.11 you
   * can see that there were changes made.  Also note that mustCompile() is different in the two
   * versions and we have mucked around a little with when we allow compilation (because we can't
   * dynamically compile on the phone)
   *
   * The workaround appears to be to embed the try-catch into a lambda() (i.e. to 'thunkify' it)
   * and then immediately apply the lambda().
   */
  private String thunkify(String schemeExp) {
    return "(let ((thunk (lambda ()" + schemeExp + "))) (thunk))";
  }

  public void testDefOfVariable() throws Throwable {
    assertTrue((Boolean) scheme.eval("(testDefOfVariable)"));
  }

   public void testDefOfProcedure() throws Throwable {
     assertTrue((Boolean) scheme.eval("(testDefOfProcedure)"));
   }

   public void testTailRecursion() throws Throwable {
     assertTrue((Boolean) scheme.eval("(testTailRecursion)"));
   }

   public void testLookupInPairs1() throws Throwable {
     assertTrue((Boolean) scheme.eval("(testLookupInPairs1)"));
   }

   public void testLookupInPairs2() throws Throwable {
     assertTrue((Boolean) scheme.eval("(testLookupInPairs2)"));
   }

  public void testIsNumber() throws Throwable {
    assertTrue((Boolean) scheme.eval(
        "(call-yail-primitive is-number? (*list-for-runtime* \"1.01\") '(any) \"is a number?\")"));
    assertFalse((Boolean) scheme.eval(
    "(call-yail-primitive is-number? (*list-for-runtime* \"1.01a\") '(any) \"is a number?\")"));
    assertTrue((Boolean) scheme.eval(
    "(call-yail-primitive is-number? (*list-for-runtime* 100.01) '(any) \"is a number?\")"));
  }

  public void testCallCoercions() throws Throwable {
    String schemeString =
        "(call-yail-primitive string-append (*list-for-runtime* 1 2 3) '(text text text) \"join\")";
    assertEquals("123", scheme.eval(schemeString).toString());
    schemeString = "(call-yail-primitive +  " +
        "(*list-for-runtime* \"1\" \"2\" \"3\") '(number number number) \"+\")";
    assertEquals(6, ((IntNum) scheme.eval(schemeString)).intValue());
    schemeString = "(call-yail-primitive string-append (*list-for-runtime* (list 1) \"2\" 3) " +
        "'(text text text) \"join\")";
    assertEquals("[1]23", scheme.eval(schemeString).toString());
  }

  public void testDecimalReaderRoundoff() throws Throwable {
    assertTrue((Boolean) scheme.eval(
    "(call-yail-primitive yail-equal? (*list-for-runtime* 1.00000 \"1\") '(any any) \"=\")"));
    assertTrue((Boolean) scheme.eval(
    "(call-yail-primitive yail-equal? (*list-for-runtime* 1.00000 1) '(any any) \"=\")"));
    assertFalse((Boolean) scheme.eval(
    "(call-yail-primitive yail-equal? (*list-for-runtime* 1.000001 \"1\") '(any any) \"=\")"));
    // This test is here as a comment -- it's what Kawa does -- but we don't have to
    // assert it as a test requirement
    //  assertTrue((Boolean) scheme.eval(
    //  "(call-yail-primitive yail-equal? " +
    //  "(*list-for-runtime* 1.000000000000000001 \"1\") '(any any) \"=\")"));
  }

  public void testTypedCoercions() throws Throwable {
    String schemeString = "(coerce-arg (Float 5) 'text)";
    assertEquals("5", scheme.eval(schemeString).toString());
    schemeString = "(coerce-arg (Double 3.33333) 'number)";
    assertEquals("3.33333", scheme.eval(schemeString).toString());
    schemeString = "(coerce-arg (Integer 10453) 'text)";
    assertEquals("10453", scheme.eval(schemeString).toString());
    schemeString = "(coerce-arg (Long 0341234123412343423) 'text)";
    assertEquals("341234123412343423", scheme.eval(schemeString).toString());
    schemeString = "(coerce-arg (Short 12) 'text)";
    assertEquals("12", scheme.eval(schemeString).toString());
  }

  public void testNonCoercibleValues() throws Throwable {
    String schemeString = "(coerce-arg (Short 12) 'boolean)";
    assertEquals("(non-coercible)", scheme.eval(schemeString).toString());
    schemeString = "(coerce-arg (Float 5.45) 'list)";
    assertEquals("(non-coercible)", scheme.eval(schemeString).toString());
    schemeString = "(coerce-arg \"false\" 'boolean)";
    assertEquals("(non-coercible)", scheme.eval(schemeString).toString());
  }

  public void testCoercionFailureOnProcedureCall() throws Throwable {
    String schemeString =
        " (try-catch " +
        "  (call-yail-primitive + (*list-for-runtime* \"foo\" 4) '(number number) \"+\") " +
        " (exception com.google.appinventor.components.runtime.errors.YailRuntimeError " +
        " \"runtime-error\" " +
        "))";
    assertEquals("runtime-error", scheme.eval(thunkify(schemeString)).toString());
  }

  public void testCoercionFailureOnPropertySet() throws Throwable {
    String schemeString =
        "(def Button3 'dontcare) " +
        "(set-and-coerce-property! 'Button3 'FontSize \"foo\" 'number) ";
    try {
      scheme.eval(schemeString);
      fail();
    } catch (YailRuntimeError e) {
      // expected
    }
  }

  public void testYailEqual() throws Throwable {
    assertTrue((Boolean) scheme.eval(
    "(yail-equal? \"1\" 1)"));
    assertTrue((Boolean) scheme.eval(
    "(yail-equal? \"1\" 1.0)"));
    assertTrue((Boolean) scheme.eval(
    "(yail-equal? \"0\" \"00\")"));
    assertFalse((Boolean) scheme.eval(
    "(yail-equal? \"1\" 1.01)"));
    assertFalse((Boolean) scheme.eval(
    "(yail-equal? 1 #t)"));
    assertTrue((Boolean) scheme.eval(
        "(yail-equal? (list #t 3.0 (list \"money\" 000.005)) " +
    " (list #t 3   (list \"money\" .005)))"));
    assertFalse((Boolean) scheme.eval(
    "(yail-equal? (list (list (list '()))) (list (list (list #f))))"));
    assertTrue((Boolean) scheme.eval(
    "(yail-equal? ((Integer 5):doubleValue) 5)"));
  }

  public void testYailNotEqual() throws Throwable {
    assertFalse((Boolean) scheme.eval(
    "(yail-not-equal? \"1\" 1)"));
    assertFalse((Boolean) scheme.eval(
    "(yail-not-equal? \"1\" 1.0)"));
    assertTrue((Boolean) scheme.eval(
    "(yail-not-equal? \"1\" 1.01)"));
    assertTrue((Boolean) scheme.eval(
    "(yail-not-equal? 1 #t)"));
    assertFalse((Boolean) scheme.eval(
        "(yail-not-equal? (list #t 3.0 (list \"money\" 000.005)) " +
    " (list #t 3   (list \"money\" .005)))"));
    assertTrue((Boolean) scheme.eval(
    "(yail-not-equal? (list (list (list '()))) (list (list (list #f))))"));
    assertFalse((Boolean) scheme.eval(
    "(yail-not-equal? ((Integer 5):doubleValue) 5)"));
  }

  public void testYailIsInList() throws Throwable {
    assertTrue((Boolean) scheme.eval(
    "(yail-list-member? \"1\" '(3 2 1))"));
    assertTrue((Boolean) scheme.eval(
    "(yail-list-member? 1 '(3 2 \"1\"))"));
  }

  public void testYailWhile() throws Throwable {
    String schemeString = "(define theList (list)) (define foo 5) (while (< foo 10) " +
        "(set! theList (append theList (list foo))) (set! foo (+ foo 1))) theList";
    assertEquals("null, (5 6 7 8 9)", scheme.eval(schemeString).toString());
  }

  public void testYailWhileWithBreak() throws Throwable {
    String schemeString = "(define theList (list))(define foo 5)(while (< foo 100)" +
      "(set! theList (append theList (list foo)))(set! foo (+ foo 1))" +
      "(if (= foo 10) (*yail-break* #f)))theList";
    assertEquals("false, (5 6 7 8 9)", scheme.eval(schemeString).toString());
  }

  public void testYailAnd() throws Throwable {
    assertEquals(true, scheme.eval("(and-delayed)"));
    assertEquals(true, scheme.eval("(and-delayed #t)"));
    assertEquals(false, scheme.eval("(and-delayed #f)"));
    assertEquals(true, scheme.eval("(and-delayed #t #t)"));
    assertEquals(false, scheme.eval("(and-delayed #t #f)"));
    assertEquals(true, scheme.eval("(and-delayed #t #t #t)"));
    assertEquals(false, scheme.eval("(and-delayed #t #f #t)"));
  }

  public void testYailAndShortCircuit() throws Throwable {
    String schemeString =
        "(define foo 0) " +
        "(begin (and-delayed #f (begin (set! foo 1) #f)) foo)";
    assertEquals("0", scheme.eval(schemeString).toString());
  }

  public void testYailOr() throws Throwable {
    assertEquals(false, scheme.eval("(or-delayed)"));
    assertEquals(true, scheme.eval("(or-delayed #t)"));
    assertEquals(false, scheme.eval("(or-delayed #f)"));
    assertEquals(false, scheme.eval("(or-delayed #f #f)"));
    assertEquals(true, scheme.eval("(or-delayed #t #f)"));
    assertEquals(true, scheme.eval("(or-delayed #t #t #t)"));
    assertEquals(true, scheme.eval("(or-delayed #t #f #t)"));
    assertEquals(false, scheme.eval("(or-delayed #f #f #f)"));
  }

  public void testYailOrShortCircuit() throws Throwable {
    String schemeString =
        "(define foo 0) " +
        "(begin (or-delayed #t (begin (set! foo 1) #f)) foo)";
    assertEquals("0", scheme.eval(schemeString).toString());
  }

  /* Tests for the implementation of Yail lists (runtime.scm) */

  /* simplest list operations */
  public void testListGroup1() throws Throwable {

//     // yail-list-first was removed
//     String schemeInputString = "(begin " +
//         "(define list1 (make-yail-list \"a\" \"b\" \"c\" \"d\" ))" +
//         "(yail-list-first list1)" +
//         ")";
//     String schemeResultString = "a";
//     assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());

//     // yail-list-rest was removed
//     String schemeInputString = "(begin " +
//         "(define list1 (make-yail-list \"a\" \"b\" \"c\" \"d\" ))" +
//         "(yail-list->string (yail-list-rest list1))" +
//         ")";
//     String schemeResultString = "(b c d)";
//     assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());

    String schemeInputString = "(begin " +
        "(define list1 (make-yail-list \"a\" \"b\" \"c\" \"d\" ))" +
        "(yail-list-length list1)" +
        ")";
    String schemeResultString = "4";
    assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());

    schemeInputString = "(begin " +
        "(define list1 (make-yail-list \"a\" \"b\" \"c\" \"d\" ))" +
        "(yail-list-empty? list1)" +
        ")";
    schemeResultString = "false";
    assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());

    schemeInputString = "(yail-list-empty? (make-yail-list))";
    schemeResultString = "true";
    assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());

    schemeInputString = "(make-yail-list)";
    schemeResultString = "()";
    assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());

    schemeInputString = "(begin " +
        "(define list1 (make-yail-list \"a\" \"b\" \"c\" \"d\" ))" +
        "(yail-list-index \"c\" list1)" +
        ")";
    schemeResultString = "3";
    assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());

    schemeInputString = "(begin " +
        "(define list1 (make-yail-list \"a\" \"b\" \"c\" \"d\" ))" +
        "(yail-list-index (make-yail-list \"c\") list1)" +
        ")";
    schemeResultString = "0";
    assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());
  }

  public void testDeepCopy() throws Throwable {
    // check that yail-list-copy does a deep copy
    String schemeInputString = "(begin " +
        "(define list1 (make-yail-list (make-yail-list \"a\" \"b\") \"c\" \"d\" ))" +
        "(define x (yail-list-copy list1))" +
        "(define y list1)" +
        "(yail-list-set-item! (yail-list-get-item list1 1) 2 \"foo\")" +
        "(define res (make-yail-list (yail-list-get-item (yail-list-get-item x 1) 2)" +
        "(yail-list-get-item (yail-list-get-item y 1) 2)))" +
        "(yail-list->kawa-list res)" +
        ")";
    String schemeResultString = "(b foo)";
    assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());
  }

  /* trees  */
     public void testListGroup2() throws Throwable {

//        // yail-list-first was removed
//     String schemeInputString = "(begin " +
//         "(define list1 (make-yail-list \"a\" \"b\" \"c\" \"d\" ))" +
//         "(define list2 (make-yail-list \"w\" \"x\" \"y\" \"z\" ))" +
//         "(define list3 (make-yail-list list1 list2))" +
//         "(yail-list->string (yail-list-first (yail-list-rest list3)))" +
//         ")";
//     String schemeResultString = "(w x y z)";
//     assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());

    String schemeInputString = "(begin " +
        "(define list1 (make-yail-list \"a\" \"b\" \"c\" \"d\" ))" +
        "(define list2 (make-yail-list \"w\" \"x\" \"y\" \"z\" ))" +
        "(define list3 (make-yail-list list1 list2))" +
        "(yail-list-get-item (yail-list-get-item list3 2) 3)" +
        ")";
    String schemeResultString = "y";
    assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());

    schemeInputString = "(begin " +
        "(define list1 (make-yail-list \"a\" \"b\" \"c\" \"d\" ))" +
        "(define list2 (make-yail-list \"w\" \"x\" \"y\" \"z\" ))" +
        "(define list3 (make-yail-list list1 list2))" +
        "(yail-list-member? \"y\" (yail-list-get-item list3 2))" +
        ")";
    schemeResultString = "true";
    assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());

     }

  /* more trees */
    public void testListGroup3() throws Throwable {
    String schemeInputString =
        "(make-yail-list \"a\" \"b\" (make-yail-list \"c\"))";
    String schemeResultString = "(a b (c))";
    assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());

    schemeInputString = "(yail-list->kawa-list " +
                             " (make-yail-list \"a\" \"b\" (make-yail-list \"c\")))";
    schemeResultString = "(a b (c))";
    assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());

     schemeInputString = "(yail-list->kawa-list " +
         "(kawa-list->yail-list '(a (b c ((d) e) f) g)))";
     schemeResultString = "(a (b c ((d) e) f) g)";
     assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());

//      // yail-list-first was removed
//      schemeInputString = "(yail-list->kawa-list " +
//          "(yail-list-rest (kawa-list->yail-list '(a (b c ((d) e) f) g))))";
//      schemeResultString = "((b c ((d) e) f) g)";
//      assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());

     schemeInputString = "(begin " +
         "(define the-list (make-yail-list 1 2 3 4 5 6 7))" +
         " (define x (yail-list-pick-random the-list)) " +
         "(yail-list-member? x the-list) " +
         ")";
     schemeResultString = "true";
     assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());
 }

  /* side-effects */
  // these tests assume that we are printing lists using json format
  public void testListGroup4() throws Throwable {
    String schemeInputString = "(begin " +
        "(define list1 (make-yail-list \"a\" \"b\" \"c\" \"d\" ))" +
        "(define list2 (make-yail-list \"w\" \"x\" \"y\" \"z\" ))" +
        "(yail-list-set-item! list1 3 list2)" +
        "list1" +
        ")";
    String schemeResultString = "(a b (w x y z) d)";
    assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());

    schemeInputString = "(begin " +
        "(define list1 (make-yail-list \"a\" \"b\" \"c\" \"d\" ))" +
        "(yail-list-remove-item! list1 3)" +
        "list1" +
        ")";
    schemeResultString = "(a b d)";
    assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());

    schemeInputString = "(begin " +
        "(define list1 (make-yail-list \"a\" \"b\" \"c\" \"d\" ))" +
        "(define list2 (make-yail-list \"w\" \"x\" \"y\" \"z\" ))" +
        "(yail-list-append! list1 list2)" +
        "list1" +
        ")";
    schemeResultString = "(a b c d w x y z)";
    assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());

    schemeInputString = "(begin " +
        "(define list1 (make-yail-list \"a\" \"b\" \"c\" \"d\" ))" +
        "(yail-list-add-to-list! list1 1 2 3 4 5)" +
        "list1" +
        ")";
    schemeResultString = "(a b c d 1 2 3 4 5)";
    assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());

    schemeInputString = "(begin " +
        "(define list1 (make-yail-list \"a\" \"b\" \"c\" \"d\" ))" +
        "(yail-list-add-to-list! list1)" +
        "list1" +
        ")";
    schemeResultString = "(a b c d)";
    assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());

    schemeInputString = "(begin " +
        "(define list1 (make-yail-list \"a\" \"b\" \"c\" \"d\" ))" +
        "(yail-list-add-to-list! list1)" +
        "(coerce-to-string list1)" +
        ")";
    schemeResultString = "[\"a\", \"b\", \"c\", \"d\"]";
    assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());

    schemeInputString = "(begin " +
        "(define list1 (make-yail-list \"a\" ))" +
        "(yail-list-add-to-list! list1 1)" +
        "(coerce-to-string list1)" +
        ")";
    schemeResultString = "[\"a\", 1]";
    assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());

    schemeInputString = "(begin " +
        "(define x (make-yail-list \"a\" ))" +
        " (call-yail-primitive yail-list-add-to-list! " +
        " (*list-for-runtime* x  \"hi\" ) '(list any)  \"add items to list\") " +
        "(coerce-to-string x)" +
        ")";
    schemeResultString = "[\"a\", \"hi\"]";
    assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());

    schemeInputString = "(begin " +
        "(define x (make-yail-list \"a\" ))" +
        "(define y (make-yail-list \"ho\" ))" +
        " (call-yail-primitive yail-list-append! " +
        " (*list-for-runtime* x  y ) '(list any)  \"append to list\") " +
        "(coerce-to-string x)" +
        ")";
    schemeResultString = "[\"a\", \"ho\"]";
    assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());

    schemeInputString = "(begin " +
        "(define x (make-yail-list \"a\" ))" +
        "(define y (make-yail-list \"ho\" ))" +
        "(define z (make-yail-list \"hum\" ))" +
        " (call-yail-primitive yail-list-append! " +
        " (*list-for-runtime* x  y ) '(list any)  \"append to list\") " +
        " (call-yail-primitive yail-list-append! " +
        " (*list-for-runtime* x  z ) '(list any)  \"append to list\") " +
        "(coerce-to-string x)" +
        ")";
    schemeResultString = "[\"a\", \"ho\", \"hum\"]";
    assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());

    schemeInputString = "(begin " +
        "(define x (make-yail-list \"a\" ))" +
        "(define y (make-yail-list \"ho\" ))" +
        "(define z (make-yail-list \"hum\" ))" +
        " (call-yail-primitive yail-list-append! " +
        " (*list-for-runtime* x  y ) '(list any)  \"append to list\") " +
        " (call-yail-primitive yail-list-append! " +
        " (*list-for-runtime* x  z ) '(list any)  \"append to list\") " +
        "(coerce-to-string y)" +
        ")";
    schemeResultString = "[\"ho\"]";
    assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());

  }

  /* foreach */
  public void testListGroup5() throws Throwable {
    /* test the underlying yail-for-each call */
    /* note that yail-for-each is what the macro expands to */
    String schemeInputString = "(begin " +
        "(define x 0)" +
        "(yail-for-each (lambda (y) (set! x (+ x y ))) (make-yail-list 1 2 3))" +
        "x" +
        ")";
    String schemeResultString = "6";
    assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());

    /* test that yail-for-each works with nested lists */
    schemeInputString = "(begin " +
        "(define the-list (make-yail-list (make-yail-list 1 2 3) (make-yail-list 4 5 6))) " +
        "(define total 0 )" +
        "(yail-for-each (lambda (y) (set! total (+ total (yail-list-get-item  y 1)))) " +
                             " the-list) " +
        "total" +
        ")";
    schemeResultString = "5";
    assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());

    /* test the call to the foreach macro. */
    schemeInputString = "(begin " +
        "(define x 0)" +
        "(foreach item (begin (set! x (* 2 item))) (make-yail-list 1 2 3))" +
        "x" +
        ")";
    schemeResultString = "6";
    assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());

    /* test evaluation of the Blocks compiler output */
    schemeInputString = "(begin " +
        "(def x 0)" +
        "(foreach y " +
                  "(begin " +
                      "(set-var! x " +
                         "(call-yail-primitive " +
                            "+" +
                            "(*list-for-runtime* (get-var x)  y)" +
                            "'( number number) \"+\")))" +
                 "(make-yail-list  1 2 3 ))" +
         "(get-var x)" +
        ")";
    schemeResultString = "6";
    assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());

    /* test that a non-list for the second argument will be caught as a YailRuntimeError */
    schemeInputString = "(begin " +
        "(define x 0) " +
        "(define badlist 100)" +
        "(foreach item (begin (set! x (+ x v))) badlist)" +
        ")";
    try {
      scheme.eval(schemeInputString);
      fail();
    } catch (YailRuntimeError e) {
      // this is expected
    }
  }

  public void testForRange() throws Throwable {
    /* test forrange */
    String schemeInputString = "(begin " +
        "(def x 0)" +
        "(forrange i " +
        " (begin "      +
        "   (set-var! x "      +
        "    (call-yail-primitive "      +
        "     + "      +
        "     (*list-for-runtime* (get-var x) "      +
        "          (lexical-value i) ) "      +
        "     '( number number)  \"+\") )  ) "      +
        " 1  100 1) "  +
        " (get-var x) " +
         "  )";
    String schemeResultString = "5050";
    assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());
  }

  public void testForRangeDecreasing() throws Throwable {
    /* test forrange */
    String schemeInputString = " (begin " +
        "(def x 0)" +
        "(forrange i " +
        " (begin "      +
        "   (set-var! x "      +
        "    (call-yail-primitive "      +
        "     + "      +
        "     (*list-for-runtime* (get-var x) "      +
        "          (lexical-value i) ) "      +
        "     '( number number)  \"+\") )  ) "      +
        " -1 -100 -1) "  +
        " (get-var x) " +
         "  )";
    String schemeResultString = "-5050";
    assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());
  }

  public void testForRangeConversion() throws Throwable {
    /* test that we do runtime type checking on the range bounds */
    String schemeInputString = "(begin " +
        "(def x 0)" +
        "(forrange i " +
        " (begin "      +
        "   (set-var! x "      +
        "    (call-yail-primitive "      +
        "     + "      +
        "     (*list-for-runtime* (get-var x) "      +
        "          (lexical-value i) ) "      +
        "     '( number number)  \"+\") )  ) "      +
        " \"1\"  \"100\"  \"1\") "  +
        " (get-var x) " +
         "  )";
    String schemeResultString = "5050";
    assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());
  }

  // replace this by testForRangeErrorNonterminating if we make that an error
  public void testForRangeEmpty() throws Throwable {
    /* test forrange giving error in nonterminating case */
    String schemeInputString =
        "(begin (def x 0)" +
        "(forrange i " +
        " (begin "      +
        "   (set-var! x "      +
        "    (call-yail-primitive "      +
        "     + "      +
        "     (*list-for-runtime* (get-var x) "      +
        "          (lexical-value i) ) "      +
        "     '( number number)  \"+\") )  ) "      +
        " 1 100 -1) "  +
        " (get-var x) " +
        ")";
    String schemeResultString = "0";
    assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());
  }

  // (Hal) I removed this test because I eliminated the error
  // public void testForRangeErrorNonterminating() throws Throwable {
  //   /* test forrange giving error in nonterminating case */
  //   String schemeInputString =
  //       "(begin (def x 0)" +
  //       "(forrange i " +
  //       " (begin "      +
  //       "   (set-var! x "      +
  //       "    (call-yail-primitive "      +
  //       "     + "      +
  //       "     (*list-for-runtime* (get-var x) "      +
  //       "          (lexical-value i) ) "      +
  //       "     '( number number)  \"+\") )  ) "      +
  //       " 1 100 -1) "  +
  //       ")";
  //   try {
  //     scheme.eval(schemeInputString);
  //     fail();
  //   } catch (YailRuntimeError e) {
  //     // expected
  //   }
  // }

  public void testForRangeConversionErrorOnStartArg() throws Throwable {
    /* test forrange signaling a converison error for the start argument */
    String schemeInputString =
        "(begin (def x 0)" +
        "(forrange i " +
        " (begin "      +
        "   (set-var! x "      +
        "    (call-yail-primitive "      +
        "     + "      +
        "     (*list-for-runtime* (get-var x) "      +
        "          (lexical-value i) ) "      +
        "     '( number number)  \"+\") )  ) "      +
        " \"foo\" 100 -1) "  +
        ")";
    try {
      scheme.eval(schemeInputString);
      fail();
    } catch (YailRuntimeError e) {
      // expected
    }
  }

  public void testForRangeConversionErrorOnEndArg() throws Throwable {
    /* test forrange signaling a converison error for the end argument */
    String schemeInputString =
        "(begin (def x 0)" +
        "(forrange i " +
        " (begin "      +
        "   (set-var! x "      +
        "    (call-yail-primitive "      +
        "     + "      +
        "     (*list-for-runtime* (get-var x) "      +
        "          (lexical-value i) ) "      +
        "     '( number number)  \"+\") )  ) "      +
        " 1 \"foo\" -1) "  +
        ")";
    try {
      scheme.eval(schemeInputString);
      fail();
    } catch (YailRuntimeError e) {
      // expected
    }
  }

  public void testForRangeConversionErrorOnStepArg() throws Throwable {
    /* test forrange signaling a converison error for the step argument */
    String schemeInputString =
        "(begin (def x 0)" +
        "(forrange i " +
        " (begin "      +
        "   (set-var! x "      +
        "    (call-yail-primitive "      +
        "     + "      +
        "     (*list-for-runtime* (get-var x) "      +
        "          (lexical-value i) ) "      +
        "     '( number number)  \"+\") )  ) "      +
        " 1 100 \"foo\" ) "  +
        ")";
    try {
      scheme.eval(schemeInputString);
      fail();
    } catch (YailRuntimeError e) {
      // expected
    }
  }

  /* a-list lookup */
  public void testAListLookup1() throws Throwable {
    String schemeInputString = "(begin " +
      "(define pair1 (make-yail-list \"a\" \"b\")) " +
      "(define pair2 (make-yail-list \"aa\" \"bb\")) " +
      "(define pairs (make-yail-list pair1 pair2)) " +
      "(yail-alist-lookup \"aa\" pairs \"nothing\") " +
      ")";
    String schemeResultString = "bb";
    assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());
  }

  public void testAListLookup2() throws Throwable {
    String schemeInputString = "(begin " +
      "(define pair1 (make-yail-list \"a\" \"b\")) " +
      "(define pair2 (make-yail-list (make-yail-list 1 2) \"bb\")) " +
      "(define pairs (make-yail-list pair1 pair2)) " +
      "(yail-alist-lookup (make-yail-list 1  (+ 1 1)) pairs \"nothing\") " +
      ")";
    String schemeResultString = "bb";
    assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());
  }

  public void testAListLookup3() throws Throwable {
    String schemeInputString = "(begin " +
      "(define pair1 (make-yail-list \"a\" \"b\")) " +
      "(define pair2 (make-yail-list (make-yail-list 1 2) \"bb\")) " +
      "(define pairs (make-yail-list pair1 pair2)) " +
      "(yail-alist-lookup (make-yail-list \"foo\"  (+ 1 1)) pairs \"nothing\") " +
      ")";
    String schemeResultString = "nothing";
    assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());
  }

  public void testAListLookup4() throws Throwable {
    /* check that this signals a runtime error for a bad pair  */
    String schemeInnerInputString = "(begin " +
      "(define pair1 (make-yail-list \"a\" \"b\")) " +
      "(define pair2 (make-yail-list (make-yail-list 1 2) \"bb\")) " +
      "(define badpair 100) " +
      "(define pairs (make-yail-list pair1 pair2 badpair)) " +
      "(yail-alist-lookup (make-yail-list \"foo\"  (+ 1 1)) pairs \"nothing\") " +
      ")";
    String schemeInputString = "(try-catch " +
          schemeInnerInputString +
        " (exception com.google.appinventor.components.runtime.errors.YailRuntimeError " +
        " \"bad pair\" " +
        "))";
    assertEquals("bad pair", scheme.eval(thunkify(schemeInputString)).toString());
  }

  public void testListInsertionMiddle() throws Throwable {
    /* test list insertion in middle */
    String schemeInputString = "(begin " +
        "(define list1 (make-yail-list (make-yail-list \"a\" \"b\") \"c\" \"d\"))" +
        "(yail-list-insert-item! list1 3 \"foo\")" +
        "(yail-list-get-item list1 3)" +
        ")";
    String schemeResultString = "foo";
    assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());
  }

  public void testListInsertionBeginning() throws Throwable {
    /* test list insertion at beginning */
    String schemeInputString = "(begin " +
        "(define list1 (make-yail-list (make-yail-list \"a\" \"b\") \"c\" \"d\"))" +
        "(yail-list-insert-item! list1 1 \"foo\")" +
        "(yail-list-get-item list1 1)" +
        ")";
    String schemeResultString = "foo";
    assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());
  }

  public void testListInsertionEnd() throws Throwable {
    /* test list insertion at end */
    String schemeInputString = "(begin " +
        "(define list1 (make-yail-list (make-yail-list \"a\" \"b\") \"c\" \"d\"))" +
        "(yail-list-insert-item! list1 4 \"foo\")" +
        "(yail-list-get-item list1 4)" +
        ")";
    String schemeResultString = "foo";
    assertEquals(schemeResultString, scheme.eval(schemeInputString).toString());
  }

  public void testListInsertionError() throws Throwable {
    /* test list insertion error */
   String schemeInputString =
       "(begin  " +
       "(define list1 (make-yail-list (make-yail-list \"a\" \"b\") \"c\" \"d\"))" +
       thunkify(
         "(try-catch " +
         "(yail-list-insert-item! list1 5 \"foo\")" +
         " (exception com.google.appinventor.components.runtime.errors.YailRuntimeError " +
          " \"runtime-error\" " +
          "))") +
       ")";
    assertEquals("runtime-error", scheme.eval(schemeInputString).toString());
  }

  /* error conditions */

  public void testListGroupErrorConditions() throws Throwable {
    String schemeString =
        " (try-catch " +
        " (yail-list-get-item (make-yail-list 0 1 2 3) 5) " +
        " (exception com.google.appinventor.components.runtime.errors.YailRuntimeError " +
        " \"runtime-error\" " +
        "))";
    assertEquals("runtime-error", scheme.eval(thunkify(schemeString)).toString());

    schemeString =
        " (try-catch " +
        " (yail-list-get-item (make-yail-list 0 1 2 3) 0) " +
        " (exception com.google.appinventor.components.runtime.errors.YailRuntimeError " +
        " \"runtime-error\" " +
        "))";
    assertEquals("runtime-error", scheme.eval(thunkify(schemeString)).toString());

    schemeString =
        " (try-catch " +
        " (yail-list-set-item! (make-yail-list 0 1 2 3) -3 \"hello\") " +
        " (exception com.google.appinventor.components.runtime.errors.YailRuntimeError " +
        " \"runtime-error\" " +
        "))";
    assertEquals("runtime-error", scheme.eval(thunkify(schemeString)).toString());

    schemeString =
        " (try-catch " +
        " (yail-list-set-item! (make-yail-list 0 1 2 3) 8 \"hello\") " +
        " (exception com.google.appinventor.components.runtime.errors.YailRuntimeError " +
        " \"runtime-error\" " +
        "))";
    assertEquals("runtime-error", scheme.eval(thunkify(schemeString)).toString());
  }

  /* Text operations */

  public void testStringAppend() throws Throwable {
    assertEquals("abcdef", scheme.eval("(string-append \"abc\" \"def\")").toString());
  }

  public void testStringStartsAt() throws Throwable {
    assertEquals("3", scheme.eval("(string-starts-at \"abc\" \"c\")").toString());
    assertEquals("0", scheme.eval("(string-starts-at \"abc\" \"x\")").toString());
  }

  public void testStringContains() throws Throwable {
    assertEquals("true", scheme.eval("(string-contains \"abc\" \"b\")").toString());
    assertEquals("false", scheme.eval("(string-contains \"abc\" \"x\")").toString());
  }

  public void testStringSplit() throws Throwable {
    assertEquals("(ab cd ef)", scheme.eval("(string-split \"ab&cd&ef\" \"&\")").toString());

    assertEquals("(ab cd ef)", scheme.eval(
        "(string-split-at-any \"ab&cd-ef\" (make-yail-list \"&\" \"-\" ))").toString());

    assertEquals("(ab cd ef)", scheme.eval("(string-split-at-spaces \"ab   cd    ef\" )")
        .toString());

    // These have no match

    assertEquals("(ab&cd&ef)", scheme.eval("(string-split \"ab&cd&ef\" \"blah\")").toString());

    assertEquals("(ab&cd-ef)", scheme.eval(
        "(string-split-at-any \"ab&cd-ef\" (make-yail-list \"*\" \"%\" ))").toString());

    assertEquals("(ab&&cd&ef)", scheme.eval("(string-split-at-spaces \"ab&&cd&ef\" )").toString());

    // Corner cases
    String schemeString = "(clarify (string-split \"&&ab&cd&ef&\" \"&\")) ";

    // There should not be a trailing <empty> here
    assertEquals("(<empty> <empty> ab cd ef)", scheme.eval(schemeString).toString());

    //assertEquals("(<empty> <empty> ab cd ef <empty>)", scheme.eval(schemeString).toString());

    schemeString = "(clarify (string-split-at-any \"&ab&-cd-ef&\" (make-yail-list \"&\" \"-\" )))";

    assertEquals("(<empty> ab <empty> cd ef <empty>)", scheme.eval(schemeString).toString());

    schemeString = "(clarify (string-split-at-any \"&ab&+cd+ef&\" (make-yail-list \"&\" \"+\" )))";

    assertEquals("(<empty> ab <empty> cd ef <empty>)", scheme.eval(schemeString).toString());

    schemeString = "(clarify (string-split-at-spaces \" ab  cd ef  \" ))";

    assertEquals("(ab cd ef)", scheme.eval(schemeString).toString());

    // Happy cases
    assertEquals("(ab cd&ef)",
        scheme.eval("(string-split-at-first \"ab&cd&ef\" \"&\")").toString());

    assertEquals("(ab cd-ef)", scheme.eval(
        "(string-split-at-first-of-any \"ab-cd-ef\" (make-yail-list \"&\" \"-\" ))").toString());

    // No-match cases
    assertEquals("(ab&cd&ef)",
        scheme.eval("(string-split-at-first \"ab&cd&ef\" \"blah\")").toString());

    schemeString = "(string-split-at-first-of-any \"ab&cd-ef\" (make-yail-list))";
    try {
      scheme.eval(schemeString);
      fail();
    } catch (YailRuntimeError e) {
      // this is expected
    }
  }

  public void testStringSubstring() throws Throwable {
    assertEquals("b&&c", scheme.eval("(string-substring \"ab&&cd&ef\" 2 4)").toString());

    try {
      scheme.eval("(string-substring \"abcd\" 3 3)");
      fail();
    } catch (YailRuntimeError e) {
      // this is expected
    }
  }

  public void testStringTest1() throws Throwable {
    assertEquals("true", scheme.eval("(stringTest1)").toString());
  }

  public void testStringToUpperCaseForConstant() throws Throwable {
    assertEquals("ABCDEFG", scheme.eval("(string-to-upper-case \"aBcDeFg\")").toString());
    // Lowercase sharp s (Unicode 00DF) is replaced with SS. This behavior follow the current
    // spelling rules. However, beginning with Unicode 5.1 (released April 4, 2008), a capital
    // sharp s character was added as Unicode 1E9E. It is possible that spelling rules will change
    // in the future to use the new capital sharp s character when uppercasing a lowercase sharp s.
    // So, if this test begins failing (perhaps after we switch to a future version of Java), that
    // may be the cause and the test should be updated.
    assertEquals("STRASSE", scheme.eval("(string-to-upper-case \"Stra\u00dfe\")").toString());
  }

  public void testStringToUpperCaseForExpression() throws Throwable {
    assertEquals("STRASSE", scheme.eval("(string-to-upper-case "
                                        + "(string-append \"Stra\" \"\u00dfe\"))").toString());
  }

  public void testStringToLowerCaseForConstant() throws Throwable {
    assertEquals("abcdefg", scheme.eval("(string-to-lower-case \"aBcDeFg\")").toString());
    // An uppercase sigma (Unicode 03A3) in the middle of a word is replaced with lowercase sigma
    // (Unicode 03C3) but an uppercase sigma the end of a word is replaced with lowercase final
    // sigma (Unicode 03C2).
    // Chi Alpha Omicron Sigma Sigma
    assertEquals("\u03c7\u03b1\u03bf\u03c3\u03c2",
        scheme.eval("(string-to-lower-case \"\u03a7\u0391\u039f\u03a3\u03a3\")").toString());
  }

  public void testStringToLowerCaseForExpression() throws Throwable {
    assertEquals("\u03c7\u03b1\u03bf\u03c3\u03c2",
        scheme.eval("(string-to-lower-case "
                    + "(string-append \"\u03a7\u0391\u039f\" \"\u03a3\u03a3\"))").toString());
  }

  public void testStringReplace() throws Throwable {
    /* this tests that we've quoted the dot so it's not special as a regexp */
    assertEquals("12x34x56x", scheme.eval("(string-replace-all \"12.34.56.\" \".\" \"x\")")
        .toString());
  }

  public void testStringIsEmpty() throws Throwable {
    assertTrue((Boolean) scheme.eval("(string-empty? \"\")"));
    assertFalse((Boolean) scheme.eval("(string-empty? \" \")"));
    assertFalse((Boolean) scheme.eval("(string-empty? \"foo\")"));
  }

  public void testMathsConvert() throws Throwable {
    // we have to make the test inputs strings, because in the running system,
    // the convert blocks force a conversion to string before calling the
    // Yail procedures
    assertEquals("3E8", scheme.eval("(math-convert-dec-hex \"1000\")").toString());
    assertEquals("1000", scheme.eval("(math-convert-hex-dec \"3E8\")").toString());
    assertEquals("1010", scheme.eval("(math-convert-dec-bin \"10\")").toString());
    assertEquals("10", scheme.eval("(math-convert-bin-dec \"1010\")").toString());
  }

  public void testMathsConvert2() throws Throwable {
    // test that we've patched around the Kawa bug in conversion to binary
     assertTrue((Boolean) scheme.eval("(testMathsConvert2)"));
   }

  public void testRoundToIntegerGroup() throws Throwable {
    assertEquals("10", scheme.eval("(yail-round 10.48)").toString());
    assertEquals("10", scheme.eval("(yail-floor 10.48)").toString());
    assertEquals("11", scheme.eval("(yail-ceiling 10.48)").toString());
    assertEquals("10", scheme.eval("(format-as-decimal 10.48 0)").toString());
    assertEquals("10.5", scheme.eval("(format-as-decimal 10.48 1)").toString());
    try {
      scheme.eval("(format-as-decimal 10.48 -2)");
      fail();
    } catch (YailRuntimeError e) {
      // expected
    }
  }

  public void testRandomIntegerAvoidError() throws Throwable {
    // demonstrate that this does not fail with large arguments
    scheme.eval("(random-integer 10 (- (expt 2 40)))");
    scheme.eval("(random-integer (- (expt 2 40)) 10)");
  }

  private static final double DELTA = .0001;

  private void testUnaryDoubleFunction(String funName, double[] args, double[] vals)
      throws Throwable {
    for (int i = 0; i < args.length; i++) {
      String expression = "(" + funName + " " + args[i] + ")";
      Object result = scheme.eval(expression);
      if (result instanceof DFloNum) {
        assertEquals(expression, vals[i], ((DFloNum) result).doubleValue(), DELTA);
      } else {
        assertEquals(expression, vals[i], (Double) result, DELTA);
      }
    }
  }

   public void testSine() throws Throwable {
     double[] args = { 0, 90, 180, 270 };
     double[] vals = { 0,  1,  0,   -1 };
     testUnaryDoubleFunction("sin-degrees", args, vals);
   }

   public void testCosine() throws Throwable {
     double[] args = { 0, 90, 180, 270 };
     double[] vals = { 1,  0,  -1,   0 };
     testUnaryDoubleFunction("cos-degrees", args, vals);
   }

   public void testTangent() throws Throwable {
     double[] args = { 0, 45, 135, 180, 225, 315, 30 };
     double[] vals = { 0,  1,  -1,   0,   1,  -1, .57735 };
     testUnaryDoubleFunction("tan-degrees", args, vals);
   }

   public void testAsin() throws Throwable {
     // Results should be in the range (-90, +90].
     double[] args = { 0, .5,  1,  -1 };
     double[] vals = { 0, 30, 90, -90 };
     testUnaryDoubleFunction("asin-degrees", args, vals);
   }

   public void testAcos() throws Throwable {
     // Results should be in the range [0, 180).
     double[] args = {  0, .5, 1,  -1 };
     double[] vals = { 90, 60, 0, 180 };
     testUnaryDoubleFunction("acos-degrees", args, vals);
   }

   public void testAtan() throws Throwable {
     // Results should be in the range (-90, +90).
     double[] args = { 0,  1,  -1, .57735 };
     double[] vals = { 0, 45, -45, 30 };
     testUnaryDoubleFunction("atan-degrees", args, vals);
   }

  // These constant definitions make the below tests more readable.
  private static final double PI = Math.PI;
  private static final double PI_2 = PI / 2;
  private static final double PI_4 = PI / 4;

  public void testDegreesToRadians() throws Throwable {
    double[] args = {   -45, 0,   45,   90,   270, 360, 720 };
    double[] vals = { -PI_4, 0, PI_4, PI_2, -PI_2,   0,   0 };
    testUnaryDoubleFunction("degrees->radians", args, vals);
  }

  public void testRadiansToDegrees() throws Throwable {
    double[] args = { -PI_4, 0, PI_4, PI_2, -PI, -PI_2, 8 * Math.PI };
    double[] vals = {   315, 0, 45,     90, 180,   270, 0 };
    testUnaryDoubleFunction("radians->degrees", args, vals);
  }

  private void testBinaryDoubleFunction(String funName,
                                        double[] args1,
                                        double[] args2,
                                        double[] vals)
      throws Throwable {
    for (int i = 0; i < args1.length; i++) {
      String expression = "(" + funName + " " + args1[i] + " " + args2[i] + ")";
      assertEquals(vals[i], ((DFloNum) scheme.eval(expression)).doubleValue(), DELTA);
    }
  }

   public void testAtan2() throws Throwable {
     // Results should be in the range (-180, +180].
     double[] args1 = { 0,  1,  -1, 0   };
     double[] args2 = { 1,  0,   0, -1  };
     double[] vals =  { 0, 90, -90, 180 };
     testBinaryDoubleFunction("atan2-degrees", args1, args2, vals);
   }

   public void testIntegerDivison() throws Throwable {
     // Check that integer division does not produce rationals
     assertFalse((Boolean) scheme.eval("(exact? (yail-divide 2 3))"));
   }

   public void testConvertToStrings() throws Throwable {
     String schemeInputString = "(convert-to-strings-for-csv (make-yail-list (/ 10 5) 2.0 \"abc\" 123 (list 4 5 6)))";
     String schemeExpectedResultString = "(2 2 abc 123 [4, 5, 6])";
     String schemeActualResult = scheme.eval(schemeInputString).toString();
     assertEquals(schemeExpectedResultString, schemeActualResult);
   }

  private void testMakeColorCase(int color, String red, String green, String blue, String alpha)
      throws Throwable {
    assertEquals(color,
        ((IntNum) scheme.eval(
            String.format(
                "(make-color (make-yail-list %s %s %s %s))",
                red, green, blue, alpha))).intValue());
  }

  public void testMakeColor() throws Throwable {
    // Normal case with 4 arguments in the range 0 to 255.
    testMakeColorCase(0x01020304, "2", "3", "4", "1");
    testMakeColorCase(0x0f0a0b0c, "10", "11", "12", "15");
    testMakeColorCase(0xffff0000, "255", "0", "0", "255");  // red

    // Four arguments, some out of range.
    testMakeColorCase(0xff020304, "258", "-253", "4", "-1");

    // Omit alpha.
    testMakeColorCase(0xff020304, "2", "3", "4", "");
    testMakeColorCase(0xff0a0b0c, "10", "11", "12", "");
    testMakeColorCase(0xffff0000, "255", "0", "0", "");  // red
    testMakeColorCase(0xff020304, "258", "-253", "4", "");
  }

  // The input to split-color is the actual parameter color.
  // The expected outputs are the actual parameters red, green, blue, and alpha.
  private void testSplitColorCase(int red, int green, int blue, int alpha, int color)
      throws Throwable {
    assertTrue((Boolean) scheme.eval(
        String.format("(let ((components (split-color %d))) " +
            "  (and (= (yail-list-get-item components 1) %d)" +
            "       (= (yail-list-get-item components 2) %d)" +
            "       (= (yail-list-get-item components 3) %d)" +
            "       (= (yail-list-get-item components 4) %d)" +
            "       (= (yail-list-length components) 4)))",
            color, red, green, blue, alpha)));
  }

  public void testSplitColor() throws Throwable {
    testSplitColorCase(0, 0, 0, 0, 0);
    testSplitColorCase(1, 2, 3, 4, 0x04010203);
    testSplitColorCase(0x1a, 0x2b, 0xff, 0xf0, 0xf01a2bff);
    testSplitColorCase(0xff, 0xff, 0xff, 0xff, 0xffffffff);
  }

  public void testExptWithSanitizedDouble() throws Throwable {
    // This tests the bug where passing a double property value to expt caused
    // java.lang.ClassCastException: java.lang.Double cannot be cast to gnu.math.Numeric
    String schemeString = "(define five :: java.lang.Double (java.lang.Double 5)) " +
        "(coerce-to-string (expt (sanitize-component-data five) 2))";
    assertEquals("25", scheme.eval(schemeString).toString());
  }

  public void testCoerceToStringWithSanitizedFloatZero() throws Throwable {
    // This tests the bug where coercing a float property value of 0.0 to a string gave the
    // incorrect result "OEO".
    String schemeString = "(define zero :: java.lang.Float (java.lang.Float 0)) " +
        "(coerce-to-string (sanitize-component-data zero))";
    assertEquals("0", scheme.eval(schemeString).toString());
  }

  public void testCoerceToStringWithSanitizedDoubleZero() throws Throwable {
    // This tests the bug where coercing a double property value of 0.0 to a string gave the
    // incorrect result "OEO".
    String schemeString = "(define zero :: java.lang.Double (java.lang.Double 0)) " +
        "(coerce-to-string (sanitize-component-data zero))";
    assertEquals("0", scheme.eval(schemeString).toString());
  }

  public void testJavaMapToYailDictionaryEmpty() throws Throwable {
    Map<String, Object> input = new HashMap<>();
    Object sym = scheme.eval("(gentemp)");
    scheme.define(sym.toString(), input);
    Object result = scheme.eval("(java-map->yail-dictionary " + sym + ")");
    assertNotNull(result);
    assertTrue(result instanceof YailDictionary);
    assertEquals(0, ((YailDictionary) result).size());
  }

  public void testJavaMapToYailDictionary() throws Throwable {
    Map<String, Object> nested = new HashMap<>();
    nested.put("a", "b");
    Map<String, Object> input = new HashMap<>();
    input.put("number", 1);
    input.put("string", "name");
    input.put("boolean", false);
    input.put("list", Arrays.asList(1, 2, 3));
    input.put("dictionary", nested);
    Object sym = scheme.eval("(gentemp)");
    scheme.define(sym.toString(), input);
    Object result = scheme.eval("(java-map->yail-dictionary " + sym + ")");
    assertNotNull(result);
    assertTrue(result instanceof YailDictionary);
    YailDictionary asdict = (YailDictionary) result;
    assertEquals(5, asdict.size());
    assertEquals(1, ((Numeric) asdict.get("number")).intValue());
    assertEquals("name", asdict.get("string"));
    assertEquals(false, asdict.get("boolean"));
    assertEquals(YailList.makeList(Arrays.asList(Arithmetic.asNumeric(1),
        Arithmetic.asNumeric(2), Arithmetic.asNumeric(3))),
        asdict.get("list"));
    assertEquals(YailDictionary.makeDictionary("a", "b"), asdict.get("dictionary"));
  }
}


text:
from django.db import migrations, models

class Migration(migrations.Migration):

    dependencies = [
        ('projects', '0046_domain_hsts_fields'),
    ]

    operations = [
        migrations.AlterField(
            model_name='webhook',
            name='url',
            field=models.URLField(help_text='URL to send the webhook to', max_length=600),
        ),
    ]


text:
import argparse
import os
from ea import EA

parser = argparse.ArgumentParser(description="Texas holdem bot EA")
parser.add_argument('--config', type=argparse.FileType('r', 0), default=os.path.abspath("../config_starter.json"))

args = parser.parse_args()

ea = EA(128, 64, 100, 10, args.config)
#ea = EA(16, 8, 6, 10, args.config)
ea.run()

print("\n\n")
print("Age\tFit\tWin\tLoss\tTime")
for s in sorted(ea.this_generation.population, key=lambda p: p.fitness, reverse=True):
    print("{0}\t{1}\t{2}\t{3}\t{4}\n    {5}\n".format(s.generation, round(s.fitness), s.wins, s.losses, \
        s.average_time, s.get_config_file()))