text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Affix</title>
    <link rel="stylesheet" href="../../../dist/css/bootstrap.min.css">

Affix
        Bootstrap Visual Test

Cras justo odio

Dapibus ac facilisis in

Morbi leo risus

Porta ac consectetur ac

Vestibulum at eros

Cras justo odio

Dapibus ac facilisis in

Morbi leo risus

Porta ac consectetur ac

Vestibulum at eros

Cras justo odio

Dapibus ac facilisis in

Morbi leo risus

Porta ac consectetur ac

Vestibulum at eros

Porta ac consectetur ac

Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean eu leo quam. Pellentesque ornare
        sem lacinia quam venenatis vestibulum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Duis mollis,
        est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Donec ullamcorper nulla non
        metus auctor fringilla. Nulla vitae elit libero, a pharetra augue. Maecenas sed diam eget risus varius blandit
        sit amet non magna.

Nullam id dolor id nibh ultricies vehicula ut id elit. Etiam porta sem malesuada magna mollis euismod. Cras justo
        odio, dapibus ac facilisis in, egestas eget quam. Curabitur blandit tempus porttitor. Cras justo odio, dapibus
        ac facilisis in, egestas eget quam.

Sed posuere consectetur est at lobortis. Maecenas faucibus mollis interdum. Vivamus sagittis lacus vel augue
        laoreet rutrum faucibus dolor auctor. Nulla vitae elit libero, a pharetra augue. Nulla vitae elit libero, a
        pharetra augue.

Aenean lacinia bibendum nulla sed consectetur. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis
        vestibulum. Nulla vitae elit libero, a pharetra augue. Fusce dapibus, tellus ac cursus commodo, tortor mauris
        condimentum nibh, ut fermentum massa justo sit amet risus. Cras mattis consectetur purus sit amet fermentum. Sed
        posuere consectetur est at lobortis. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.

Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean eu leo quam. Pellentesque ornare
        sem lacinia quam venenatis vestibulum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Duis mollis,
        est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Donec ullamcorper nulla non
        metus auctor fringilla. Nulla vitae elit libero, a pharetra augue. Maecenas sed diam eget risus varius blandit
        sit amet non magna.

Nullam id dolor id nibh ultricies vehicula ut id elit. Etiam porta sem malesuada magna mollis euismod. Cras justo
        odio, dapibus ac facilisis in, egestas eget quam. Curabitur blandit tempus porttitor. Cras justo odio, dapibus
        ac facilisis in, egestas eget quam.

Sed posuere consectetur est at lobortis. Maecenas faucibus mollis interdum. Vivamus sagittis lacus vel augue
        laoreet rutrum faucibus dolor auctor. Nulla vitae elit libero, a pharetra augue. Nulla vitae elit libero, a
        pharetra augue.

Aenean lacinia bibendum nulla sed consectetur. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis
        vestibulum. Nulla vitae elit libero, a pharetra augue. Fusce dapibus, tellus ac cursus commodo, tortor mauris
        condimentum nibh, ut fermentum massa justo sit amet risus. Cras mattis consectetur purus sit amet fermentum. Sed
        posuere consectetur est at lobortis. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.

Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean eu leo quam. Pellentesque ornare
        sem lacinia quam venenatis vestibulum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Duis mollis,
        est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Donec ullamcorper nulla non
        metus auctor fringilla. Nulla vitae elit libero, a pharetra augue. Maecenas sed diam eget risus varius blandit
        sit amet non magna.

Nullam id dolor id nibh ultricies vehicula ut id elit. Etiam porta sem malesuada magna mollis euismod. Cras justo
        odio, dapibus ac facilisis in, egestas eget quam. Curabitur blandit tempus porttitor. Cras justo odio, dapibus
        ac facilisis in, egestas eget quam.

Sed posuere consectetur est at lobortis. Maecenas faucibus mollis interdum. Vivamus sagittis lacus vel augue
        laoreet rutrum faucibus dolor auctor. Nulla vitae elit libero, a pharetra augue. Nulla vitae elit libero, a
        pharetra augue.

Aenean lacinia bibendum nulla sed consectetur. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis
        vestibulum. Nulla vitae elit libero, a pharetra augue. Fusce dapibus, tellus ac cursus commodo, tortor mauris
        condimentum nibh, ut fermentum massa justo sit amet risus. Cras mattis consectetur purus sit amet fermentum. Sed
        posuere consectetur est at lobortis. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.

Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean eu leo quam. Pellentesque ornare
        sem lacinia quam venenatis vestibulum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Duis mollis,
        est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Donec ullamcorper nulla non
        metus auctor fringilla. Nulla vitae elit libero, a pharetra augue. Maecenas sed diam eget risus varius blandit
        sit amet non magna.

Nullam id dolor id nibh ultricies vehicula ut id elit. Etiam porta sem malesuada magna mollis euismod. Cras justo
        odio, dapibus ac facilisis in, egestas eget quam. Curabitur blandit tempus porttitor. Cras justo odio, dapibus
        ac facilisis in, egestas eget quam.

Sed posuere consectetur est at lobortis. Maecenas faucibus mollis interdum. Vivamus sagittis lacus vel augue
        laoreet rutrum faucibus dolor auctor. Nulla vitae elit libero, a pharetra augue. Nulla vitae elit libero, a
        pharetra augue.

Aenean lacinia bibendum nulla sed consectetur. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis
        vestibulum. Nulla vitae elit libero, a pharetra augue. Fusce dapibus, tellus ac cursus commodo, tortor mauris
        condimentum nibh, ut fermentum massa justo sit amet risus. Cras mattis consectetur purus sit amet fermentum. Sed
        posuere consectetur est at lobortis. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.

Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean eu leo quam. Pellentesque ornare
        sem lacinia quam venenatis vestibulum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Duis mollis,
        est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Donec ullamcorper nulla non
        metus auctor fringilla. Nulla vitae elit libero, a pharetra augue. Maecenas sed diam eget risus varius blandit
        sit amet non magna.

Nullam id dolor id nibh ultricies vehicula ut id elit. Etiam porta sem malesuada magna mollis euismod. Cras justo
        odio, dapibus ac facilisis in, egestas eget quam. Curabitur blandit tempus porttitor. Cras justo odio, dapibus
        ac facilisis in, egestas eget quam.

Sed posuere consectetur est at lobortis. Maecenas faucibus mollis interdum. Vivamus sagittis lacus vel augue
        laoreet rutrum faucibus dolor auctor. Nulla vitae elit libero, a pharetra augue. Nulla vitae elit libero, a
        pharetra augue.

Aenean lacinia bibendum nulla sed consectetur. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis
        vestibulum. Nulla vitae elit libero, a pharetra augue. Fusce dapibus, tellus ac cursus commodo, tortor mauris
        condimentum nibh, ut fermentum massa justo sit amet risus. Cras mattis consectetur purus sit amet fermentum. Sed
        posuere consectetur est at lobortis. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.

Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean eu leo quam. Pellentesque ornare
        sem lacinia quam venenatis vestibulum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Duis mollis,
        est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Donec ullamcorper nulla non
        metus auctor fringilla. Nulla vitae elit libero, a pharetra augue. Maecenas sed diam eget risus varius blandit
        sit amet non magna.

Nullam id dolor id nibh ultricies vehicula ut id elit. Etiam porta sem malesuada magna mollis euismod. Cras justo
        odio, dapibus ac facilisis in, egestas eget quam. Curabitur blandit tempus porttitor. Cras justo odio, dapibus
        ac facilisis in, egestas eget quam.

Sed posuere consectetur est at lobortis. Maecenas faucibus mollis interdum. Vivamus sagittis lacus vel augue
        laoreet rutrum faucibus dolor auctor. Nulla vitae elit libero, a pharetra augue. Nulla vitae elit libero, a
        pharetra augue.

Aenean lacinia bibendum nulla sed consectetur. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis
        vestibulum. Nulla vitae elit libero, a pharetra augue. Fusce dapibus, tellus ac cursus commodo, tortor mauris
        condimentum nibh, ut fermentum massa justo sit amet risus. Cras mattis consectetur purus sit amet fermentum. Sed
        posuere consectetur est at lobortis. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.

Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean eu leo quam. Pellentesque ornare
        sem lacinia quam venenatis vestibulum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Duis mollis,
        est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Donec ullamcorper nulla non
        metus auctor fringilla. Nulla vitae elit libero, a pharetra augue. Maecenas sed diam eget risus varius blandit
        sit amet non magna.

Nullam id dolor id nibh ultricies vehicula ut id elit. Etiam porta sem malesuada magna mollis euismod. Cras justo
        odio, dapibus ac facilisis in, egestas eget quam. Curabitur blandit tempus porttitor. Cras justo odio, dapibus
        ac facilisis in, egestas eget quam.

Sed posuere consectetur est at lobortis. Maecenas faucibus mollis interdum. Vivamus sagittis lacus vel augue
        laoreet rutrum faucibus dolor auctor. Nulla vitae elit libero, a pharetra augue. Nulla vitae elit libero, a
        pharetra augue.

Aenean lacinia bibendum nulla sed consectetur. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis
        vestibulum. Nulla vitae elit libero, a pharetra augue. Fusce dapibus, tellus ac cursus commodo, tortor mauris
        condimentum nibh, ut fermentum massa justo sit amet risus. Cras mattis consectetur purus sit amet fermentum. Sed
        posuere consectetur est at lobortis. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.

Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean eu leo quam. Pellentesque ornare
        sem lacinia quam venenatis vestibulum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Duis mollis,
        est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Donec ullamcorper nulla non
        metus auctor fringilla. Nulla vitae elit libero, a pharetra augue. Maecenas sed diam eget risus varius blandit
        sit amet non magna.

Nullam id dolor id nibh ultricies vehicula ut id elit. Etiam porta sem malesuada magna mollis euismod. Cras justo
        odio, dapibus ac facilisis in, egestas eget quam. Curabitur blandit tempus porttitor. Cras justo odio, dapibus
        ac facilisis in, egestas eget quam.

Sed posuere consectetur est at lobortis. Maecenas faucibus mollis interdum. Vivamus sagittis lacus vel augue
        laoreet rutrum faucibus dolor auctor. Nulla vitae elit libero, a pharetra augue. Nulla vitae elit libero, a
        pharetra augue.

Aenean lacinia bibendum nulla sed consectetur. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis
        vestibulum. Nulla vitae elit libero, a pharetra augue. Fusce dapibus, tellus ac cursus commodo, tortor mauris
        condimentum nibh, ut fermentum massa justo sit amet risus. Cras mattis consectetur purus sit amet fermentum. Sed
        posuere consectetur est at lobortis. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.

Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean eu leo quam. Pellentesque ornare
        sem lacinia quam venenatis vestibulum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Duis mollis,
        est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Donec ullamcorper nulla non
        metus auctor fringilla. Nulla vitae elit libero, a pharetra augue. Maecenas sed diam eget risus varius blandit
        sit amet non magna.

