text:
Configuration
=============

We must first configure Sentry to allow certain hosts to report errors.
This prevents abuse so somebody else couldn't start sending errors to your
account from their site.

**Note**: Without setting this, all messages will be rejected!

This can be found under the *Project Details* page in Sentry.

Now need to set up Raven.js to use your Sentry DSN.

.. code-block:: javascript

    Raven.config('___PUBLIC_DSN___').install()

At this point, Raven is ready to capture any uncaught exception.

Although, this technically works, this is not going to yield the greatest
results. It's highly recommended to next check out :doc:`usage`.

Optional settings
-----------------

``Raven.config()`` can be passed an optional object for extra configuration.

.. describe:: logger

    The name of the logger used by Sentry. Default: ``javascript``

    .. code-block:: javascript

        {
          logger: 'javascript'
        }

.. describe:: release

    Track the version of your application in Sentry.

    .. code-block:: javascript

        {
          release: '721e41770371db95eee98ca2707686226b993eda'
        }

    Can also be defined with ``Raven.setReleaseContext('721e41770371db95eee98ca2707686226b993eda')``.

.. describe:: tags

    Additional `tags <https://www.getsentry.com/docs/tags/>`__ to assign to each event.

    .. code-block:: javascript

        {
          tags: {git_commit: 'c0deb10c4'}
        }

.. _config-whitelist-urls:

.. describe:: whitelistUrls

    The inverse of ``ignoreUrls``. Only report errors from whole urls
    matching a regex pattern or an exact string. ``whitelistUrls`` should
    match the url of your actual JavaScript files. It should match the url
    of your site if and only if you are inlining code inside ``<script>``
    tags.

    Does not affect ``captureMessage`` or when non-error object is passed in
    as argument to captureException.

    .. code-block:: javascript

        {
          whitelistUrls: [/getsentry\.com/, /cdn\.getsentry\.com/]
        }

.. describe:: ignoreErrors

    Very often, you will come across specific errors that are a result of
    something other than your application, or errors that you're
    completely not interested in. `ignoreErrors` is a list of these
    messages to be filtered out before being sent to Sentry as either
    regular expressions or strings.

    Does not affect captureMessage or when non-error object is passed in
    as argument to captureException.

    .. code-block:: javascript

        {
          ignoreErrors: ['fb_xd_fragment']
        }

.. describe:: ignoreUrls

    The inverse of ``whitelistUrls`` and similar to ``ignoreErrors``, but
    will ignore errors from whole urls matching a regex pattern or an
    exact string.

    .. code-block:: javascript

        {
          ignoreUrls: [/graph\.facebook\.com/, 'http://example.com/script2.js']
        }

    Does not affect captureMessage or when non-error object is passed in
    as argument to ``captureException``.

.. describe:: includePaths

    An array of regex patterns to indicate which urls are a part of your
    app in the stack trace. All other frames will appear collapsed inside
    Sentry to make it easier to discern between frames that happened in
    your code vs other code. It'd be suggested to add the current page
    url, and the host for your CDN.

    .. code-block:: javascript

        {
            includePaths: [/https?:\/\/getsentry\.com/, /https?:\/\/cdn\.getsentry\.com/]
        }

.. describe:: dataCallback

    A function that allows mutation of the data payload right before being
    sent to Sentry.

    .. code-block:: javascript

        {
            dataCallback: function(data) {
              // do something to data
              return data;
            }
        }

.. describe:: shouldSendCallback

    A callback function that allows you to apply your own filters to
    determine if the message should be sent to Sentry.

    .. code-block:: javascript

        {
            shouldSendCallback: function(data) {
              return false;
            }
        }

.. describe:: maxMessageLength

    By default, raven truncates messages to a max length of 100
    characters. You can customize the max length with this parameter.

Putting it all together
-----------------------

