~alexreg/mathtexdotnet/0.1

« back to all changes in this revision

Viewing changes to TexDotNet.Tests/DebugExtensions.cs

  • Committer: Alex Regueiro
  • Date: 2009-09-25 19:25:01 UTC
  • Revision ID: alexreg@gmail.com-20090925192501-lyu4daug4m0f6he7
Rewrote testing framework. Tests work on principle that if you parse an expression, write it back, and parse it again, the two expression trees should always be equivalent.
Fixed bug in TexComposer involving  brackets.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
using System;
2
 
using System.Collections.Generic;
3
 
using System.Linq;
4
 
using System.Text;
5
 
 
6
 
namespace TexDotNet
7
 
{
8
 
    using TokenStream = IEnumerator<TexToken>;
9
 
 
10
 
    public static class DebugExtensions
11
 
    {
12
 
        public static string ToTokenString(this TokenStream stream)
13
 
        {
14
 
            return ToTokenString(stream.ToArray());
15
 
        }
16
 
 
17
 
        public static string ToTokenString(this IEnumerable<TexToken> stream)
18
 
        {
19
 
            return string.Join(" ", stream.Select(t => t.ToString()).ToArray());
20
 
        }
21
 
    }
22
 
}