Nullam id dolor id nibh ultricies vehicula ut id elit. Etiam porta sem malesuada magna mollis euismod. Cras justo
        odio, dapibus ac facilisis in, egestas eget quam. Curabitur blandit tempus porttitor. Cras justo odio, dapibus
        ac facilisis in, egestas eget quam.

Sed posuere consectetur est at lobortis. Maecenas faucibus mollis interdum. Vivamus sagittis lacus vel augue
        laoreet rutrum faucibus dolor auctor. Nulla vitae elit libero, a pharetra augue. Nulla vitae elit libero, a
        pharetra augue.

Aenean lacinia bibendum nulla sed consectetur. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis
        vestibulum. Nulla vitae elit libero, a pharetra augue. Fusce dapibus, tellus ac cursus commodo, tortor mauris
        condimentum nibh, ut fermentum massa justo sit amet risus. Cras mattis consectetur purus sit amet fermentum. Sed
        posuere consectetur est at lobortis. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.

Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean eu leo quam. Pellentesque ornare
        sem lacinia quam venenatis vestibulum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Duis mollis,
        est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Donec ullamcorper nulla non
        metus auctor fringilla. Nulla vitae elit libero, a pharetra augue. Maecenas sed diam eget risus varius blandit
        sit amet non magna.

Nullam id dolor id nibh ultricies vehicula ut id elit. Etiam porta sem malesuada magna mollis euismod. Cras justo
        odio, dapibus ac facilisis in, egestas eget quam. Curabitur blandit tempus porttitor. Cras justo odio, dapibus
        ac facilisis in, egestas eget quam.

Sed posuere consectetur est at lobortis. Maecenas faucibus mollis interdum. Vivamus sagittis lacus vel augue
        laoreet rutrum faucibus dolor auctor. Nulla vitae elit libero, a pharetra augue. Nulla vitae elit libero, a
        pharetra augue.

Aenean lacinia bibendum nulla sed consectetur. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis
        vestibulum. Nulla vitae elit libero, a pharetra augue. Fusce dapibus, tellus ac cursus commodo, tortor mauris
        condimentum nibh, ut fermentum massa justo sit amet risus. Cras mattis consectetur purus sit amet fermentum. Sed
        posuere consectetur est at lobortis. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.

Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean eu leo quam. Pellentesque ornare
        sem lacinia quam venenatis vestibulum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Duis mollis,
        est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Donec ullamcorper nulla non
        metus auctor fringilla. Nulla vitae elit libero, a pharetra augue. Maecenas sed diam eget risus varius blandit
        sit amet non magna.

Nullam id dolor id nibh ultricies vehicula ut id elit. Etiam porta sem malesuada magna mollis euismod. Cras justo
        odio, dapibus ac facilisis in, egestas eget quam. Curabitur blandit tempus porttitor. Cras justo odio, dapibus
        ac facilisis in, egestas eget quam.

Sed posuere consectetur est at lobortis. Maecenas faucibus mollis interdum. Vivamus sagittis lacus vel augue
        laoreet rutrum faucibus dolor auctor. Nulla vitae elit libero, a pharetra augue. Nulla vitae elit libero, a
        pharetra augue.

Aenean lacinia bibendum nulla sed consectetur. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis
        vestibulum. Nulla vitae elit libero, a pharetra augue. Fusce dapibus, tellus ac cursus commodo, tortor mauris
        condimentum nibh, ut fermentum massa justo sit amet risus. Cras mattis consectetur purus sit amet fermentum. Sed
        posuere consectetur est at lobortis. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.

Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean eu leo quam. Pellentesque ornare
        sem lacinia quam venenatis vestibulum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Duis mollis,
        est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Donec ullamcorper nulla non
        metus auctor fringilla. Nulla vitae elit libero, a pharetra augue. Maecenas sed diam eget risus varius blandit
        sit amet non magna.

Nullam id dolor id nibh ultricies vehicula ut id elit. Etiam porta sem malesuada magna mollis euismod. Cras justo
        odio, dapibus ac facilisis in, egestas eget quam. Curabitur blandit tempus porttitor. Cras justo odio, dapibus
        ac facilisis in, egestas eget quam.

Sed posuere consectetur est at lobortis. Maecenas faucibus mollis interdum. Vivamus sagittis lacus vel augue
        laoreet rutrum faucibus dolor auctor. Nulla vitae elit libero, a pharetra augue. Nulla vitae elit libero, a
        pharetra augue.

Aenean lacinia bibendum nulla sed consectetur. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis
        vestibulum. Nulla vitae elit libero, a pharetra augue. Fusce dapibus, tellus ac cursus commodo, tortor mauris
        condimentum nibh, ut fermentum massa justo sit amet risus. Cras mattis consectetur purus sit amet fermentum. Sed
        posuere consectetur est at lobortis. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.

Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean eu leo quam. Pellentesque ornare
        sem lacinia quam venenatis vestibulum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Duis mollis,
        est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Donec ullamcorper nulla non
        metus auctor fringilla. Nulla vitae elit libero, a pharetra augue. Maecenas sed diam eget risus varius blandit
        sit amet non magna.

Nullam id dolor id nibh ultricies vehicula ut id elit. Etiam porta sem malesuada magna mollis euismod. Cras justo
        odio, dapibus ac facilisis in, egestas eget quam. Curabitur blandit tempus porttitor. Cras justo odio, dapibus
        ac facilisis in, egestas eget quam.

Sed posuere consectetur est at lobortis. Maecenas faucibus mollis interdum. Vivamus sagittis lacus vel augue
        laoreet rutrum faucibus dolor auctor. Nulla vitae elit libero, a pharetra augue. Nulla vitae elit libero, a
        pharetra augue.

Aenean lacinia bibendum nulla sed consectetur. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis
        vestibulum. Nulla vitae elit libero, a pharetra augue. Fusce dapibus, tellus ac cursus commodo, tortor mauris
        condimentum nibh, ut fermentum massa justo sit amet risus. Cras mattis consectetur purus sit amet fermentum. Sed
        posuere consectetur est at lobortis. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.

Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean eu leo quam. Pellentesque ornare
        sem lacinia quam venenatis vestibulum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Duis mollis,
        est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Donec ullamcorper nulla non
        metus auctor fringilla. Nulla vitae elit libero, a pharetra augue. Maecenas sed diam eget risus varius blandit
        sit amet non magna.

Nullam id dolor id nibh ultricies vehicula ut id elit. Etiam porta sem malesuada magna mollis euismod. Cras justo
        odio, dapibus ac facilisis in, egestas eget quam. Curabitur blandit tempus porttitor. Cras justo odio, dapibus
        ac facilisis in, egestas eget quam.

Sed posuere consectetur est at lobortis. Maecenas faucibus mollis interdum. Vivamus sagittis lacus vel augue
        laoreet rutrum faucibus dolor auctor. Nulla vitae elit libero, a pharetra augue. Nulla vitae elit libero, a
        pharetra augue.

Aenean lacinia bibendum nulla sed consectetur. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis
        vestibulum. Nulla vitae elit libero, a pharetra augue. Fusce dapibus, tellus ac cursus commodo, tortor mauris
        condimentum nibh, ut fermentum massa justo sit amet risus. Cras mattis consectetur purus sit amet fermentum. Sed
        posuere consectetur est at lobortis. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.

Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean eu leo quam. Pellentesque ornare
        sem lacinia quam venenatis vestibulum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Duis mollis,
        est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Donec ullamcorper nulla non
        metus auctor fringilla. Nulla vitae elit libero, a pharetra augue. Maecenas sed diam eget risus varius blandit
        sit amet non magna.

Nullam id dolor id nibh ultricies vehicula ut id elit. Etiam porta sem malesuada magna mollis euismod. Cras justo
        odio, dapibus ac facilisis in, egestas eget quam. Curabitur blandit tempus porttitor. Cras justo odio, dapibus
        ac facilisis in, egestas eget quam.

Sed posuere consectetur est at lobortis. Maecenas faucibus mollis interdum. Vivamus sagittis lacus vel augue
        laoreet rutrum faucibus dolor auctor. Nulla vitae elit libero, a pharetra augue. Nulla vitae elit libero, a
        pharetra augue.

Aenean lacinia bibendum nulla sed consectetur. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis
        vestibulum. Nulla vitae elit libero, a pharetra augue. Fusce dapibus, tellus ac cursus commodo, tortor mauris
        condimentum nibh, ut fermentum massa justo sit amet risus. Cras mattis consectetur purus sit amet fermentum. Sed
        posuere consectetur est at lobortis. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.

Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean eu leo quam. Pellentesque ornare
        sem lacinia quam venenatis vestibulum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Duis mollis,
        est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Donec ullamcorper nulla non
        metus auctor fringilla. Nulla vitae elit libero, a pharetra augue. Maecenas sed diam eget risus varius blandit
        sit amet non magna.

Nullam id dolor id nibh ultricies vehicula ut id elit. Etiam porta sem malesuada magna mollis euismod. Cras justo
        odio, dapibus ac facilisis in, egestas eget quam. Curabitur blandit tempus porttitor. Cras justo odio, dapibus
        ac facilisis in, egestas eget quam.

Sed posuere consectetur est at lobortis. Maecenas faucibus mollis interdum. Vivamus sagittis lacus vel augue
        laoreet rutrum faucibus dolor auctor. Nulla vitae elit libero, a pharetra augue. Nulla vitae elit libero, a
        pharetra augue.

Aenean lacinia bibendum nulla sed consectetur. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis
        vestibulum. Nulla vitae elit libero, a pharetra augue. Fusce dapibus, tellus ac cursus commodo, tortor mauris
        condimentum nibh, ut fermentum massa justo sit amet risus. Cras mattis consectetur purus sit amet fermentum. Sed
        posuere consectetur est at lobortis. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.

Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean eu leo quam. Pellentesque ornare
        sem lacinia quam venenatis vestibulum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Duis mollis,
        est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Donec ullamcorper nulla non
        metus auctor fringilla. Nulla vitae elit libero, a pharetra augue. Maecenas sed diam eget risus varius blandit
        sit amet non magna.

Nullam id dolor id nibh ultricies vehicula ut id elit. Etiam porta sem malesuada magna mollis euismod. Cras justo
        odio, dapibus ac facilisis in, egestas eget quam. Curabitur blandit tempus porttitor. Cras justo odio, dapibus
        ac facilisis in, egestas eget quam.

Sed posuere consectetur est at lobortis. Maecenas faucibus mollis interdum. Vivamus sagittis lacus vel augue
        laoreet rutrum faucibus dolor auctor. Nulla vitae elit libero, a pharetra augue. Nulla vitae elit libero, a
        pharetra augue.

Aenean lacinia bibendum nulla sed consectetur. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis
        vestibulum. Nulla vitae elit libero, a pharetra augue. Fusce dapibus, tellus ac cursus commodo, tortor mauris
        condimentum nibh, ut fermentum massa justo sit amet risus. Cras mattis consectetur purus sit amet fermentum. Sed
        posuere consectetur est at lobortis. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.

Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean eu leo quam. Pellentesque ornare
        sem lacinia quam venenatis vestibulum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Duis mollis,
        est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Donec ullamcorper nulla non
        metus auctor fringilla. Nulla vitae elit libero, a pharetra augue. Maecenas sed diam eget risus varius blandit
        sit amet non magna.