.. code-block:: html

    <!doctype html>
    <html>
    <head>
        <title>Awesome stuff happening here</title>
    </head>
    <body>
        ...
        <script src="jquery.min.js"></script>
        <script src="//cdn.ravenjs.com/1.1.18/jquery,native/raven.min.js"></script>
        <script>
            Raven.config('___PUBLIC_DSN___', {
                logger: 'my-logger',
                whitelistUrls: [
                    /disqus\.com/,
                    /getsentry\.com/
                ],
                ignoreErrors: [
                    'fb_xd_fragment',
                    /ReferenceError:.*/
                ],
                includePaths: [
                    /https?:\/\/(www\.)?getsentry\.com/
                ]
            }).install();
        </script>
        <script src="myapp.js"></script>
    </body>
    </html>

TraceKit specific optional settings
-----------------------------------

Usually there is no need to touch these settings, but they exist in case
you need to tweak something.

.. describe:: fetchContext

    Enable TraceKit to attempt to fetch source files to look up anonymous
    function names, this can be useful to enable if you don't get the context
    for some entries in the stack trace. Default value is ``false``.

    .. code-block:: javascript

        {
            fetchContext: true
        }

.. describe:: linesOfContext

    The count of lines surrounding the error line that should be used as
    context in the stack trace, default value is ``11``. Only applicable when
    ``fetchContext`` is enabled.

    .. code-block:: javascript

        {
            linesOfContext: 11
        }

.. describe:: collectWindowErrors

    Enable or disable the TraceKit ``window.onerror`` handler, default
    value is ``true``.

    .. code-block:: javascript

        {
            collectWindowErrors: true
        }


text:
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Orleans.Concurrency;
using Orleans.Runtime;

namespace Orleans
{
    /// <summary>
    /// Interface for multiple implementations of the underlying storage for reminder data:
    /// Azure Table, SQL, development emulator grain, and a mock implementation.
    /// Defined as a grain interface for the development emulator grain case.
    /// </summary>
    public interface IReminderTable
    {
        Task Init();

        Task<ReminderTableData> ReadRows(GrainReference key);

        /// <summary>
        /// Return all rows that have their GrainReference's.GetUniformHashCode() in the range (start, end]
        /// </summary>
        /// <param name="begin"></param>
        /// <param name="end"></param>
        /// <returns></returns>
        Task<ReminderTableData> ReadRows(uint begin, uint end);

        Task<ReminderEntry> ReadRow(GrainReference grainRef, string reminderName);

        Task<string> UpsertRow(ReminderEntry entry);

        /// <summary>
        /// Remove a row from the table.
        /// </summary>
        /// <param name="grainRef"></param>
        /// <param name="reminderName"></param>
        /// /// <param name="eTag"></param>
        /// <returns>true if a row with <paramref name="grainRef"/> and <paramref name="reminderName"/> existed and was removed successfully, false otherwise</returns>
        Task<bool> RemoveRow(GrainReference grainRef, string reminderName, string eTag);

        Task TestOnlyClearTable();
    }

    /// <summary>
    /// Reminder table interface for grain based implementation.
    /// </summary>
    [Unordered]
    internal interface IReminderTableGrain : IGrainWithIntegerKey
    {
        Task<ReminderTableData> ReadRows(GrainReference key);

        Task<ReminderTableData> ReadRows(uint begin, uint end);

        Task<ReminderEntry> ReadRow(GrainReference grainRef, string reminderName);

        Task<string> UpsertRow(ReminderEntry entry);

        Task<bool> RemoveRow(GrainReference grainRef, string reminderName, string eTag);

        Task TestOnlyClearTable();
    }

    [Serializable]
    [GenerateSerializer]
    public class ReminderTableData
    {
        [Id(0)]
        public IList<ReminderEntry> Reminders { get; private set; }

        public ReminderTableData(IEnumerable<ReminderEntry> list)
        {
            Reminders = new List<ReminderEntry>(list);
        }

        public ReminderTableData(ReminderEntry entry)
        {
            Reminders = new List<ReminderEntry> {entry};
        }

        public ReminderTableData()
        {
            Reminders = new List<ReminderEntry>();
        }

        public override string ToString()
        {
            return string.Format("[{0} reminders: {1}.", Reminders.Count,
                Utils.EnumerableToString(Reminders, e => e.ToString()));
        }
    }

    [Serializable]
    [GenerateSerializer]
    public class ReminderEntry
    {
        /// <summary>
        /// The grain reference of the grain that created the reminder. Forms the reminder
        /// primary key together with <see cref="ReminderName"/>.
        /// </summary>
        [Id(1)]
        public GrainReference GrainRef { get; set; }