Nullam id dolor id nibh ultricies vehicula ut id elit. Etiam porta sem malesuada magna mollis euismod. Cras justo
        odio, dapibus ac facilisis in, egestas eget quam. Curabitur blandit tempus porttitor. Cras justo odio, dapibus
        ac facilisis in, egestas eget quam.

Sed posuere consectetur est at lobortis. Maecenas faucibus mollis interdum. Vivamus sagittis lacus vel augue
        laoreet rutrum faucibus dolor auctor. Nulla vitae elit libero, a pharetra augue. Nulla vitae elit libero, a
        pharetra augue.

Aenean lacinia bibendum nulla sed consectetur. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis
        vestibulum. Nulla vitae elit libero, a pharetra augue. Fusce dapibus, tellus ac cursus commodo, tortor mauris
        condimentum nibh, ut fermentum massa justo sit amet risus. Cras mattis consectetur purus sit amet fermentum. Sed
        posuere consectetur est at lobortis. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.

Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean eu leo quam. Pellentesque ornare
        sem lacinia quam venenatis vestibulum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Duis mollis,
        est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Donec ullamcorper nulla non
        metus auctor fringilla. Nulla vitae elit libero, a pharetra augue. Maecenas sed diam eget risus varius blandit
        sit amet non magna.

Nullam id dolor id nibh ultricies vehicula ut id elit. Etiam porta sem malesuada magna mollis euismod. Cras justo
        odio, dapibus ac facilisis in, egestas eget quam. Curabitur blandit tempus porttitor. Cras justo odio, dapibus
        ac facilisis in, egestas eget quam.

Sed posuere consectetur est at lobortis. Maecenas faucibus mollis interdum. Vivamus sagittis lacus vel augue
        laoreet rutrum faucibus dolor auctor. Nulla vitae elit libero, a pharetra augue. Nulla vitae elit libero, a
        pharetra augue.

Aenean lacinia bibendum nulla sed consectetur. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis
        vestibulum. Nulla vitae elit libero, a pharetra augue. Fusce dapibus, tellus ac cursus commodo, tortor mauris
        condimentum nibh, ut fermentum massa justo sit amet risus. Cras mattis consectetur purus sit amet fermentum. Sed
        posuere consectetur est at lobortis. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.

Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean eu leo quam. Pellentesque ornare
        sem lacinia quam venenatis vestibulum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Duis mollis,
        est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Donec ullamcorper nulla non
        metus auctor fringilla. Nulla vitae elit libero, a pharetra augue. Maecenas sed diam eget risus varius blandit
        sit amet non magna.

Nullam id dolor id nibh ultricies vehicula ut id elit. Etiam porta sem malesuada magna mollis euismod. Cras justo
        odio, dapibus ac facilisis in, egestas eget quam. Curabitur blandit tempus porttitor. Cras justo odio, dapibus
        ac facilisis in, egestas eget quam.

Sed posuere consectetur est at lobortis. Maecenas faucibus mollis interdum. Vivamus sagittis lacus vel augue
        laoreet rutrum faucibus dolor auctor. Nulla vitae elit libero, a pharetra augue. Nulla vitae elit libero, a
        pharetra augue.

Aenean lacinia bibendum nulla sed consectetur. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis
        vestibulum. Nulla vitae elit libero, a pharetra augue. Fusce dapibus, tellus ac cursus commodo, tortor mauris
        condimentum nibh, ut fermentum massa justo sit amet risus. Cras mattis consectetur purus sit amet fermentum. Sed
        posuere consectetur est at lobortis. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.

Sit necessitatibus aspernatur.

Adipisicing alias dolor!

Ipsum molestiae impedit.

Amet quis iste?

Ipsum quaerat porro.

Elit lorem libero.

Ipsum dolore facilis.

Elit ad atque.

Dolor amet sequi!

Consectetur voluptatum facilis!

Sit neque eligendi?

Amet fuga consectetur!

Amet molestias repellat!

Consectetur minima repellendus.

Grow content

Shrink content

Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean eu leo quam. Pellentesque ornare
        sem lacinia quam venenatis vestibulum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Duis mollis,
        est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Donec ullamcorper nulla non
        metus auctor fringilla. Nulla vitae elit libero, a pharetra augue. Maecenas sed diam eget risus varius blandit
        sit amet non magna.

Nullam id dolor id nibh ultricies vehicula ut id elit. Etiam porta sem malesuada magna mollis euismod. Cras justo
        odio, dapibus ac facilisis in, egestas eget quam. Curabitur blandit tempus porttitor. Cras justo odio, dapibus
        ac facilisis in, egestas eget quam.

Sed posuere consectetur est at lobortis. Maecenas faucibus mollis interdum. Vivamus sagittis lacus vel augue
        laoreet rutrum faucibus dolor auctor. Nulla vitae elit libero, a pharetra augue. Nulla vitae elit libero, a
        pharetra augue.

Aenean lacinia bibendum nulla sed consectetur. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis
        vestibulum. Nulla vitae elit libero, a pharetra augue. Fusce dapibus, tellus ac cursus commodo, tortor mauris
        condimentum nibh, ut fermentum massa justo sit amet risus. Cras mattis consectetur purus sit amet fermentum. Sed
        posuere consectetur est at lobortis. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.


text:
package qtypes

import (
	"strconv"
	"github.com/elastic/beats/libbeat/common"
	"github.com/docker/docker/api/types"
	dc "github.com/fsouza/go-dockerclient"
)

// Inspired by https://github.com/elastic/beats/blob/master/metricbeat/module/docker/cpu/helper.go
type CPUStats struct {
	Base
	Container                   *types.Container
	PerCpuUsage                 common.MapStr
	TotalUsage                  float64
	UsageInKernelmode           uint64
	UsageInKernelmodePercentage float64
	UsageInUsermode             uint64
	UsageInUsermodePercentage   float64
	SystemUsage                 uint64
	SystemUsagePercentage       float64
}

func NewCPUStats(src Base, stats *dc.Stats) *CPUStats {
	return &CPUStats{
		Base: src,
		PerCpuUsage: perCpuUsage(stats),
		TotalUsage: totalUsage(stats),
		UsageInKernelmode: stats.CPUStats.CPUUsage.UsageInKernelmode,
		UsageInKernelmodePercentage: usageInKernelmode(stats),
		UsageInUsermode: stats.CPUStats.CPUUsage.UsageInUsermode,
		UsageInUsermodePercentage: usageInUsermode(stats),
		SystemUsage: stats.CPUStats.SystemCPUUsage,
		SystemUsagePercentage: systemUsage(stats),
	}
}

func (cs *CPUStats) ToMetrics(src string) []Metric {
	dim := AssembleDefaultDimensions(cs.Container)
	return []Metric{
		cs.NewExtMetric(src, "cpu.usage.kernel.percent", Gauge, cs.UsageInKernelmodePercentage, dim, cs.Time, true),
		cs.NewExtMetric(src, "cpu.usage.user.percent", Gauge, cs.UsageInUsermodePercentage, dim, cs.Time, true),
		cs.NewExtMetric(src, "cpu.system.usage.percent", Gauge, cs.SystemUsagePercentage, dim, cs.Time, true),
	}
}

func perCpuUsage(stats *dc.Stats) common.MapStr {
	var output common.MapStr
	if len(stats.CPUStats.CPUUsage.PercpuUsage) == len(stats.PreCPUStats.CPUUsage.PercpuUsage) {
		output = common.MapStr{}
		for index := range stats.CPUStats.CPUUsage.PercpuUsage {
			cpu := common.MapStr{}
			cpu["pct"] = calculateLoad(stats.CPUStats.CPUUsage.PercpuUsage[index] - stats.PreCPUStats.CPUUsage.PercpuUsage[index])
			cpu["ticks"] = stats.CPUStats.CPUUsage.PercpuUsage[index]
			output[strconv.Itoa(index)] = cpu
		}
	}
	return output
}

func totalUsage(stats *dc.Stats) float64 {
	return calculateLoad(stats.CPUStats.CPUUsage.TotalUsage - stats.PreCPUStats.CPUUsage.TotalUsage)
}

func usageInKernelmode(stats *dc.Stats) (val float64) {
	if stats.PreCPUStats.CPUUsage.UsageInKernelmode == 0 {
		return
	}
	return calculateLoad(stats.CPUStats.CPUUsage.UsageInKernelmode - stats.PreCPUStats.CPUUsage.UsageInKernelmode)
}

func usageInUsermode(stats *dc.Stats) (val float64) {
	if stats.PreCPUStats.CPUUsage.UsageInUsermode == 0 {
		return
	}
	return calculateLoad(stats.CPUStats.CPUUsage.UsageInUsermode - stats.PreCPUStats.CPUUsage.UsageInUsermode)
}

func systemUsage(stats *dc.Stats) (val float64) {
	if stats.PreCPUStats.SystemCPUUsage == 0 {
		return
	}
	return calculateLoad(stats.CPUStats.SystemCPUUsage - stats.PreCPUStats.SystemCPUUsage)
}

func calculateLoad(value uint64) float64 {
	return float64(value) / float64(1000000000)
}

// \beats

redpajama_set_name: RedPajamaGithub


text:
/*
 * This file is available under and governed by the GNU General Public
 * License version 2 only, as published by the Free Software Foundation.
 * However, the following notice accompanied the original version of this
 * file:
 *
 * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos
 *
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *  * Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 *
 *  * Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 *
 *  * Neither the name of JSR-310 nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
package tck.java.time.format;

import static java.time.temporal.ChronoField.DAY_OF_MONTH;
import static java.time.temporal.ChronoField.DAY_OF_WEEK;
import static java.time.temporal.ChronoField.DAY_OF_YEAR;
import static java.time.temporal.ChronoField.HOUR_OF_DAY;
import static java.time.temporal.ChronoField.MONTH_OF_YEAR;
import static java.time.temporal.ChronoField.YEAR;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;

import java.text.Format;
import java.text.ParseException;
import java.text.ParsePosition;
import java.time.DateTimeException;
import java.time.DayOfWeek;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.OffsetDateTime;
import java.time.OffsetTime;
import java.time.YearMonth;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.time.chrono.ChronoZonedDateTime;
import java.time.chrono.Chronology;
import java.time.chrono.IsoChronology;
import java.time.chrono.ThaiBuddhistChronology;
import java.time.chrono.ThaiBuddhistDate;
import java.time.format.DecimalStyle;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.time.format.DateTimeParseException;
import java.time.format.SignStyle;
import java.time.temporal.IsoFields;
import java.time.temporal.TemporalAccessor;
import java.time.temporal.TemporalField;
import java.time.temporal.TemporalQuery;
import java.time.temporal.UnsupportedTemporalTypeException;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Locale;
import java.util.Set;

import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

/**
 * Test DateTimeFormatter.
 */