        /// <summary>
        /// The name of the reminder. Forms the reminder primary key together with
        /// <see cref="GrainRef"/>.
        /// </summary>
        [Id(2)]
        public string ReminderName { get; set; }

        /// <summary>
        /// the time when the reminder was supposed to tick in the first time
        /// </summary>
        [Id(3)]
        public DateTime StartAt { get; set; }

        /// <summary>
        /// the time period for the reminder
        /// </summary>
        [Id(4)]
        public TimeSpan Period { get; set; }

        [Id(5)]
        public string ETag { get; set; }

        public override string ToString()
        {
            return string.Format("<GrainRef={0} ReminderName={1} Period={2}>", GrainRef.ToString(), ReminderName, Period);
        }

        internal IGrainReminder ToIGrainReminder()
        {
            return new ReminderData(GrainRef, ReminderName, ETag);
        }
    }

    [Serializable]
    [GenerateSerializer]
    internal class ReminderData : IGrainReminder
    {
        [Id(1)]
        public GrainReference GrainRef { get; private set; }
        [Id(2)]
        public string ReminderName { get; private set; }
        [Id(3)]
        public string ETag { get; private set; }

        internal ReminderData(GrainReference grainRef, string reminderName, string eTag)
        {
            GrainRef = grainRef;
            ReminderName = reminderName;
            ETag = eTag;
        }