@Test
public class TCKDateTimeFormatter {

    private static final ZoneOffset OFFSET_PONE = ZoneOffset.ofHours(1);
    private static final ZoneOffset OFFSET_PTHREE = ZoneOffset.ofHours(3);
    private static final ZoneId ZONE_PARIS = ZoneId.of("Europe/Paris");

    private static final DateTimeFormatter BASIC_FORMATTER = DateTimeFormatter.ofPattern("'ONE'd");
    private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("'ONE'yyyy MM dd");

    private DateTimeFormatter fmt;

    @BeforeMethod
    public void setUp() {
        fmt = new DateTimeFormatterBuilder().appendLiteral("ONE")
                                            .appendValue(DAY_OF_MONTH, 1, 2, SignStyle.NOT_NEGATIVE)
                                            .toFormatter();
    }

    //-----------------------------------------------------------------------
    @Test
    public void test_withLocale() {
        DateTimeFormatter base = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        DateTimeFormatter test = base.withLocale(Locale.GERMAN);
        assertEquals(test.getLocale(), Locale.GERMAN);
    }

    @Test(expectedExceptions=NullPointerException.class)
    public void test_withLocale_null() {
        DateTimeFormatter base = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        base.withLocale((Locale) null);
    }

    //-----------------------------------------------------------------------
    @Test
    public void test_withChronology() {
        DateTimeFormatter test = fmt;
        assertEquals(test.getChronology(), null);
        test = test.withChronology(IsoChronology.INSTANCE);
        assertEquals(test.getChronology(), IsoChronology.INSTANCE);
        test = test.withChronology(null);
        assertEquals(test.getChronology(), null);
    }

    //-----------------------------------------------------------------------
    @Test
    public void test_withZone() {
        DateTimeFormatter test = fmt;
        assertEquals(test.getZone(), null);
        test = test.withZone(ZoneId.of("Europe/Paris"));
        assertEquals(test.getZone(), ZoneId.of("Europe/Paris"));
        test = test.withZone(ZoneOffset.UTC);
        assertEquals(test.getZone(), ZoneOffset.UTC);
        test = test.withZone(null);
        assertEquals(test.getZone(), null);
    }

    //-----------------------------------------------------------------------
    @Test
    public void test_resolverFields_selectOneDateResolveYMD() throws Exception {
        DateTimeFormatter base = new DateTimeFormatterBuilder()
                .appendValue(YEAR).appendLiteral('-').appendValue(MONTH_OF_YEAR).appendLiteral('-')
                .appendValue(DAY_OF_MONTH).appendLiteral('-').appendValue(DAY_OF_YEAR).toFormatter();
        DateTimeFormatter f = base.withResolverFields(YEAR, MONTH_OF_YEAR, DAY_OF_MONTH);
        try {
            base.parse("2012-6-30-321", LocalDate::from);  // wrong day-of-year
            fail();
        } catch (DateTimeException ex) {
            // expected, fails as it produces two different dates
        }
        LocalDate parsed = f.parse("2012-6-30-321", LocalDate::from);  // ignored day-of-year
        assertEquals(parsed, LocalDate.of(2012, 6, 30));
    }

    @Test
    public void test_resolverFields_selectOneDateResolveYD() throws Exception {
        DateTimeFormatter base = new DateTimeFormatterBuilder()
                .appendValue(YEAR).appendLiteral('-').appendValue(MONTH_OF_YEAR).appendLiteral('-')
                .appendValue(DAY_OF_MONTH).appendLiteral('-').appendValue(DAY_OF_YEAR).toFormatter();
        DateTimeFormatter f = base.withResolverFields(YEAR, DAY_OF_YEAR);
        Set<TemporalField> expected = new HashSet<>(Arrays.asList(YEAR, DAY_OF_YEAR));
        // Use set.equals();  testNG comparison of Collections is ordered
        assertTrue(f.getResolverFields().equals(expected), "ResolveFields: " + f.getResolverFields());
        try {
            base.parse("2012-6-30-321", LocalDate::from);  // wrong month/day-of-month
            fail();
        } catch (DateTimeException ex) {
            // expected, fails as it produces two different dates
        }
        LocalDate parsed = f.parse("2012-6-30-321", LocalDate::from);  // ignored month/day-of-month
        assertEquals(parsed, LocalDate.of(2012, 11, 16));
    }

    @Test
    public void test_resolverFields_ignoreCrossCheck() throws Exception {
        DateTimeFormatter base = new DateTimeFormatterBuilder()
                .appendValue(YEAR).appendLiteral('-').appendValue(DAY_OF_YEAR).appendLiteral('-')
                .appendValue(DAY_OF_WEEK).toFormatter();
        DateTimeFormatter f = base.withResolverFields(YEAR, DAY_OF_YEAR);
        try {
            base.parse("2012-321-1", LocalDate::from);  // wrong day-of-week
            fail();
        } catch (DateTimeException ex) {
            // expected, should fail in cross-check of day-of-week
        }
        LocalDate parsed = f.parse("2012-321-1", LocalDate::from);  // ignored wrong day-of-week
        assertEquals(parsed, LocalDate.of(2012, 11, 16));
    }

    @Test
    public void test_resolverFields_emptyList() throws Exception {
        DateTimeFormatter f = new DateTimeFormatterBuilder()
                .appendValue(YEAR).toFormatter().withResolverFields();
        TemporalAccessor parsed = f.parse("2012");
        assertEquals(parsed.isSupported(YEAR), false);  // not in the list of resolverFields
    }

    @Test
    public void test_resolverFields_listOfOneMatching() throws Exception {
        DateTimeFormatter f = new DateTimeFormatterBuilder()
                .appendValue(YEAR).toFormatter().withResolverFields(YEAR);
        TemporalAccessor parsed = f.parse("2012");
        assertEquals(parsed.isSupported(YEAR), true);
    }

    @Test
    public void test_resolverFields_listOfOneNotMatching() throws Exception {
        DateTimeFormatter f = new DateTimeFormatterBuilder()
                .appendValue(YEAR).toFormatter().withResolverFields(MONTH_OF_YEAR);
        TemporalAccessor parsed = f.parse("2012");
        assertEquals(parsed.isSupported(YEAR), false);  // not in the list of resolverFields
        assertEquals(parsed.isSupported(MONTH_OF_YEAR), false);
    }

    @Test
    public void test_resolverFields_listOfOneNull() throws Exception {
        DateTimeFormatter f = new DateTimeFormatterBuilder()
                .appendValue(YEAR).toFormatter().withResolverFields((TemporalField) null);
        TemporalAccessor parsed = f.parse("2012");
        assertEquals(parsed.isSupported(YEAR), false);  // not in the list of resolverFields
    }

    @Test(expectedExceptions = NullPointerException.class)
    public void test_resolverFields_Array_null() throws Exception {
        DateTimeFormatter.ISO_DATE.withResolverFields((TemporalField[]) null);
    }

    @Test(expectedExceptions = NullPointerException.class)
    public void test_resolverFields_Set_null() throws Exception {
        DateTimeFormatter.ISO_DATE.withResolverFields((Set<TemporalField>) null);
    }

    //-----------------------------------------------------------------------
    // format
    //-----------------------------------------------------------------------
    @DataProvider(name="formatWithZoneWithChronology")
    Object[][] data_format_withZone_withChronology() {
        YearMonth ym = YearMonth.of(2008, 6);
        LocalDate ld = LocalDate.of(2008, 6, 30);
        LocalTime lt = LocalTime.of(11, 30);
        LocalDateTime ldt = LocalDateTime.of(2008, 6, 30, 11, 30);
        OffsetTime ot = OffsetTime.of(LocalTime.of(11, 30), OFFSET_PONE);
        OffsetDateTime odt = OffsetDateTime.of(LocalDateTime.of(2008, 6, 30, 11, 30), OFFSET_PONE);
        ZonedDateTime zdt = ZonedDateTime.of(LocalDateTime.of(2008, 6, 30, 11, 30), ZONE_PARIS);
        ChronoZonedDateTime<ThaiBuddhistDate> thaiZdt = ThaiBuddhistChronology.INSTANCE.zonedDateTime(zdt);
        Instant instant = Instant.ofEpochSecond(3600);
        return new Object[][] {
                {null, null, DayOfWeek.MONDAY, "::::"},
                {null, null, ym, "2008::::ISO"},
                {null, null, ld, "2008::::ISO"},
                {null, null, lt, ":11:::"},
                {null, null, ldt, "2008:11:::ISO"},
                {null, null, ot, ":11:+01:00::"},
                {null, null, odt, "2008:11:+01:00::ISO"},
                {null, null, zdt, "2008:11:+02:00:Europe/Paris:ISO"},
                {null, null, instant, "::::"},

                {IsoChronology.INSTANCE, null, DayOfWeek.MONDAY, "::::ISO"},
                {IsoChronology.INSTANCE, null, ym, "2008::::ISO"},
                {IsoChronology.INSTANCE, null, ld, "2008::::ISO"},
                {IsoChronology.INSTANCE, null, lt, ":11:::ISO"},
                {IsoChronology.INSTANCE, null, ldt, "2008:11:::ISO"},
                {IsoChronology.INSTANCE, null, ot, ":11:+01:00::ISO"},
                {IsoChronology.INSTANCE, null, odt, "2008:11:+01:00::ISO"},
                {IsoChronology.INSTANCE, null, zdt, "2008:11:+02:00:Europe/Paris:ISO"},
                {IsoChronology.INSTANCE, null, instant, "::::ISO"},

                {null, ZONE_PARIS, DayOfWeek.MONDAY, ":::Europe/Paris:"},
                {null, ZONE_PARIS, ym, "2008:::Europe/Paris:ISO"},
                {null, ZONE_PARIS, ld, "2008:::Europe/Paris:ISO"},
                {null, ZONE_PARIS, lt, ":11::Europe/Paris:"},
                {null, ZONE_PARIS, ldt, "2008:11::Europe/Paris:ISO"},
                {null, ZONE_PARIS, ot, ":11:+01:00:Europe/Paris:"},
                {null, ZONE_PARIS, odt, "2008:12:+02:00:Europe/Paris:ISO"},
                {null, ZONE_PARIS, zdt, "2008:11:+02:00:Europe/Paris:ISO"},
                {null, ZONE_PARIS, instant, "1970:02:+01:00:Europe/Paris:ISO"},

                {null, OFFSET_PTHREE, DayOfWeek.MONDAY, ":::+03:00:"},
                {null, OFFSET_PTHREE, ym, "2008:::+03:00:ISO"},
                {null, OFFSET_PTHREE, ld, "2008:::+03:00:ISO"},
                {null, OFFSET_PTHREE, lt, ":11::+03:00:"},
                {null, OFFSET_PTHREE, ldt, "2008:11::+03:00:ISO"},
                {null, OFFSET_PTHREE, ot, null},  // offset and zone clash
                {null, OFFSET_PTHREE, odt, "2008:13:+03:00:+03:00:ISO"},
                {null, OFFSET_PTHREE, zdt, "2008:12:+03:00:+03:00:ISO"},
                {null, OFFSET_PTHREE, instant, "1970:04:+03:00:+03:00:ISO"},

                {ThaiBuddhistChronology.INSTANCE, null, DayOfWeek.MONDAY, null},  // not a complete date
                {ThaiBuddhistChronology.INSTANCE, null, ym, null},  // not a complete date
                {ThaiBuddhistChronology.INSTANCE, null, ld, "2551::::ThaiBuddhist"},
                {ThaiBuddhistChronology.INSTANCE, null, lt, ":11:::ThaiBuddhist"},
                {ThaiBuddhistChronology.INSTANCE, null, ldt, "2551:11:::ThaiBuddhist"},
                {ThaiBuddhistChronology.INSTANCE, null, ot, ":11:+01:00::ThaiBuddhist"},
                {ThaiBuddhistChronology.INSTANCE, null, odt, "2551:11:+01:00::ThaiBuddhist"},
                {ThaiBuddhistChronology.INSTANCE, null, zdt, "2551:11:+02:00:Europe/Paris:ThaiBuddhist"},
                {ThaiBuddhistChronology.INSTANCE, null, instant, "::::ThaiBuddhist"},

                {ThaiBuddhistChronology.INSTANCE, null, DayOfWeek.MONDAY, null},  // not a complete date
                {ThaiBuddhistChronology.INSTANCE, ZONE_PARIS, ym, null},  // not a complete date
                {ThaiBuddhistChronology.INSTANCE, ZONE_PARIS, ld, "2551:::Europe/Paris:ThaiBuddhist"},
                {ThaiBuddhistChronology.INSTANCE, ZONE_PARIS, lt, ":11::Europe/Paris:ThaiBuddhist"},
                {ThaiBuddhistChronology.INSTANCE, ZONE_PARIS, ldt, "2551:11::Europe/Paris:ThaiBuddhist"},
                {ThaiBuddhistChronology.INSTANCE, ZONE_PARIS, ot, ":11:+01:00:Europe/Paris:ThaiBuddhist"},
                {ThaiBuddhistChronology.INSTANCE, ZONE_PARIS, odt, "2551:12:+02:00:Europe/Paris:ThaiBuddhist"},
                {ThaiBuddhistChronology.INSTANCE, ZONE_PARIS, zdt, "2551:11:+02:00:Europe/Paris:ThaiBuddhist"},
                {ThaiBuddhistChronology.INSTANCE, ZONE_PARIS, instant, "2513:02:+01:00:Europe/Paris:ThaiBuddhist"},

                {null, ZONE_PARIS, thaiZdt, "2551:11:+02:00:Europe/Paris:ThaiBuddhist"},
                {ThaiBuddhistChronology.INSTANCE, ZONE_PARIS, thaiZdt, "2551:11:+02:00:Europe/Paris:ThaiBuddhist"},
                {IsoChronology.INSTANCE, ZONE_PARIS, thaiZdt, "2008:11:+02:00:Europe/Paris:ISO"},
        };
    }

    @Test(dataProvider="formatWithZoneWithChronology")
    public void test_format_withZone_withChronology(Chronology overrideChrono, ZoneId overrideZone, TemporalAccessor temporal, String expected) {
        DateTimeFormatter test = new DateTimeFormatterBuilder()
                .optionalStart().appendValue(YEAR, 4).optionalEnd()
                .appendLiteral(':').optionalStart().appendValue(HOUR_OF_DAY, 2).optionalEnd()
                .appendLiteral(':').optionalStart().appendOffsetId().optionalEnd()
                .appendLiteral(':').optionalStart().appendZoneId().optionalEnd()
                .appendLiteral(':').optionalStart().appendChronologyId().optionalEnd()
                .toFormatter(Locale.ENGLISH)
                .withChronology(overrideChrono).withZone(overrideZone);
        if (expected != null) {
            String result = test.format(temporal);
            assertEquals(result, expected);
        } else {
            try {
                test.format(temporal);
                fail("Formatting should have failed");
            } catch (DateTimeException ex) {
                // expected
            }
        }
    }

    @Test
    public void test_format_withChronology_nonChronoFieldMapLink() {
        TemporalAccessor temporal = new TemporalAccessor() {
            @Override
            public boolean isSupported(TemporalField field) {
                return field == IsoFields.WEEK_BASED_YEAR;
            }
            @Override
            public long getLong(TemporalField field) {
                if (field == IsoFields.WEEK_BASED_YEAR) {
                    return 2345;
                }
                throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
            }
        };
        DateTimeFormatter test = new DateTimeFormatterBuilder()
                .appendValue(IsoFields.WEEK_BASED_YEAR, 4)
                .toFormatter(Locale.ENGLISH)
                .withChronology(IsoChronology.INSTANCE);
        String result = test.format(temporal);
        assertEquals(result, "2345");
    }

    //-----------------------------------------------------------------------
    @Test
    public void test_format_TemporalAccessor_simple() {
        DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        String result = test.format(LocalDate.of(2008, 6, 30));
        assertEquals(result, "ONE30");
    }

    @Test(expectedExceptions = DateTimeException.class)
    public void test_format_TemporalAccessor_noSuchField() {
        DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        test.format(LocalTime.of(11, 30));
    }

    @Test(expectedExceptions = NullPointerException.class)
    public void test_format_TemporalAccessor_null() {
        DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        test.format((TemporalAccessor) null);
    }

    //-----------------------------------------------------------------------
    @Test
    public void test_print_TemporalAppendable() throws Exception {
        DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        StringBuilder buf = new StringBuilder();
        test.formatTo(LocalDate.of(2008, 6, 30), buf);
        assertEquals(buf.toString(), "ONE30");
    }

    @Test(expectedExceptions=DateTimeException.class)
    public void test_print_TemporalAppendable_noSuchField() throws Exception {
        DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        StringBuilder buf = new StringBuilder();
        test.formatTo(LocalTime.of(11, 30), buf);
    }

    @Test(expectedExceptions=NullPointerException.class)
    public void test_print_TemporalAppendable_nullTemporal() throws Exception {
        DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        StringBuilder buf = new StringBuilder();
        test.formatTo((TemporalAccessor) null, buf);
    }

    @Test(expectedExceptions=NullPointerException.class)
    public void test_print_TemporalAppendable_nullAppendable() throws Exception {
        DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        test.formatTo(LocalDate.of(2008, 6, 30), (Appendable) null);
    }

    //-----------------------------------------------------------------------
    // parse(CharSequence)
    //-----------------------------------------------------------------------
    @Test
    public void test_parse_CharSequence() {
        DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        TemporalAccessor result = test.parse("ONE30");
        assertEquals(result.isSupported(DAY_OF_MONTH), true);
        assertEquals(result.getLong(DAY_OF_MONTH), 30L);
        assertEquals(result.isSupported(HOUR_OF_DAY), false);
    }

    @Test
    public void test_parse_CharSequence_resolved() {
        DateTimeFormatter test = DateTimeFormatter.ISO_DATE;
        TemporalAccessor result = test.parse("2012-06-30");
        assertEquals(result.isSupported(YEAR), true);
        assertEquals(result.isSupported(MONTH_OF_YEAR), true);
        assertEquals(result.isSupported(DAY_OF_MONTH), true);
        assertEquals(result.isSupported(HOUR_OF_DAY), false);
        assertEquals(result.getLong(YEAR), 2012L);
        assertEquals(result.getLong(MONTH_OF_YEAR), 6L);
        assertEquals(result.getLong(DAY_OF_MONTH), 30L);
        assertEquals(result.query(LocalDate::from), LocalDate.of(2012, 6, 30));
    }

    @Test(expectedExceptions=NullPointerException.class)
    public void test_parse_CharSequence_null() {
        DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        test.parse((String) null);
    }

    //-----------------------------------------------------------------------
    // parse(CharSequence)
    //-----------------------------------------------------------------------
    @Test
    public void test_parse_CharSequence_ParsePosition() {
        DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        ParsePosition pos = new ParsePosition(3);
        TemporalAccessor result = test.parse("XXXONE30XXX", pos);
        assertEquals(pos.getIndex(), 8);
        assertEquals(pos.getErrorIndex(), -1);
        assertEquals(result.isSupported(DAY_OF_MONTH), true);
        assertEquals(result.getLong(DAY_OF_MONTH), 30L);
        assertEquals(result.isSupported(HOUR_OF_DAY), false);
    }

    @Test
    public void test_parse_CharSequence_ParsePosition_resolved() {
        DateTimeFormatter test = DateTimeFormatter.ISO_DATE;
        ParsePosition pos = new ParsePosition(3);
        TemporalAccessor result = test.parse("XXX2012-06-30XXX", pos);
        assertEquals(pos.getIndex(), 13);
        assertEquals(pos.getErrorIndex(), -1);
        assertEquals(result.isSupported(YEAR), true);
        assertEquals(result.isSupported(MONTH_OF_YEAR), true);
        assertEquals(result.isSupported(DAY_OF_MONTH), true);
        assertEquals(result.isSupported(HOUR_OF_DAY), false);
        assertEquals(result.getLong(YEAR), 2012L);
        assertEquals(result.getLong(MONTH_OF_YEAR), 6L);
        assertEquals(result.getLong(DAY_OF_MONTH), 30L);
        assertEquals(result.query(LocalDate::from), LocalDate.of(2012, 6, 30));
    }

    @Test(expectedExceptions=DateTimeParseException.class)
    public void test_parse_CharSequence_ParsePosition_parseError() {
        DateTimeFormatter test = DateTimeFormatter.ISO_DATE;
        ParsePosition pos = new ParsePosition(3);
        try {
            test.parse("XXX2012XXX", pos);
            fail();
        } catch (DateTimeParseException ex) {
            assertEquals(ex.getErrorIndex(), 7);
            throw ex;
        }
    }

    @Test(expectedExceptions=IndexOutOfBoundsException.class)
    public void test_parse_CharSequence_ParsePosition_indexTooBig() {
        DateTimeFormatter test = DateTimeFormatter.ISO_DATE;
        test.parse("Text", new ParsePosition(5));
    }

    @Test(expectedExceptions=NullPointerException.class)
    public void test_parse_CharSequence_ParsePosition_nullText() {
        DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        test.parse((CharSequence) null, new ParsePosition(0));
    }

    @Test(expectedExceptions=NullPointerException.class)
    public void test_parse_CharSequence_ParsePosition_nullParsePosition() {
        DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        test.parse("Text", (ParsePosition) null);
    }

    //-----------------------------------------------------------------------
    // parse(Query)
    //-----------------------------------------------------------------------
    @Test
    public void test_parse_Query_String() throws Exception {
        LocalDate result = DATE_FORMATTER.parse("ONE2012 07 27", LocalDate::from);
        assertEquals(result, LocalDate.of(2012, 7, 27));
    }

    @Test
    public void test_parse_Query_CharSequence() throws Exception {
        LocalDate result = DATE_FORMATTER.parse(new StringBuilder("ONE2012 07 27"), LocalDate::from);
        assertEquals(result, LocalDate.of(2012, 7, 27));
    }