        public override string ToString()
        {
            return string.Format("<IOrleansReminder: GrainRef={0} ReminderName={1} ETag={2}>", GrainRef.ToString(), ReminderName, ETag);
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
class CreateStories < ActiveRecord::Migration
  def change
    create_table :stories do |t|
      t.string :title, null: false
      t.text :beginning
      t.boolean :completion_status, default: false
      t.belongs_to :user, index: true

      t.timestamps
    end
  end
end


text:
package com.vladium.emma.instr;

import java.io.IOException;

import com.vladium.util.ClassLoaderResolver;
import com.vladium.util.args.IOptsParser;
import com.vladium.util.asserts.$assert;
import com.vladium.emma.Command;
import com.vladium.emma.IAppConstants;
import com.vladium.emma.IAppErrorCodes;
import com.vladium.emma.EMMARuntimeException;

// ----------------------------------------------------------------------------
/**
 * @author Vlad Roubtsov, (C) 2003
 */
public
final class instrCommand extends Command
{
    // public: ................................................................

    public instrCommand (final String usageToolName, final String [] args)
    {
        super (usageToolName, args);

        m_outMode = InstrProcessor.OutMode.OUT_MODE_COPY; // default
    }

    public synchronized void run ()
    {
        ClassLoader loader;
        try
        {
            loader = ClassLoaderResolver.getClassLoader ();
        }
        catch (Throwable t)
        {
            loader = getClass ().getClassLoader ();
        }

        try
        {
            // process 'args':
            {
                final IOptsParser parser = getOptParser (loader);
                final IOptsParser.IOpts parsedopts = parser.parse (m_args);

                // check if usage is requested before checking args parse errors etc:
                {
                    final int usageRequestLevel = parsedopts.usageRequestLevel ();

                    if (usageRequestLevel > 0)
                    {
                        usageexit (parser, usageRequestLevel, null);
                        return;
                    }
                }

                final IOptsParser.IOpt [] opts = parsedopts.getOpts ();

                if (opts == null) // this means there were args parsing errors
                {
                    parsedopts.error (m_out, STDOUT_WIDTH);
                    usageexit (parser, IOptsParser.SHORT_USAGE, null);
                    return;
                }

                // process parsed args:
                try
                {
                    for (int o = 0; o < opts.length; ++ o)
                    {
                        final IOptsParser.IOpt opt = opts [o];
                        final String on = opt.getCanonicalName ();

                        if (! processOpt (opt))
                        {
                            if ("ip".equals (on))
                            {
                                m_instrpath = getListOptValue (opt, PATH_DELIMITERS, true);
                            }
                            else if ("d".equals (on))
                            {
                                m_outDirName = opt.getFirstValue ();
                            }
                            else if ("out".equals (on))
                            {
                                m_outFileName = opt.getFirstValue ();
                            }
                            else if ("merge".equals (on))
                            {
                                m_outDataMerge = getOptionalBooleanOptValue (opt) ? Boolean.TRUE : Boolean.FALSE;
                            }
                            else if ("ix".equals (on))
                            {
                                // note: this allows path delimiter in the pattern list as well
                                m_ixpath = getListOptValue (opt, COMMA_DELIMITERS, true);
                            }
                            else if ("m".equals (on))
                            {
                                final String ov = opt.getFirstValue ();

                                final InstrProcessor.OutMode outMode = InstrProcessor.OutMode.nameToMode (ov);
                                if (outMode == null)
                                {
                                    usageexit (parser, IOptsParser.SHORT_USAGE,
                                        "invalid '" + opts [o].getName () + "' option value: " + ov);
                                    return;
                                }
                                m_outMode = outMode;
                            }
                        }
                    }

                    // user '-props' file property overrides:

                    if (! processFilePropertyOverrides ()) return;

                    // process prefixed opts:

                    processCmdPropertyOverrides (parsedopts);
                }
                catch (IOException ioe)
                {
                    throw new EMMARuntimeException (IAppErrorCodes.ARGS_IO_FAILURE, ioe);
                }

                // handle cmd line-level defaults:
                {
                    if ($assert.ENABLED) $assert.ASSERT (m_outMode != null, "m_outMode not set");

                    if ((m_outMode != InstrProcessor.OutMode.OUT_MODE_OVERWRITE) && (m_outDirName == null))
                    {
                        usageexit (parser, IOptsParser.SHORT_USAGE,
                            "output directory must be specified for '" + m_outMode + "' output mode");
                        return;
                    }
                }
            }

            // run the instrumentor:
            {
                final InstrProcessor processor = InstrProcessor.create ();
                processor.setAppName (IAppConstants.APP_NAME); // for log prefixing

                processor.setInstrPath (m_instrpath, true); // TODO: an option to set 'canonical'?
                processor.setInclExclFilter (m_ixpath);
                $assert.ASSERT (m_outMode != null, "m_outMode not set");
                processor.setOutMode (m_outMode);
                processor.setInstrOutDir (m_outDirName);
                processor.setMetaOutFile (m_outFileName);
                processor.setMetaOutMerge (m_outDataMerge);
                processor.setPropertyOverrides (m_propertyOverrides);

                processor.run ();
            }
        }
        catch (EMMARuntimeException yre)
        {
            // TODO: see below

            exit (true, yre.getMessage (), yre, RC_UNEXPECTED); // does not return
            return;
        }
        catch (Throwable t)
        {
            // TODO: embed: OS/JVM fingerprint, build #, etc
            // TODO: save stack trace in a file and prompt user to send it to ...

            exit (true, "unexpected failure: ", t, RC_UNEXPECTED); // does not return
            return;
        }

        exit (false, null, null, RC_OK);
    }

    // protected: .............................................................

    protected void initialize ()
    {
        super.initialize ();
    }

    protected String usageArgsMsg ()
    {
        return "[options]";
    }

    // package: ...............................................................

    // private: ...............................................................

    private String [] m_instrpath;
    private String [] m_ixpath;
    private String m_outDirName;
    private String m_outFileName;
    private Boolean m_outDataMerge;
    private InstrProcessor.OutMode m_outMode;

} // end of class
// ----------------------------------------------------------------------------


text:
package com.lowlevel.lowholotheme;

import android.content.Context;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.widget.EditText;

public class EditTextHolo extends EditText {
	public EditTextHolo(Context context, AttributeSet attrs) {
		super(context, attrs);

        setTypeface(Typeface.createFromAsset(context.getAssets(), "Roboto-Regular.ttf"));
	}
}


text:
namespace Palantir.Numeric.UnitTests
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using Xunit;
    using FluentAssertions;
    using Palantir.Numeric;
    using Parser;

    public class FormulaLexerTests
    {
        private formulaLexer lexer;

        #region Unit Lexer
        [Fact]
        public void ReadSimpleUnits_ShouldOutputCorrectTokens()
        {
            Read("50kg");
            ExpectToken(formulaLexer.UNIT, "50kg");
            Read("50rad/s²");
            ExpectToken(formulaLexer.UNIT, "50rad/s²");
            Read("50e10kg");
            ExpectToken(formulaLexer.UNIT, "50e10kg");
            Read("50e10rad/s²");
            ExpectToken(formulaLexer.UNIT, "50e10rad/s²");
            Read("50.1kg");
            ExpectToken(formulaLexer.UNIT, "50.1kg");
            Read("50.1rad/s²");
            ExpectToken(formulaLexer.UNIT, "50.1rad/s²");

            // With spaces
            /* TODO: Get this working
            Read("50 kg");
            ExpectToken(formulaLexer.UNIT, "50 kg");
            Read("50 rad/s²");
            ExpectToken(formulaLexer.UNIT, "50 rad/s²");*/
            Read("50.1 kg");
            ExpectToken(formulaLexer.UNIT, "50.1 kg");
            Read("50.1 rad/s²");
            ExpectToken(formulaLexer.UNIT, "50.1 rad/s²");
        }
        #endregion

        #region Currency Lexer
        [Fact]
        public void ReadSimpleCurrencies_ShouldOutputCorrectTokens()
        {
            Read("$50");
            ExpectToken(formulaLexer.CURRENCY, "$50");
            Read("Lek50");
            ExpectToken(formulaLexer.CURRENCY, "Lek50");
            Read("؋50");
            ExpectToken(formulaLexer.CURRENCY, "؋50");
            Read("$50.1");
            ExpectToken(formulaLexer.CURRENCY, "$50.1");
            Read("Lek50.1");
            ExpectToken(formulaLexer.CURRENCY, "Lek50.1");
            Read("؋50.1");
            ExpectToken(formulaLexer.CURRENCY, "؋50.1");

            // With spaces
            Read("$ 50");
            ExpectToken(formulaLexer.CURRENCY, "$ 50");
            Read("Lek 50");
            ExpectToken(formulaLexer.CURRENCY, "Lek 50");
            Read("؋ 50");
            ExpectToken(formulaLexer.CURRENCY, "؋ 50");
            Read("$ 50.1");
            ExpectToken(formulaLexer.CURRENCY, "$ 50.1");
            Read("Lek 50.1");
            ExpectToken(formulaLexer.CURRENCY, "Lek 50.1");
            Read("؋ 50.1");
            ExpectToken(formulaLexer.CURRENCY, "؋ 50.1");
        }
        #endregion

        #region Number Lexer
        [Fact]
        public void ReadSimpleIntegers_ShouldOutputCorrectTokens()
        {
            Read("5");
            ExpectToken(formulaLexer.INTEGER, "5");

            Read("53");
            ExpectToken(formulaLexer.INTEGER, "53");

            Read("5362");
            ExpectToken(formulaLexer.INTEGER, "5362");

            Read("53628549");
            ExpectToken(formulaLexer.INTEGER, "53628549");
        }

        [Fact]
        public void ReadSimpleFloats_ShouldOutputCorrectTokens()
        {
            Read("5.3");
            ExpectToken(formulaLexer.FLOAT, "5.3");

            Read("53.3");
            ExpectToken(formulaLexer.FLOAT, "53.3");

            Read("5362.3");
            ExpectToken(formulaLexer.FLOAT, "5362.3");

            Read("53628549.3");
            ExpectToken(formulaLexer.FLOAT, "53628549.3");

            Read("5e3");
            ExpectToken(formulaLexer.FLOAT, "5e3");

            Read("53e3");
            ExpectToken(formulaLexer.FLOAT, "53e3");

            Read("5362e3");
            ExpectToken(formulaLexer.FLOAT, "5362e3");

            Read("53628549e3");
            ExpectToken(formulaLexer.FLOAT, "53628549e3");

            Read("5e+3");
            ExpectToken(formulaLexer.FLOAT, "5e+3");

            Read("53e+3");
            ExpectToken(formulaLexer.FLOAT, "53e+3");

            Read("5362e+3");
            ExpectToken(formulaLexer.FLOAT, "5362e+3");

            Read("53628549e+3");
            ExpectToken(formulaLexer.FLOAT, "53628549e+3");

            Read("5e-3");
            ExpectToken(formulaLexer.FLOAT, "5e-3");

            Read("53e-3");
            ExpectToken(formulaLexer.FLOAT, "53e-3");

            Read("5362e-3");
            ExpectToken(formulaLexer.FLOAT, "5362e-3");

            Read("53628549e-3");
            ExpectToken(formulaLexer.FLOAT, "53628549e-3");

            Read("5.3e3");
            ExpectToken(formulaLexer.FLOAT, "5.3e3");

            Read("53.3e3");
            ExpectToken(formulaLexer.FLOAT, "53.3e3");

            Read("5362.3e3");
            ExpectToken(formulaLexer.FLOAT, "5362.3e3");

            Read("53628549.3e3");
            ExpectToken(formulaLexer.FLOAT, "53628549.3e3");
        }

        #endregion

        #region Simple Calcs // A lot of simple and basic logic tests, many duplications
        [Fact]
        public void ReadSimpleEquationMUL_ShouldOutputCorrectTokens()
        {
            Read("5 * 3");

            ExpectToken(formulaLexer.INTEGER, "5");
            ExpectToken(formulaLexer.WHITESPACE);
            ExpectToken(formulaLexer.MULT);
            ExpectToken(formulaLexer.WHITESPACE);
            ExpectToken(formulaLexer.INTEGER, "3");
            ExpectToken(formulaLexer.EOF);
        }

        [Fact]
        public void ReadSimpleBigNumEquationMUL_ShouldOutputCorrectTokens()
        {
            Read("56 * 376");

            ExpectToken(formulaLexer.INTEGER, "56");
            ExpectToken(formulaLexer.WHITESPACE);
            ExpectToken(formulaLexer.MULT);
            ExpectToken(formulaLexer.WHITESPACE);
            ExpectToken(formulaLexer.INTEGER, "376");
            ExpectToken(formulaLexer.EOF);
        }

        [Fact]
        public void ReadSimpleBigNumCompressedEquationMUL_ShouldOutputCorrectTokens()
        {
            Read("56*376");

            ExpectToken(formulaLexer.INTEGER, "56");
            ExpectToken(formulaLexer.MULT);
            ExpectToken(formulaLexer.INTEGER, "376");
            ExpectToken(formulaLexer.EOF);
        }

        [Fact]
        public void ReadSimpleCompressedEquationMUL_ShouldOutputCorrectTokens()
        {
            Read("5*3");

            ExpectToken(formulaLexer.INTEGER, "5");
            ExpectToken(formulaLexer.MULT);
            ExpectToken(formulaLexer.INTEGER, "3");
            ExpectToken(formulaLexer.EOF);
        }

        [Fact]
        public void ReadSimpleEquationDIV_ShouldOutputCorrectTokens()
        {
            Read("5 / 3");

            ExpectToken(formulaLexer.INTEGER, "5");
            ExpectToken(formulaLexer.WHITESPACE);
            ExpectToken(formulaLexer.DIV);
            ExpectToken(formulaLexer.WHITESPACE);
            ExpectToken(formulaLexer.INTEGER, "3");
            ExpectToken(formulaLexer.EOF);
        }

        [Fact]
        public void ReadSimpleBigNumEquationDIV_ShouldOutputCorrectTokens()
        {
            Read("56 / 376");

            ExpectToken(formulaLexer.INTEGER, "56");
            ExpectToken(formulaLexer.WHITESPACE);
            ExpectToken(formulaLexer.DIV);
            ExpectToken(formulaLexer.WHITESPACE);
            ExpectToken(formulaLexer.INTEGER, "376");
            ExpectToken(formulaLexer.EOF);
        }

        [Fact]
        public void ReadSimpleBigNumCompressedEquationDIV_ShouldOutputCorrectTokens()
        {
            Read("56/376");

            ExpectToken(formulaLexer.INTEGER, "56");
            ExpectToken(formulaLexer.DIV);
            ExpectToken(formulaLexer.INTEGER, "376");
            ExpectToken(formulaLexer.EOF);
        }

        [Fact]
        public void ReadSimpleCompressedEquationDIV_ShouldOutputCorrectTokens()
        {
            Read("5/3");

            ExpectToken(formulaLexer.INTEGER, "5");
            ExpectToken(formulaLexer.DIV);
            ExpectToken(formulaLexer.INTEGER, "3");
            ExpectToken(formulaLexer.EOF);
        }

        [Fact]
        public void ReadSimpleEquationPLUS_ShouldOutputCorrectTokens()
        {
            Read("5 + 3");

            ExpectToken(formulaLexer.INTEGER, "5");
            ExpectToken(formulaLexer.WHITESPACE);
            ExpectToken(formulaLexer.PLUS);
            ExpectToken(formulaLexer.WHITESPACE);
            ExpectToken(formulaLexer.INTEGER, "3");
            ExpectToken(formulaLexer.EOF);
        }

        [Fact]
        public void ReadSimpleBigNumEquationPLUS_ShouldOutputCorrectTokens()
        {
            Read("56 + 376");

            ExpectToken(formulaLexer.INTEGER, "56");
            ExpectToken(formulaLexer.WHITESPACE);
            ExpectToken(formulaLexer.PLUS);
            ExpectToken(formulaLexer.WHITESPACE);
            ExpectToken(formulaLexer.INTEGER, "376");
            ExpectToken(formulaLexer.EOF);
        }

        [Fact]
        public void ReadSimpleBigNumCompressedEquationPLUS_ShouldOutputCorrectTokens()
        {
            Read("56+376");

            ExpectToken(formulaLexer.INTEGER, "56");
            ExpectToken(formulaLexer.PLUS);
            ExpectToken(formulaLexer.INTEGER, "376");
            ExpectToken(formulaLexer.EOF);
        }

        [Fact]
        public void ReadSimpleCompressedEquationPLUS_ShouldOutputCorrectTokens()
        {
            Read("5+3");

            ExpectToken(formulaLexer.INTEGER, "5");
            ExpectToken(formulaLexer.PLUS);
            ExpectToken(formulaLexer.INTEGER, "3");
            ExpectToken(formulaLexer.EOF);
        }

        [Fact]
        public void ReadSimpleEquationMINUS_ShouldOutputCorrectTokens()
        {
            Read("5 - 3");

            ExpectToken(formulaLexer.INTEGER, "5");
            ExpectToken(formulaLexer.WHITESPACE);
            ExpectToken(formulaLexer.MINUS);
            ExpectToken(formulaLexer.WHITESPACE);
            ExpectToken(formulaLexer.INTEGER, "3");
            ExpectToken(formulaLexer.EOF);
        }

        [Fact]
        public void ReadSimpleBigNumEquationMINUS_ShouldOutputCorrectTokens()
        {
            Read("56 - 376");

            ExpectToken(formulaLexer.INTEGER, "56");
            ExpectToken(formulaLexer.WHITESPACE);
            ExpectToken(formulaLexer.MINUS);
            ExpectToken(formulaLexer.WHITESPACE);
            ExpectToken(formulaLexer.INTEGER, "376");
            ExpectToken(formulaLexer.EOF);
        }

        [Fact]
        public void ReadSimpleBigNumCompressedEquationMINUS_ShouldOutputCorrectTokens()
        {
            Read("56-376");

            ExpectToken(formulaLexer.INTEGER, "56");
            ExpectToken(formulaLexer.MINUS);
            ExpectToken(formulaLexer.INTEGER, "376");
            ExpectToken(formulaLexer.EOF);
        }

        [Fact]
        public void ReadSimpleCompressedEquationMINUS_ShouldOutputCorrectTokens()
        {
            Read("5-3");

            ExpectToken(formulaLexer.INTEGER, "5");
            ExpectToken(formulaLexer.MINUS);
            ExpectToken(formulaLexer.INTEGER, "3");
            ExpectToken(formulaLexer.EOF);
        }
        #endregion

        private void Read(string text)
        {
            var input = new Antlr.Runtime.ANTLRStringStream(text);
            lexer = new formulaLexer(input);
        }

        private void ExpectToken(int type, string text = null)
        {
            var token = lexer.NextToken();
            token.Type.Should().Be(type);
            if (text != null)
            {
                token.Text.Should().Be(text);
            }
        }
    }
}