    @Test(expectedExceptions=DateTimeParseException.class)
    public void test_parse_Query_String_parseError() throws Exception {
        try {
            DATE_FORMATTER.parse("ONE2012 07 XX", LocalDate::from);
        } catch (DateTimeParseException ex) {
            assertEquals(ex.getMessage().contains("could not be parsed"), true);
            assertEquals(ex.getMessage().contains("ONE2012 07 XX"), true);
            assertEquals(ex.getParsedString(), "ONE2012 07 XX");
            assertEquals(ex.getErrorIndex(), 11);
            throw ex;
        }
    }

    @Test(expectedExceptions=DateTimeParseException.class)
    public void test_parse_Query_String_parseErrorLongText() throws Exception {
        try {
            DATE_FORMATTER.parse("ONEXXX67890123456789012345678901234567890123456789012345678901234567890123456789", LocalDate::from);
        } catch (DateTimeParseException ex) {
            assertEquals(ex.getMessage().contains("could not be parsed"), true);
            assertEquals(ex.getMessage().contains("ONEXXX6789012345678901234567890123456789012345678901234567890123..."), true);
            assertEquals(ex.getParsedString(), "ONEXXX67890123456789012345678901234567890123456789012345678901234567890123456789");
            assertEquals(ex.getErrorIndex(), 3);
            throw ex;
        }
    }

    @Test(expectedExceptions=DateTimeParseException.class)
    public void test_parse_Query_String_parseIncomplete() throws Exception {
        try {
            DATE_FORMATTER.parse("ONE2012 07 27SomethingElse", LocalDate::from);
        } catch (DateTimeParseException ex) {
            assertEquals(ex.getMessage().contains("could not be parsed"), true);
            assertEquals(ex.getMessage().contains("ONE2012 07 27SomethingElse"), true);
            assertEquals(ex.getParsedString(), "ONE2012 07 27SomethingElse");
            assertEquals(ex.getErrorIndex(), 13);
            throw ex;
        }
    }

    @Test(expectedExceptions=NullPointerException.class)
    public void test_parse_Query_String_nullText() throws Exception {
        DATE_FORMATTER.parse((String) null, LocalDate::from);
    }

    @Test(expectedExceptions=NullPointerException.class)
    public void test_parse_Query_String_nullRule() throws Exception {
        DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        test.parse("30", (TemporalQuery<?>) null);
    }

    //-----------------------------------------------------------------------
    @Test
    public void test_parseBest_firstOption() throws Exception {
        DateTimeFormatter test = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm[XXX]");
        TemporalAccessor result = test.parseBest("2011-06-30 12:30+03:00", ZonedDateTime::from, LocalDateTime::from);
        LocalDateTime ldt = LocalDateTime.of(2011, 6, 30, 12, 30);
        assertEquals(result, ZonedDateTime.of(ldt, ZoneOffset.ofHours(3)));
    }

    @Test
    public void test_parseBest_secondOption() throws Exception {
        DateTimeFormatter test = DateTimeFormatter.ofPattern("yyyy-MM-dd[ HH:mm[XXX]]");
        TemporalAccessor result = test.parseBest("2011-06-30", ZonedDateTime::from, LocalDate::from);
        assertEquals(result, LocalDate.of(2011, 6, 30));
    }

    @Test(expectedExceptions=DateTimeParseException.class)
    public void test_parseBest_String_parseError() throws Exception {
        DateTimeFormatter test = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm[XXX]");
        try {
            test.parseBest("2011-06-XX", ZonedDateTime::from, LocalDateTime::from);
        } catch (DateTimeParseException ex) {
            assertEquals(ex.getMessage().contains("could not be parsed"), true);
            assertEquals(ex.getMessage().contains("XX"), true);
            assertEquals(ex.getParsedString(), "2011-06-XX");
            assertEquals(ex.getErrorIndex(), 8);
            throw ex;
        }
    }

    @Test(expectedExceptions=DateTimeParseException.class)
    public void test_parseBest_String_parseErrorLongText() throws Exception {
        DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        try {
            test.parseBest("ONEXXX67890123456789012345678901234567890123456789012345678901234567890123456789", ZonedDateTime::from, LocalDate::from);
        } catch (DateTimeParseException ex) {
            assertEquals(ex.getMessage().contains("could not be parsed"), true);
            assertEquals(ex.getMessage().contains("ONEXXX6789012345678901234567890123456789012345678901234567890123..."), true);
            assertEquals(ex.getParsedString(), "ONEXXX67890123456789012345678901234567890123456789012345678901234567890123456789");
            assertEquals(ex.getErrorIndex(), 3);
            throw ex;
        }
    }

    @Test(expectedExceptions=DateTimeParseException.class)
    public void test_parseBest_String_parseIncomplete() throws Exception {
        DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        try {
            test.parseBest("ONE30SomethingElse", ZonedDateTime::from, LocalDate::from);
        } catch (DateTimeParseException ex) {
            assertEquals(ex.getMessage().contains("could not be parsed"), true);
            assertEquals(ex.getMessage().contains("ONE30SomethingElse"), true);
            assertEquals(ex.getParsedString(), "ONE30SomethingElse");
            assertEquals(ex.getErrorIndex(), 5);
            throw ex;
        }
    }

    @Test(expectedExceptions=NullPointerException.class)
    public void test_parseBest_String_nullText() throws Exception {
        DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        test.parseBest((String) null, ZonedDateTime::from, LocalDate::from);
    }

    @Test(expectedExceptions=NullPointerException.class)
    public void test_parseBest_String_nullRules() throws Exception {
        DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        test.parseBest("30", (TemporalQuery<?>[]) null);
    }

    @Test(expectedExceptions=IllegalArgumentException.class)
    public void test_parseBest_String_zeroRules() throws Exception {
        DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        test.parseBest("30", new TemporalQuery<?>[0]);
    }

    @Test(expectedExceptions=IllegalArgumentException.class)
    public void test_parseBest_String_oneRule() throws Exception {
        DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        test.parseBest("30", LocalDate::from);
    }

    //-----------------------------------------------------------------------
    @Test
    public void test_parseUnresolved_StringParsePosition() {
        DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        ParsePosition pos = new ParsePosition(0);
        TemporalAccessor result = test.parseUnresolved("ONE30XXX", pos);
        assertEquals(pos.getIndex(), 5);
        assertEquals(pos.getErrorIndex(), -1);
        assertEquals(result.getLong(DAY_OF_MONTH), 30L);
    }

    @Test
    public void test_parseUnresolved_StringParsePosition_parseError() {
        DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        ParsePosition pos = new ParsePosition(0);
        TemporalAccessor result = test.parseUnresolved("ONEXXX", pos);
        assertEquals(pos.getIndex(), 0);
        assertEquals(pos.getErrorIndex(), 3);
        assertEquals(result, null);
    }

    @Test
    public void test_parseUnresolved_StringParsePosition_duplicateFieldSameValue() {
        DateTimeFormatter test = new DateTimeFormatterBuilder()
                .appendValue(MONTH_OF_YEAR).appendLiteral('-').appendValue(MONTH_OF_YEAR).toFormatter();
        ParsePosition pos = new ParsePosition(3);
        TemporalAccessor result = test.parseUnresolved("XXX6-6", pos);
        assertEquals(pos.getIndex(), 6);
        assertEquals(pos.getErrorIndex(), -1);
        assertEquals(result.getLong(MONTH_OF_YEAR), 6);
    }

    @Test
    public void test_parseUnresolved_StringParsePosition_duplicateFieldDifferentValue() {
        DateTimeFormatter test = new DateTimeFormatterBuilder()
                .appendValue(MONTH_OF_YEAR).appendLiteral('-').appendValue(MONTH_OF_YEAR).toFormatter();
        ParsePosition pos = new ParsePosition(3);
        TemporalAccessor result = test.parseUnresolved("XXX6-7", pos);
        assertEquals(pos.getIndex(), 3);
        assertEquals(pos.getErrorIndex(), 5);
        assertEquals(result, null);
    }

    @Test(expectedExceptions=NullPointerException.class)
    public void test_parseUnresolved_StringParsePosition_nullString() {
        DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        ParsePosition pos = new ParsePosition(0);
        test.parseUnresolved((String) null, pos);
    }

    @Test(expectedExceptions=NullPointerException.class)
    public void test_parseUnresolved_StringParsePosition_nullParsePosition() {
        DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        test.parseUnresolved("ONE30", (ParsePosition) null);
    }

    @Test(expectedExceptions=IndexOutOfBoundsException.class)
    public void test_parseUnresolved_StringParsePosition_invalidPosition() {
        DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        ParsePosition pos = new ParsePosition(6);
        test.parseUnresolved("ONE30", pos);
    }

    //-----------------------------------------------------------------------
    //-----------------------------------------------------------------------
    @Test
    public void test_toFormat_format() throws Exception {
        DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        Format format = test.toFormat();
        String result = format.format(LocalDate.of(2008, 6, 30));
        assertEquals(result, "ONE30");
    }

    @Test(expectedExceptions=NullPointerException.class)
    public void test_toFormat_format_null() throws Exception {
        DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        Format format = test.toFormat();
        format.format(null);
    }

    @Test(expectedExceptions=IllegalArgumentException.class)
    public void test_toFormat_format_notTemporal() throws Exception {
        DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        Format format = test.toFormat();
        format.format("Not a Temporal");
    }

    //-----------------------------------------------------------------------
    @Test
    public void test_toFormat_parseObject_String() throws Exception {
        DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        Format format = test.toFormat();
        TemporalAccessor result = (TemporalAccessor) format.parseObject("ONE30");
        assertEquals(result.isSupported(DAY_OF_MONTH), true);
        assertEquals(result.getLong(DAY_OF_MONTH), 30L);
    }

    @Test(expectedExceptions=ParseException.class)
    public void test_toFormat_parseObject_String_parseError() throws Exception {
        DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        Format format = test.toFormat();
        try {
            format.parseObject("ONEXXX");
        } catch (ParseException ex) {
            assertEquals(ex.getMessage().contains("ONEXXX"), true);
            assertEquals(ex.getErrorOffset(), 3);
            throw ex;
        }
    }

    @Test(expectedExceptions=ParseException.class)
    public void test_toFormat_parseObject_String_parseErrorLongText() throws Exception {
        DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        Format format = test.toFormat();
        try {
            format.parseObject("ONEXXX67890123456789012345678901234567890123456789012345678901234567890123456789");
        } catch (DateTimeParseException ex) {
            assertEquals(ex.getMessage().contains("ONEXXX6789012345678901234567890123456789012345678901234567890123..."), true);
            assertEquals(ex.getParsedString(), "ONEXXX67890123456789012345678901234567890123456789012345678901234567890123456789");
            assertEquals(ex.getErrorIndex(), 3);
            throw ex;
        }
    }

    @Test(expectedExceptions=NullPointerException.class)
    public void test_toFormat_parseObject_String_null() throws Exception {
        DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        Format format = test.toFormat();
        format.parseObject((String) null);
    }

    //-----------------------------------------------------------------------
    @Test
    public void test_toFormat_parseObject_StringParsePosition() throws Exception {
        DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        Format format = test.toFormat();
        ParsePosition pos = new ParsePosition(0);
        TemporalAccessor result = (TemporalAccessor) format.parseObject("ONE30XXX", pos);
        assertEquals(pos.getIndex(), 5);
        assertEquals(pos.getErrorIndex(), -1);
        assertEquals(result.isSupported(DAY_OF_MONTH), true);
        assertEquals(result.getLong(DAY_OF_MONTH), 30L);
    }

    @Test
    public void test_toFormat_parseObject_StringParsePosition_parseError() throws Exception {
        DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        Format format = test.toFormat();
        ParsePosition pos = new ParsePosition(0);
        TemporalAccessor result = (TemporalAccessor) format.parseObject("ONEXXX", pos);
        assertEquals(pos.getIndex(), 0);  // TODO: is this right?
        assertEquals(pos.getErrorIndex(), 3);
        assertEquals(result, null);
    }

    @Test(expectedExceptions=NullPointerException.class)
    public void test_toFormat_parseObject_StringParsePosition_nullString() throws Exception {
        // SimpleDateFormat has this behavior
        DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        Format format = test.toFormat();
        ParsePosition pos = new ParsePosition(0);
        format.parseObject((String) null, pos);
    }

    @Test(expectedExceptions=NullPointerException.class)
    public void test_toFormat_parseObject_StringParsePosition_nullParsePosition() throws Exception {
        // SimpleDateFormat has this behavior
        DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        Format format = test.toFormat();
        format.parseObject("ONE30", (ParsePosition) null);
    }

    @Test
    public void test_toFormat_parseObject_StringParsePosition_invalidPosition_tooBig() throws Exception {
        // SimpleDateFormat has this behavior
        DateTimeFormatter dtf = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        ParsePosition pos = new ParsePosition(6);
        Format test = dtf.toFormat();
        assertNull(test.parseObject("ONE30", pos));
        assertTrue(pos.getErrorIndex() >= 0);
    }

    @Test
    public void test_toFormat_parseObject_StringParsePosition_invalidPosition_tooSmall() throws Exception {
        // SimpleDateFormat throws StringIndexOutOfBoundException
        DateTimeFormatter dtf = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
        ParsePosition pos = new ParsePosition(-1);
        Format test = dtf.toFormat();
        assertNull(test.parseObject("ONE30", pos));
        assertTrue(pos.getErrorIndex() >= 0);
    }

    //-----------------------------------------------------------------------
    @Test
    public void test_toFormat_Query_format() throws Exception {
        Format format = BASIC_FORMATTER.toFormat();
        String result = format.format(LocalDate.of(2008, 6, 30));
        assertEquals(result, "ONE30");
    }

    @Test
    public void test_toFormat_Query_parseObject_String() throws Exception {
        Format format = DATE_FORMATTER.toFormat(LocalDate::from);
        LocalDate result = (LocalDate) format.parseObject("ONE2012 07 27");
        assertEquals(result, LocalDate.of(2012, 7, 27));
    }

    @Test(expectedExceptions=ParseException.class)
    public void test_toFormat_parseObject_StringParsePosition_dateTimeError() throws Exception {
        Format format = DATE_FORMATTER.toFormat(LocalDate::from);
        format.parseObject("ONE2012 07 32");
    }

    @Test(expectedExceptions=NullPointerException.class)
    public void test_toFormat_Query() throws Exception {
        BASIC_FORMATTER.toFormat(null);
    }

}


text:
<?php

namespace Markup\Addressing\Tests\Templating;

use Markup\Addressing\Templating\HandlebarsTemplate;
use Markup\Addressing\Templating\TemplateInterface;
use PHPUnit\Framework\TestCase;

class HandlebarsTemplateTest extends TestCase
{
    /**
     * @var array
     */
    private $context;

    /**
     * @var callable
     */
    private $renderFunction;

    /**
     * @var HandlebarsTemplate
     */
    private $template;

    protected function setUp(): void
    {
        $this->context = [
            'this' => 'that',
            'up' => 'down',
        ];
        $this->renderFunction = function ($context) {
            if ($context === $this->context) {
                throw new CustomTemplateException();
            }
        };
        $this->template = new HandlebarsTemplate($this->renderFunction);
    }

    public function testIsTemplate(): void
    {
        $this->assertInstanceOf(TemplateInterface::class, $this->template);
    }

    public function testRender(): void
    {
        $this->expectException(CustomTemplateException::class);
        $this->template->render($this->context);
    }
}

class CustomTemplateException extends \Exception
{

}


text:
const marked = require('util/marked');

const markdownString = $$STRING$$;

module.exports = options => {
  return marked(markdownString, options);
};


text:
module SECD.SECDCode(
  SECDCode, int, bool, float,
  closure, access, apply, ret,
  jump, condJump, label, dum, rap,
  builtin, cons) where

type Name = String

data SECDCode
     = Integer Int
     | Boolean Bool
     | Floating Float
     | Closure [SECDCode]
     | Access Int Int
     | Builtin Name
     | Apply
     | Cons
     | Return
     | Jump Int
     | CondJump Int
     | Label Int
     | Dummy
     | Rap
       deriving (Eq, Ord, Show)

int = Integer
bool = Boolean
float = Floating
closure = Closure
access = Access
builtin = Builtin
apply = Apply
cons = Cons
ret = Return
jump = Jump
condJump = CondJump
label = Label
dum = Dummy
rap = Rap


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package edu.artic.geneva.sync;

import java.io.IOException;
import java.util.List;
import java.util.Map;

import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.apache.camel.Processor;
import org.apache.camel.RuntimeCamelException;

/**
 * Represents a processor for extracting the "last successful sync date"
 * and formatting it into a qualifier for a SQL query..
 *
 * @author Aaron Coburn
 */
class LastSyncProcessor implements Processor {

    /**
     *  Convert the result set into a query qualifier
     *
     *  @param exchange the incoming message
     */
    public void process(final Exchange exchange) throws IOException {

        final Message in = exchange.getIn();

        final List<Map<String, Object>> rows = in.getBody(List.class);
        final StringBuilder sb = new StringBuilder("");
        final String updateField;

        try {
            updateField = exchange.getContext().resolvePropertyPlaceholders("{{geneva.updateField}}");
        } catch (final Exception ex) {
            throw new RuntimeCamelException("Error Resolving property geneva.updateField", ex);
        }

        if (rows.size() == 1 && rows.get(0).size() == 1) {
            for (final Map.Entry<String, Object> entry : rows.get(0).entrySet())
            {
                if (entry.getValue() != null) {
                    sb.append("WHERE ");
                    sb.append(updateField);
                    sb.append("> '" + entry.getValue().toString() + "'");
                }
            }
        }

        exchange.getOut().setBody(sb.toString());
    }
}


text:
<?php

require_once __DIR__ . "/lib/MemoryBackend.php";

class GitODBTest extends \PHPUnit_Framework_TestCase
{
    protected function setUp()
    {
        // currentry nothing to do.
    }

    protected function tearDown()
    {
        // currentry nothing to do.
    }

    public function testCheckMemcachedModule()
    {
        $this->assertEquals(true,extension_loaded("memcached"));
        require_once __DIR__ . "/lib/MemcachedBackend.php";
    }

    /**
     * @depends testCheckMemcachedModule
     */
    public function testConstruct()
    {
        $odb = new Git\ODB();
        $this->assertInstanceof("Git\\ODB",$odb);
    }

    /**
     * @depends testCheckMemcachedModule
     */
    public function testAddBackend()
    {
        $odb = new Git\ODB();
        $memcached = new Git\Backend\Memcached(5);
        $odb->addBackend($memcached);
        $this->assertInstanceof("Git\\ODB",$odb);
    }

    public function testMemoryBackend()
    {

        $odb = new Git\ODB();
        $memory = new Git\Backend\Memory(5);
        $odb->addBackend($memory);
        $this->assertInstanceof("Git\\ODB",$odb);
    }

}


text:
void ConstructPolynomial_wrp(int *ih_polynomial, const int *degree);
void DestructPolynomial_wrp(int *ih_polynomial);
void SetCoefficient_wrp(int *ih_polynomial, const int *degree,
                        const double *coefficient);
void HornerCompute_wrp(const int *ih_InputMat, int *ih_OutputMat,
                       const int *ih_polynomial,
                       const int *ih_solver_parameters);
void PatersonStockmeyerCompute_wrp(const int *ih_InputMat, int *ih_OutputMat,
                                   const int *ih_polynomial,
                                   const int *ih_solver_parameters);

#endif


text:
const _ = require('lodash');
const Promise = require('bluebird');
const fs = require('fs-extra');
const github = require('octonode');
const path = require('path');
const { exec } = require('child_process');

const green = '\u001b[42m \u001b[0m';
const red = '\u001b[41m \u001b[0m';

module.exports = {
  name: 'clone',
  usage: '[-r <repoPattern>] [--clean]',
  description: 'Gets a list of all repos in your team and runs git clone for each',
  options: [{
    name: 'clean',
    type: 'boolean',
    desc: 'Remove any repositories in the workspace that are no longer in the github team',
  }],
};

async function getRepoList(client, teamConfig) {
  const url = teamConfig.isUser ? '/user/repos' : `/teams/${teamConfig.id}/repos`;
  const options = { per_page: 20 };

  let page = 1;
  let hasNext = false;

  let toReturn = await client.getAsync(url, { ...options, page })
    .then(([, body, headers]) => {
      hasNext = _.includes(headers.link, 'rel="next"');
      return _.map(body, 'name');
    });

  while (hasNext) {
    page += 1;
    // eslint-disable-next-line no-await-in-loop
    const [result, responseHasNext] = await client.getAsync(url, { ...options, page })
      .then(([, body, headers]) => {
        const hasNextInHeaders = _.includes(headers.link, 'rel="next"');
        return [_.map(body, 'name'), hasNextInHeaders];
      });

    toReturn = _.union(toReturn, result);
    hasNext = responseHasNext;
  }

  return toReturn;
}

function checkCanDelete(bosco, repoPath) {
  function reducer(memo, command) {
    return new Promise((resolve, reject) => {
      exec(command, {
        cwd: repoPath,
      }, (err, stdout) => {
        if (err) return reject(err);
        resolve(memo && !stdout);
      });
    });
  }

  return Promise.reduce([
    'git stash list',
    'git branch --no-merged origin/master',
    'git status --porcelain',
  ], reducer, true);
}

function clone(bosco, progressbar, bar, repoUrl, orgPath) {
  if (!progressbar) bosco.log(`Cloning ${repoUrl.blue} into ${orgPath.blue}`);
  return new Promise((resolve) => {
    exec(`git clone ${repoUrl}`, {
      cwd: orgPath,
    }, (err, stdout, stderr) => {
      if (progressbar) bar.tick();
      if (err) {
        if (progressbar) bosco.console.log('');
        bosco.error(`${repoUrl.blue} >> ${stderr}`);
      } else if (!progressbar && stdout) bosco.log(`${repoUrl.blue} >> ${stdout}`);
      resolve();
    });
  });
}

async function fetch(bosco, team, repos, repoRegex) {
  const orgPath = bosco.getOrgPath();

  function saveRepos() {
    bosco.config.set(`teams:${team}:repos`, repos);
    return new Promise((resolve, reject) => {
      bosco.config.save((err, ...rest) => (err ? reject(err) : resolve(...rest)));
    });
  }

  async function checkOrphans() {
    function warnOrphan(orphan) {
      bosco.warn(`I am concerned that you still have the repo ${orphan.red} as it is no longer in the github team, run "bosco clone --clean" to remove them.`);
    }

    async function removeOrphan(orphan) {
      const orphanPath = bosco.getRepoPath(orphan);
      try {
        const canDelete = await checkCanDelete(bosco, orphanPath);
        if (!canDelete) {
          bosco.warn(`Not deleting project ${orphan.red} as you have uncommited or unpushed local changes.`);
          return Promise.resolve();
        }

        await fs.remove(orphanPath);
        bosco.log(`Deleted project ${orphan.green} as it is no longer in the github team and you have no local changes.`);
      } catch (err) {
        bosco.warn(`Not deleting project ${orphan.red} as you have uncommited or unpushed local changes.`);
        return Promise.resolve();
      }
    }

    let orphanAction = warnOrphan;
    if (bosco.options.clean) {
      orphanAction = removeOrphan;
    }

    const files = await fs.promises.readdir(bosco.getOrgPath());
    const orphans = _.chain(files)
      .map((file) => path.join(bosco.getOrgPath(), file))
      .filter((file) => fs.statSync(file).isDirectory() && bosco.exists(path.join(file, '.git')))
      .map((file) => path.relative(bosco.getOrgPath(), file))
      .difference(repos)
      .value();
    return Promise.map(orphans, orphanAction);
  }

  async function getRepos() {
    const progressbar = bosco.config.get('progress') === 'bar';
    const total = repos.length;
    let pullFlag = false;

    const bar = progressbar ? new bosco.Progress('Getting repositories [:bar] :percent :etas', {
      complete: green,
      incomplete: red,
      width: 50,
      total,
    }) : null;

    await Promise.map(repos, (repo) => {
      if (!repo.match(repoRegex)) return Promise.resolve();

      const repoPath = bosco.getRepoPath(repo);
      const repoUrl = bosco.getRepoUrl(repo);

      if (bosco.exists(repoPath)) {
        pullFlag = true;
        if (progressbar) bar.tick();
        return Promise.resolve();
      }

      return clone(bosco, progressbar, bar, repoUrl, orgPath);
    }, { concurrency: bosco.concurrency.network });

    if (pullFlag) {
      bosco.warn('Some repositories already existed, to pull changes use \'bosco pull\'');
    }
  }

  async function gitIgnoreRepos() {
    // Ensure repo folders are in workspace gitignore
    const gi = [bosco.getWorkspacePath(), '.gitignore'].join('/');
    const contents = await fs.readFile(gi);
    const ignore = (contents || '').toString().split('\n');
    const newIgnore = _.union(ignore, repos, ['.DS_Store', 'node_modules', '.bosco/bosco.json', '']);
    return fs.writeFile(gi, `${newIgnore.join('\n')}\n`);
  }

  await saveRepos();
  await checkOrphans();
  await getRepos();
  await gitIgnoreRepos();
  bosco.log('Complete');
}

async function cmd(bosco) {
  const repoPattern = bosco.options.repo;
  const repoRegex = new RegExp(repoPattern);
  const team = bosco.getTeam() || 'no-team';
  const teamConfig = bosco.config.get(`teams:${team}`);

  const client = github.client(bosco.config.get('github:authToken'), { hostname: bosco.config.get('github:apiHostname') });

  if (!teamConfig) {
    // The user does not have a team, so just treat the repos config
    // as manually edited
    return bosco.error([
      'Looks like you havent linked this workspace to a team?  Try: ',
      'bosco team setup'.green,
      '. If you can\'t see your team in the list, Try: ',
      'bosco team sync'.green,
    ].join(''));
  }

  bosco.log(`Fetching repository list from Github for ${team.green} team ...`);

  try {
    const repoList = await getRepoList(client, teamConfig);
    bosco.log(`Cloning ${(`${repoList.length}`).green} repositories from Github for ${team.green} team ...`);
    await fetch(bosco, team, repoList, repoRegex);
  } catch (err) {
    bosco.error(err);
  }
}

module.exports.cmd = cmd;


text:
/*
 * This file is part of the Linalg project, a C++ interface to BLAS and LAPACK.
 *
 * The source-code is licensed under the terms of the MIT license, read LICENSE for more details.
 *
 * (c) 2011, 2012 Hannes Matuschek <hmatuschek at gmail dot com>
 */

#ifndef NRM2TEST_HH
#define NRM2TEST_HH

#include "unittest.hh"

/**
 * Simple test-case for @c Linalg::BLAS::nrm2.
 */
class NRM2Test : public UnitTest::TestCase
{
public:
  void testVector();
  void testMatrixColumnRowMajor();
  void testMatrixColumnColMajor();
  void testMatrixRowRowMajor();
  void testMatrixRowColMajor();

public:
  static UnitTest::TestSuite *suite();
};

#endif // NRM2TEST_HH


text:
#include "test_condition_variable.h"

int TestMain() {
    REMARK( "testing with tbb condvar\n" );
    DoCondVarTest<tbb::mutex,tbb::recursive_mutex>();
    return Harness::Done;
}


text:
Title: Recovery and Worse again
Date: 2008-01-05 12:05
Author: eamonnfaherty
Category: misc
Slug: recovery-and-worse-again

I went into work yesterday as I felt better. Big mistake! I feel like
shit now. I was up nearly all night. I was sick about 8 times. Arghh! I
am going to stay in bed until Tuesday now!

In other news, my slug is working wonderfully.
http://garlic.doughball.co.uk is its public address. I am running
lighttpd, which seems pretty cool. I found an application call
[hellanzb](http://www.hellanzb.com/). It is awesome. Better than the
[perlnzb](http://noisybox.net/computers/nzbperl/) application I have
been using. The application offers a service which you can connect to
using many applications and even a firefox extension. That is the real
reason why it is so much better.

![](http://res1.blogblog.com/tracker/1073453416984109270-2466718985849374950?l=eamonn.designandsolve.co.uk)


text:
package morfologik.speller;

import static org.junit.Assert.*;

import morfologik.speller.HMatrix;

import org.junit.Test;

public class HMatrixTest {
  private static final int MAX_WORD_LENGTH = 120;

  @Test
  public void stressTestInit() {
    for (int i = 0; i < 10; i++) { // test if we don't get beyond array limits etc.
      HMatrix H = new HMatrix(i, MAX_WORD_LENGTH);
      assertEquals(0, H.get(1, 1));
    }
  }
}


text:
interface Number {
    doStuff(): string;
}

interface NotNumber {
    toString(radix?: number): string;
    toFixed(fractionDigits?: number): string;
    toExponential(fractionDigits?: number): string;
    toPrecision(precision?: number): string;
    valueOf(): number;
    doStuff(): string;
}

var x = 1;
var a: Number;
var b: NotNumber;

a = x;
a = b;

b = a;
b = x;

x = a; // expected error
x = b; // expected error


text:
#ifndef TENSORFLOW_CORE_DISTRIBUTED_RUNTIME_COLLECTIVE_PARAM_RESOLVER_DISTRIBUTED_H_
#define TENSORFLOW_CORE_DISTRIBUTED_RUNTIME_COLLECTIVE_PARAM_RESOLVER_DISTRIBUTED_H_

#include "tensorflow/core/common_runtime/collective_param_resolver_local.h"
#include "tensorflow/core/framework/device_attributes.pb.h"

namespace tensorflow {
class ConfigProto;
class WorkerCacheInterface;
class DeviceResolverDistributed;
class DeviceMgr;

class CollectiveParamResolverDistributed : public CollectiveParamResolverLocal {
 public:
  CollectiveParamResolverDistributed(const ConfigProto& config,
                                     const DeviceMgr* dev_mgr,
                                     DeviceResolverDistributed* dev_resolver,
                                     WorkerCacheInterface* worker_cache,
                                     const string& task_name);

  void CompleteParamsAsync(const DeviceAttributes& device, CollectiveParams* cp,
                           CancellationManager* cancel_mgr,
                           const StatusCallback& done) override;

  void CompleteGroupAsync(const CompleteGroupRequest* request,
                          CompleteGroupResponse* response,
                          CancellationManager* cancel_mgr,
                          const StatusCallback& done) override;

  void CompleteInstanceAsync(const CompleteInstanceRequest* request,
                             CompleteInstanceResponse* response,
                             CancellationManager* cancel_mgr,
                             const StatusCallback& done) override;

 protected:
  // Returns the cached group iff there's an entry for this group_key in the
  // local group_table_; returns nullptr otherwise.
  GroupRec* GetCachedGroup(int32 group_key) TF_LOCKS_EXCLUDED(group_mu_);

  // Updates group_table_ with contents of resp.
  Status UpdateGroupCache(const CompleteGroupResponse& resp)
      TF_LOCKS_EXCLUDED(group_mu_);

  // Finds the GroupRec that corresponds to cp->group_key and also
  // populates cp->group from that GroupRec.
  //
  // Semantics are like those of CompleteGroupLocal but will make a
  // remote call to the group leader if necessary.
  void CompleteGroupDistributed(const DeviceAttributes& device,
                                CollectiveParams* cp,
                                CancellationManager* cancel_mgr,
                                const GroupRecCallback& done);

  // Returns true iff there's an entry for this instance_key in the
  // local instance_table_.
  bool InstanceIsCached(int32 group_key, int32 instance_key)
      TF_LOCKS_EXCLUDED(instance_mu_);

  // Updates instance_table_ with contents of resp.
  void UpdateInstanceCache(const GroupRec* gr, CollectiveParams* cp,
                           const CompleteInstanceResponse& resp,
                           const StatusCallback& done)
      TF_LOCKS_EXCLUDED(instance_mu_, gr->mu, group_mu_);

  // Finish populating *cp.  Semantics are like those of
  // CompleteInstanceLocal but will make a remote call to the group
  // leader if necessary.
  void CompleteInstanceDistributed(const string& device, const GroupRec* gr,
                                   CollectiveParams* cp,
                                   CancellationManager* cancel_mgr,
                                   const StatusCallback& done)
      TF_LOCKS_EXCLUDED(instance_mu_, gr->mu, group_mu_);

  WorkerCacheInterface* worker_cache_;  // Not owned
  const string group_leader_;
};

}  // namespace tensorflow
#endif  // TENSORFLOW_CORE_DISTRIBUTED_RUNTIME_COLLECTIVE_PARAM_RESOLVER_DISTRIBUTED_H_